Spatiallens Mcp — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited Spatiallens Mcp (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
USD/USDZ/USDA scene graph parser and spatial analysis tool for AI agents.
SpatialLens gives AI coding agents (Claude, Codex, Gemini, etc.) structured access to 3D scene data from Apple's USD ecosystem. It parses binary .usdz and text .usda files into structured JSON that any AI can reason about — entity hierarchies, material shader graphs, spatial positions, transforms, and relationships between objects.
Status: Work in Progress. Actively developed and tested against real visionOS game assets. Core parsing and spatial analysis are functional. Contributions and feedback welcome.
AI agents working on visionOS, RealityKit, or any USD-based 3D project are blind to what's actually in the asset files. They can read Swift code that references entity names and positions, but they can't see the USDZ contents — the hierarchy, the materials, the transforms, the shader graphs. This creates a gap where the AI guesses instead of knowing.
SpatialLens closes that gap by translating binary 3D assets into structured text that AI agents natively understand.
python cli.py <command> <file> [options]No MCP required. Runs anywhere with Python 3.12+ and Apple's USD tools. Output is JSON to stdout — pipe it, save it, paste it into a prompt.
python server.pyExposes all tools over MCP for real-time use during coding sessions.
usdcat and usdtree at /usr/bin/ (ships with Xcode Command Line Tools)Verify your setup:
usdcat --version # Should print "Apple USD Tools (x.x.x)"
usdtree --version # Same
python3 --version # 3.12+git clone https://github.com/RevivrStudios/spatiallens-mcp.git
cd spatiallens-mcp
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtAll commands output structured JSON to stdout unless noted.
scene — Full Scene Graphpython cli.py scene Player_Ships.usdzReturns the complete prim hierarchy with types, paths, properties, and children. Use this for deep analysis.
tree — Quick Hierarchy (text output)python cli.py tree Player_Ships.usdzReturns an indented text tree. Fast overview of what's in a file.
materials — Materials and Shader Graphspython cli.py materials TerrainGlass.usdaReturns all materials with shader node IDs, input parameters, output connections, and the full shader graph. Use this for debugging visual issues.
transforms — Positioned Entitiespython cli.py transforms Player_Ships.usdzReturns every entity that has translate, rotate, or scale data.
entities — List All Entitiespython cli.py entities Enemy_Ships.usdz
python cli.py entities Enemy_Ships.usdz --type MeshFlat list of all entities. Filter by type: Mesh, Material, Shader, Xform, Sphere, Scope.
details — Single Entity Deep Divepython cli.py details Player_Ships.usdz --path "/__spaceships_set/Meshes"Full properties and children for one specific entity. If the path doesn't exist, returns all available paths.
layout — Spatial Layout Analysispython cli.py layout Player_Ships.usdzReturns:
diff — Compare Two Filespython cli.py diff Player_Ships.usdz Enemy_Ships.usdzStructural diff: added prims, removed prims, changed properties. Use after editing a USDZ in Reality Composer Pro.
overlaps — Find Overlapping Entitiespython cli.py overlaps Player_Ships.usdz --threshold 0.05Flags entity pairs closer than the threshold (default 1cm). Catches z-fighting, stacked geometry, accidental overlaps.
relationship — Spatial Relationship Between Two Entitiespython cli.py relationship Player_Ships.usdz \
--a "/__spaceships_set/.../SpaceShip1_" \
--b "/__spaceships_set/.../SpaceShip2_"Returns distance and plain English description: "SpaceShip2_ is 1.665m to the right and 0.022m toward viewer from SpaceShip1_"
move — Compute New Positionpython cli.py move Player_Ships.usdz \
--path "/__spaceships_set/.../SpaceShip1_" \
--direction right \
--meters 0.5Returns current position, direction, and computed new position. Directions: left, right, up, down, forward, back, toward viewer, away from viewer.
SpatialLens uses the RealityKit / visionOS coordinate system:
| Direction | Axis | Sign |
|---|---|---|
| Right | X | + |
| Left | X | - |
| Up | Y | + |
| Down | Y | - |
| Toward viewer | Z | + |
| Away from viewer | Z | - |
Units: 1 unit = metersPerUnit meters (read from the USD file metadata). Common values:
metersPerUnit = 1 — units are meters (RealityKit default)metersPerUnit = 0.01 — units are centimeters (common in Sketchfab/Blender exports)SpatialLens reads metersPerUnit from each file and converts all spatial output to meters automatically.
For Claude Desktop, add to your claude_desktop_config.json:
{
"mcpServers": {
"spatiallens": {
"command": "/path/to/spatiallens-mcp/venv/bin/python",
"args": ["/path/to/spatiallens-mcp/server.py"]
}
}
}The MCP server exposes 11 tools:
parse_scene_graph — full scene graphhierarchy_tree — quick text treeget_materials — materials and shadersget_transforms — positioned entitieslist_entities — flat entity list with type filterget_entity_details — single entity deep divediff_scenes — structural diffspatial_layout — spatial analysis with bounding boxspatial_relationship — relationship between two entitiescheck_spatial_overlaps — overlap detectionmove_suggestion — compute new position from directionspatiallens-mcp/
├── cli.py # Standalone CLI (no MCP needed)
├── server.py # MCP server entry point
├── usda_parser.py # USDA text → structured dict parser
├── spatial_math.py # Coordinate geometry and spatial analysis
├── requirements.txt # Python dependencies (fastmcp, mcp)
└── tests/
├── test_parser.py # Unit tests for USDA parser
└── test_tools.py # Integration tests against real USDZ filesCore modules:
usdcat --flatten. Extracts prim hierarchy, types, properties, material bindings, shader connections. Handles nested metadata blocks and customData annotations.xformOp:translate or 4x4 transform matrices), distance calculation, relative position descriptions, bounding box analysis, overlap detection, move suggestions. No app-specific logic.usdcat/usdtree, passes results through the parser and spatial math modules, and returns structured JSON.If you're an AI agent reading this README, here's how to get value from SpatialLens:
The JSON output is designed to be parsed programmatically. Every command returns valid JSON to stdout (except tree which returns text).
Key insight: When the human says "move it to the right" or "the ships are too close together," you can now quantify that with real coordinates instead of guessing. Use layout to see where things are, relationship to measure distances, and move to compute exact position changes.
All from a real visionOS game project. 17/17 tests passing.
usdcat and usdtree CLI toolsMIT
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.