worldmodel-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@worldmodel-mcpcreate a world for my project with a tasks table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
worldmodel-mcp
An external world model for LLM agents: a validated state database that lives
outside the context window, exposed as an MCP server and a standalone wm CLI.
Why
Apple's The Illusion of Thinking shows reasoning models collapsing on compositional tasks (Tower of Hanoi fails around 8 disks) — even when handed the explicit algorithm. The failure pattern points at execution fidelity, not insight: a transformer cannot reliably maintain exact state across hundreds of steps of its own token stream, and one silent tracking error compounds forever.
This tool changes the model's job. Instead of being the state-keeper, the executor, and the policy all at once, the model keeps only the part it's good at (judgment, decomposition, interpretation) and delegates the rest:
Paper failure mode | Tool answer |
State drift over long horizons | State lives in SQLite tables; the model queries only the working set it needs per step ( |
Silent, compounding errors | Every mutation is a transaction checked against declared invariants; illegal transitions are rejected with the broken rule named ( |
Can't execute known algorithms | Register the algorithm once and let the tool run it — a thousand exact, validated steps for zero tokens ( |
Can't backtrack cleanly | Snapshots and branches; abandoning a branch truly forgets it ( |
Work lost to context limits | The world outlives the window; |
What it does not fix: choosing the right next action is still the model. This moves the collapse threshold out substantially; it does not remove it.
Related MCP server: Neotoma
Acceptance test
Straight from the paper: 12-disk Tower of Hanoi (unaided models collapse ~8).
Through the world model: schema + 2 invariants + a 12-line recursive procedure →
4095 moves, every one invariant-checked, in 0.26 s, final state verified by
query. See src/core.test.ts ("Tower of Hanoi") for the runnable version.
Documentation
AGENTS.md — the agent operating manual. If you are an LLM agent (or configuring one), start there: when to reach for a world, the five habits, recipes, the procedure contract, how to write good invariants, gotchas.
Over MCP the same manual is available without reading files: call the
guidetool (topic:all|quickstart|recipes|procedures), or read theworldmodel://guide/worldmodel://readmeresources. The server also sends a summary as MCP instructions at connection time, so a client model knows what this is before calling anything.wm helpdocuments every CLI command.
Install
npm install
npm run build
npm testOptionally npm link to get wm and worldmodel-mcp on your PATH.
Register as an MCP server (Claude Code)
claude mcp add worldmodel -- node /path/to/worldmodel-mcp/dist/server.jsWorlds are stored under ~/.worldmodel/ (override with WORLDMODEL_DIR).
Model of operation
A world = one problem domain (a puzzle, an investigation, a migration plan). Each world has:
Tables — ordinary SQLite tables you define; one fact per row.
Invariants — named SELECTs that return violating rows (empty = healthy). Checked inside every action's transaction; violations roll the action back.
Actions — named, logged, transactional mutations (
apply_action, or theassert_facts/retract_factsconveniences).Procedures — deterministic JS function bodies
(query, act, log, args, lib)run in anode:vmsandbox with step/time budgets; eachact()is a full validated transition, and a pre-run snapshot makes any run onerestorefrom undone. (The sandbox is an isolation convenience, not a security boundary — procedures run with local trust, same as the agent's shell access.)lib.search— generic BFS/DFS over in-memory states:lib.search({start, moves, goal, key?, mode?, maxNodes?})returns{found, path, finalState, nodesExpanded}. The intended pattern is plan in memory, execute validated: search over lightweight state objects (no DB copies per node), then replay the winning path viaact()so every real step is still invariant-checked. See the river-crossing test — the paper's other benchmark family — solved this way insrc/core.test.ts.Templates —
create_worldwithtemplate: "facts"scaffolds an evidence ledger for investigations:facts(entity, attribute, value, source, confidence, status, superseded_by, ...)plus invariants that force contradictions to be resolved explicitly (supersede or markdisputed) instead of letting incompatible beliefs silently coexist.Branches & snapshots — cheap file-level copies (
VACUUM INTO) for exploration and undo.Event log — every schema change, action, and procedure run, queryable via
history.
CLI quickstart
wm create hanoi "Tower of Hanoi"
wm schema hanoi "CREATE TABLE disks (disk INTEGER PRIMARY KEY, peg TEXT NOT NULL, height INTEGER NOT NULL, UNIQUE (peg, height))"
wm invariant hanoi no-disk-on-smaller "No disk on a smaller disk" \
"SELECT u.disk, l.disk FROM disks u JOIN disks l ON u.peg = l.peg AND u.height = l.height + 1 WHERE u.disk > l.disk"
wm assert hanoi disks '[{"disk":1,"peg":"A","height":3},{"disk":2,"peg":"A","height":2},{"disk":3,"peg":"A","height":1}]'
wm act hanoi move "UPDATE disks SET peg=@dst, height=COALESCE((SELECT MAX(height) FROM disks WHERE peg=@dst),0)+1 WHERE disk=(SELECT disk FROM disks WHERE peg=@src ORDER BY height DESC LIMIT 1)" '{"src":"A","dst":"B"}'
wm query hanoi "SELECT * FROM disks ORDER BY peg, height"
wm check hanoiwm help lists everything; long SQL/code args accept - for stdin;
wm serve runs the MCP server.
MCP tools
list_worlds · create_world · describe_world · define_schema ·
define_invariant · drop_invariant · apply_action · assert_facts ·
retract_facts · query · check_invariants · snapshot ·
restore_snapshot · branch · checkout · history ·
define_procedure · run_procedure
Agent usage discipline
The tool only helps if state is routed through it. The intended habit, for any task with evolving state plus rules:
create_world,define_schema, and encode the domain rules as invariants first — rules in the database, not in your head.Mutate only via actions; treat a rejection as information, not failure.
Query the working set per step; never re-derive state from the transcript.
The moment you know the algorithm, write a procedure instead of narrating steps.
Snapshot before anything exploratory; branch to compare alternatives.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityDmaintenanceProvides state and log management tools designed for long-lived AI agents that may be interrupted and resumed. It enables tracking agent progress and maintaining an append-only event history to ensure continuity across multiple sessions.Last updated4MIT
- AlicenseCqualityAmaintenanceDeterministic state layer for AI agents that stores versioned entities such as contacts, tasks, transactions, and decisions with immutable observations and full provenance. Local-first SQLite memory shared across Claude, Cursor, ChatGPT, Codex, and OpenClaw via MCP and native plugins.Last updated6017627MIT
- Alicense-qualityCmaintenanceEnables AI coding agents to execute formal, stateful workflows with typed contracts, postcondition enforcement, and structured retry logic.Last updated1Apache 2.0
- AlicenseAqualityCmaintenanceProvides AI agents with a lightweight task-management and self-verification layer to define goals, track checkpoints, detect scope drift, and verify completion against explicit done criteria.Last updated12MIT
Related MCP Connectors
Durable agent-to-agent handoffs and shared scratchpad for multi-agent workflows.
Persistent memory and knowledge graphs for AI agents. Hybrid search, context checkpoints, and more.
Sovereign Agent OS — Persistent Memory, Governance & Compliance for AI Agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/CocoaBeans/worldmodel-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server