Skip to main content
Glama
world-model-mcp
by putervision

@putervision/world-model-mcp

npm version version npm downloads CI Node TypeScript Website License: MIT

@putervision/world-model-mcp is a zero-infrastructure, deterministic Model Context Protocol (MCP) server that maintains a persistent 3D/2D spatial world model for AI agents. It bridges perception (@putervision/vision-memory-mcp) and reasoning/action (@putervision/state-memory-mcp) with durable entity tracking, object permanence with confidence decay, movement simulation with AABB collision avoidance, expected view frustum projection, and Playwright 3D game automation.

๐ŸŒ Official Documentation & Website: putervision.com


โšก Quick Start & Installation

Prerequisites: Node.js >= 18.18.0

# 1. Install globally
npm install -g @putervision/world-model-mcp

# 2. Navigate to your project directory
cd your-project

# 3. Initialize world-model-mcp
# Creates .world-model-mcp/, updates .gitignore, registers project,
# and scaffolds IDE instructions and MCP configs for Cursor, Claude, VS Code, Windsurf, etc.
world-model-mcp init

# Done! Restart your IDE or Agent Manager to activate.

Alternative Options

# Run directly via binary (after global install)
world-model-mcp run

# Launch interactive 3D WebGL Scene Visualizer
world-model-mcp view

# Display database metrics and permanence confidence stats
world-model-mcp stats

Related MCP server: persistent-kb-mcp

๐ŸŒŸ Key Highlights

  • ๐ŸŒ Deterministic 3D/2D Spatial Memory & Compact Slices: Zero LLM in the loop for spatial indexing; deterministic SQLite WAL queries with FTS5 search, 3D Euclidean proximity radius lookups, and sub-1KB observer-relative compact slices ($K \le 16$ nearest entities) for System 1 fast path evaluation.

  • โšก 15 Production-Grade Consolidated MCP Tools: Full CRUD, topological spatial graphs (on, inside, contains, near), ray-AABB occlusion frustum culling, waypoint navigation, and time-travel rollback.

  • โณ Object Permanence & Decay: Entities remain in persistent memory even when out of view, with configurable exponential confidence decay ($C = C_0 \cdot e^{-\lambda t}$) and status lifecycles (active โ†’ hidden โ†’ lost).

  • ๐Ÿš€ Collision & Movement Simulation: Predicts entity displacement trajectories, detects AABB obstacle collisions, and computes obstacle-avoiding navigation waypoints before actions execute.

  • ๐ŸŽฎ Playwright Game Automation: Generates timed WASD / Arrow keyboard hold sequences (KeyW for 450ms, ArrowLeft for 290ms) and 3Dโ†”2D coordinate screen projections.

  • ๐Ÿค Multi-Agent Spatial Blackboard: Topic-based coordination with TTL, mutex locks, and collision intent alerts across parallel subagents.

  • ๐Ÿ›ก๏ธ Spatial Spec-Driven Development (Spatial SDD): Physical design contract baseline registration, live verification (clearance, bounds, containment), and cryptographic SHA-256 evidence bundles.

  • ๐ŸŽจ Interactive 3D WebGL Visualizer: Browser-based Three.js 3D viewport rendering active entities, orientation axes, frustum cones, and topological links (world-model-mcp view).

  • ๐Ÿ”’ 100% Local & Private: All spatial entities, relations, and history stay inside .world-model-mcp/ in your workspace.


๐Ÿ› ๏ธ MCP Tool Suite

@putervision/world-model-mcp provides 15 production-grade consolidated MCP tools organized across 5 core workflow domains:

  • Spatial Memory & Search: update_entity (entity CRUD, 3D bounds, properties, confidence), query_entities (FTS5 search, proximity radius, status/tags filter, history lookup), set_relation (topological graph links: on, inside, near, contains), get_spatial_map (JSON, GeoJSON, glTF 2.0, OBJ, summary, and format: "compact_slice").

  • Simulation & Vision Integration: simulate_movement (displacement prediction, AABB collision checks, waypoint routing), ingest_observation (vision detection ingestion, Euclidean re-identification, frustum reconciliation), get_expected_view (observer pose, horizontal FOV cone, ray-AABB occlusion).

  • Goal & State Integration: link_to_goal (associate entities/regions with State Memory tasks, extract spatial context slices), record_outcome (record execution results, position shifts, property changes, destruction).

  • Spatial SDD & Proofs: manage_spatial_spec (register physical clearance/containment contracts, live verification scoring), create_evidence_pack (cryptographic SHA-256 evidence bundles linking spatial proofs to task nodes).

  • Multi-Agent, Replay & Automation: use_spatial_blackboard (topic board, mutex claim/release, intent conflicts), manage_snapshot (checkpoints, snapshot diffing, time-travel undo), wait_for_spatial_state (async polling for target spatial condition), generate_game_inputs (Playwright WASD hold timings, 3Dโ†”2D screen ray projection).

๐Ÿ‘‰ For complete parameter specifications, return schemas, and example payloads, see the API Reference Guide and Database Schema.


๐Ÿš€ Architecture & Spatial Memory Lifecycle

                     Perception / Vision Detection
                                  โ”‚
                                  โ–ผ
                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                 โ”‚  Perception Ingestion & Re-ID   โ”‚ โ”€โ”€โ–ถ ingest_observation(reconcile: true)
                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                  โ”‚
                                  โ–ผ
                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                 โ”‚  Durable Entity & Permanence    โ”‚ โ”€โ”€โ–ถ update_entity(...)
                 โ”‚  (3D Bounding Boxes, Decay)     โ”‚ โ”€โ”€โ–ถ set_relation(relation: "on"|"inside")
                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                  โ”‚
                                  โ–ผ
                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                 โ”‚  Simulation & Waypoint Routing  โ”‚ โ”€โ”€โ–ถ simulate_movement(mode: "navigate")
                 โ”‚  (AABB Collision Avoidance)     โ”‚ โ”€โ”€โ–ถ get_expected_view(fov: 90)
                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                  โ”‚
                                  โ–ผ
                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                 โ”‚  Playwright & Action Execution  โ”‚ โ”€โ”€โ–ถ generate_game_inputs(...)
                 โ”‚  (WASD Sequences, Screen Rays)  โ”‚ โ”€โ”€โ–ถ record_outcome(action_type: "move")
                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                  โ”‚
                                  โ–ผ
                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                 โ”‚  Spatial SDD & Cryptographic    โ”‚ โ”€โ”€โ–ถ manage_spatial_spec(action: "verify")
                 โ”‚  Evidence Bundling to Tasks     โ”‚ โ”€โ”€โ–ถ create_evidence_pack(...)
                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                  โ”‚
                                  โ–ผ
                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                 โ”‚  Persistent SQLite Engine       โ”‚ โ”€โ”€โ–ถ .world-model-mcp/world.db (WAL mode)
                 โ”‚  Append-Only History Ledger     โ”‚ โ”€โ”€โ–ถ SHA-256 Cryptographic Audit Chain
                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“š Documentation Directory

Explore dedicated guides and deep dives in the docs/ directory:

Guide

Description

๐Ÿ—๏ธ Architecture & Codebase Distillation

High-signal architectural overview, module inventory, data flows, and design decisions.

๐Ÿ’ก Features & Triad Overview

PuterVision Autonomous Triad interaction, 3D WebGL scene visualizer, and evidence packs.

๐Ÿ“‹ Spatial World Model Concepts

Object Permanence ($C = C_0 \cdot e^{-\lambda t}$), Confidence Decay, Frustum Projection, and Spatial SDD.

โš™๏ธ Configuration & IDE Setup

Auto-Initialization details, Environment Variables, and Editor Configs (Cursor, VS Code, Claude, Windsurf).

๐Ÿ› ๏ธ CLI Command Reference

CLI flags (init, run, view, stats, inspect, map, export, import, doctor, snapshot, spec, blackboard).

๐Ÿงฐ Tools & API Reference

Complete reference for all 15 Consolidated MCP Tools, legacy tool mapping, and parameter examples.

๐Ÿ—„๏ธ Database Schema

SQLite tables (entities, spatial_relations, entity_history, spatial_specs, blackboard_items, evidence_packs).

๐ŸŽฎ Interactive 3D Game Arena Demo

Autonomous 3D browser arena with Three.js bridge diagnostics (window.__WORLD_MODEL_BRIDGE).

๐Ÿงญ Examples & Tutorials

Deep-dive examples: Spatial Navigation, Perception Reconciliation, and Multi-Agent Blackboard.


๐Ÿ“– Agent Playbook: 5-Step Canonical Workflow

When an autonomous AI agent enters a repository with world-model-mcp:

1. Orient & Explore   โ”€โ”€โ–ถ get_spatial_map(format: "summary") + get_expected_view(fov: 90)
2. Query & Locate     โ”€โ”€โ–ถ query_entities(query: "chest", radius: 15) + query_entities(entity_id: "...")
3. Plan & Simulate    โ”€โ”€โ–ถ simulate_movement(mode: "navigate") + manage_spatial_spec(action: "verify")
4. Execute & Ingest   โ”€โ”€โ–ถ generate_game_inputs(...) + ingest_observation(reconcile: true)
5. Record & Evidence  โ”€โ”€โ–ถ record_outcome(...) + create_evidence_pack(task_id: "...")

๐Ÿงช Testing

# Run full unit, integration, and geometry stress test suite across 47 test files (206 tests)
npm test

# Run multi-Node matrix test suite across Node.js 18, 20, and 22
npm run test:matrix

# Run 3D geometry, projection, and Playwright game loop tests
npm run test:3d

โš–๏ธ License & Disclaimers

Developed and maintained by PuterVision. Released under the MIT License.

  • Local Storage Guarantee: All spatial coordinates, bounding volumes, and entity history remain 100% local in your workspace. No telemetry or project data is ever transmitted.

  • Trademarks & Non-Affiliation: Product names (Cursor, Claude Code, Gemini, Windsurf, VS Code, GitHub, SQLite, Three.js, Playwright) are property of their respective owners and used solely for compatibility identification.

Available Tools

15 tools
create_evidence_packA

Package entity positions, observation reconciliations, and snapshot states into an immutable, SHA-256 hashed cryptographic evidence pack for compliance and state-memory task verification. Does not change entities; hashes current proof. Returns {ok, pack_id, hash, payload}. Use create_evidence_pack instead of manage_snapshot when creating immutable cryptographic verification packages rather than database checkpoints.

Inputs: project, task_id, entity_ids, observation_ids, +3 more.

generate_game_inputsA
Read-onlyIdempotent

Translate 3D navigation paths into Playwright commands (WASD/click-to-move) or project/unproject 3D coordinates and screen pixels. Actions: generate_inputs, project_screen, unproject_ray. Read-only: generates Playwright inputs, does not press keys. Returns {ok, action, inputs[]|screen_coords|ray}. Use generate_game_inputs instead of simulate_movement when translating 3D trajectories into Playwright browser automation commands.

Inputs: action, camera, project, screen_x, +13 more.

get_expected_viewA
Read-onlyIdempotent

Compute which entities should be visible from an observer pose and FOV cone, with ray-AABB occlusion. Read-only. Does not write entities. Returns {visible[], occluded[], observer}. Use get_expected_view instead of get_spatial_map when computing observer FOV visibility and occlusion cones rather than unfiltered world states.

Inputs: observer_position (required), project, fov_degrees, max_distance, +1 more.

get_spatial_mapA
Read-onlyIdempotent

Export the known world as json, geojson, topological_graph, gltf, obj, joint, spatial_vlm, summary, or compact_slice. Optional region_id and min_confidence filters. Read-only snapshot of current SQLite state (not a live renderer). Returns the payload in requested format. Use get_spatial_map instead of query_entities when exporting full environment snapshots or 3D meshes rather than filtering entities.

Inputs: k, format, project, region_id, +3 more.

ingest_observationA

Merge vision detections into the world model: re-identify by Euclidean proximity, boost confidence, and optionally reconcile against the expected frustum. This is the perception writer. It may create or update entities when reconcile=true. Returns {ok, matched[], created[], lost[], reconcile}. Use ingest_observation instead of update_entity when merging camera or sensor perception detections rather than manual authoring.

Inputs: detections (required), project, reconcile, field_of_view, +2 more.

manage_snapshotA
Destructive

Checkpoint, diff, undo, or time-travel the spatial world database. Actions: save, restore, diff, list, undo, history, time_travel. restore (overwrites live state) and undo (reverts last matching mutation) are destructive and not always reversible except by saving first. diff, list, history, and time_travel are read-only. Returns {ok, action, snapshots[]|diff|state}. Use manage_snapshot instead of update_entity when rolling back, diffing, or time-traveling database state rather than editing single entities.

Inputs: name, type, action, project, +5 more.

manage_spatial_specA

Manage Spatial Spec-Driven Development (Spatial SDD) physical baseline contracts. Actions: set (registers a baseline spec), verify (evaluates live entities against constraints without mutating), list (returns all registered specs). verify is read-only. set persists constraints. Returns {ok, action, spec_id, passed:boolean, violations[]}. Use manage_spatial_spec instead of update_entity when validating physical contract baselines rather than mutating live entity state.

Inputs: name, action, bounds, project, +4 more.

query_entitiesA
Read-onlyIdempotent

Find entities by keyword query (FTS5 search), type, region, spatial proximity, tags, or status. Alternatively, provide entity_id for single-entity location and historical trajectory lookup. Read-only. Returns {ok, count, entities[]}. Use query_entities instead of get_spatial_map when searching for specific subsets rather than exporting the full topology.

Inputs: tags, type, limit, query, +9 more.

record_outcomeA

Record action execution results, movement deltas, property changes, entity destruction, or spool outcome ingestion from 60Hz loop. Not for vision ingest or manual pose edits. Mark entity destroyed via status: "destroyed". Returns {ok, action, success:boolean, ...}. Use record_outcome instead of update_entity when applying executed action results and status deltas rather than hand-authoring entities.

Inputs: items, action, project, success, +9 more.

set_relationA

Record or remove a spatial relationship between two entities. Actions: add, remove. Relations: on, inside, next_to, above, below, near, contains, occluded_by, connected_to, facing, holding, part_of, custom. This mutates the relation graph only, not entity poses. Returns {ok, relation}. Use set_relation instead of update_entity when establishing topological links (on, inside, contains) rather than setting entity coordinates.

Inputs: relation (required), source_id (required), target_id (required), action, +5 more.

simulate_movementA
Read-onlyIdempotent

Predict entity trajectory, test for AABB obstacle collisions, or compute navigation waypoints (modes: simulate, navigate, waypoints). Read-only simulation. Returns {ok, is_valid, destination, collisions[], waypoints[]}. Use simulate_movement instead of record_outcome when testing hypothetical motion and collisions before executing an action.

Inputs: mode, project, velocity, entity_id, +7 more.

update_entityA

Create or upsert one spatial entity (position, orientation, AABB, tags, properties, confidence). Manual authoring only. Omit id to create (ULID assigned). Provide id to update. Omitted fields are preserved; this is a partial merge, not a full replace. status defaults to active. confidence is 0.0โ€“1.0 object-permanence. Does not ingest vision detections or apply action results. Returns {ok, entity_id, created:boolean, entity}. Use update_entity instead of ingest_observation when authoring entities directly rather than merging perception detections.

Inputs: name (required), type (required), id, tags, +11 more.

use_spatial_blackboardA
Destructive

Publish or read multi-agent spatial coordination topics, collision alerts, and mutex region leases. Actions: get, set, delete, lease, list, post, read, claim, release. set writes payload (coordinates allowed for collision alerts) with optional ttl_seconds. lease acquire fails if the resource is held. delete is destructive. Returns {ok, action, items[]|entry|lease}. Use use_spatial_blackboard instead of set_relation when coordinating transient multi-agent collision alerts and mutex region leases.

Inputs: id, mode, limit, topic, +11 more.

wait_for_spatial_stateA
Read-onlyIdempotent

Poll and wait until an entity reaches a specific spatial condition (exists, active, confidence threshold, or enters region). Read-only polling tool. Default timeout: 10000ms, poll_interval: 500ms. On timeout returns {ok: false, timeout: true}. Returns {ok, condition_met:boolean, entity}. Use wait_for_spatial_state instead of query_entities when polling asynchronously for an entity state transition or region entry.

Inputs: condition (required), entity_id (required), project, region_id, +3 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelogโ€ฆ

    TDQS

    A4.2/5.0

    Scored across 15 tools

    Disambiguation4/5

    The descriptions aggressively disambiguate with explicit 'Use X instead of Y when...' guidance, which helps a lot. However, there are still three entity-writing paths (update_entity, record_outcome, ingest_observation) and three reading/export paths (query_entities, get_spatial_map, get_expected_view) whose boundaries require careful reading, so some residual confusion remains.

    Naming Consistency5/5

    All 15 tools use snake_case verb-first naming (update_entity, query_entities, manage_snapshot, create_evidence_pack, wait_for_spatial_state). Even the multi-word variants (link_to_goal, wait_for_spatial_state) follow a predictable verb_noun/verb_prep_noun convention.

    Tool Count5/5

    15 tools sits at the top of the well-scoped range and each tool maps to a distinct capability (authoring, perception, querying, simulation, snapshots, coordination, verification, automation). For a spatial world-model server, this breadth is justified rather than padded.

    Completeness4/5

    The surface covers entity lifecycle (create/update, status-destroyed), relations, querying, export, simulation, perception ingest, snapshots, goal linking, blackboard coordination, spec verification, evidence packing, game inputs, and polling. Explicit deletion/region-management tools are absent, but the destroy-status pattern and region references mostly compensate.

    Maintenance

    ActivityNo data
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      A local-first MCP server that gives AI coding agents persistent memory and controlled commands. Features a git-backed markdown knowledge vault with FTS5 search, surgical section edits, token-aware context budgeting, and a sandboxed command engine with human approval gates. Works with Claude Code, Cursor, Copilot, Gemini, and more.
      62
      601 npm
      1
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      A local-first MCP server providing persistent, searchable knowledge base via SQLite, enabling AI agents to save and recall facts across sessions without cloud dependencies.
      MIT