Skip to content

MCP Server

Terminal window
git clone https://github.com/nosqltips/AgentStateGraph.git
cd AgentStateGraph
cargo build --release -p agentstategraph-mcp
cargo run --release -p agentstategraph-mcp
# Creates ./stategraph.db, listens on stdio

Add to ~/.claude.json or your project’s .mcp.json:

{
"mcpServers": {
"stategraph": {
"command": "/path/to/AgentStateGraph/target/release/agentstategraph-mcp"
}
}
}

Or run from source:

{
"mcpServers": {
"stategraph": {
"command": "cargo",
"args": ["run", "--release", "-p", "agentstategraph-mcp", "--manifest-path", "/path/to/AgentStateGraph/Cargo.toml"]
}
}
}

Restart Claude Code. The 20 AgentStateGraph tools appear automatically.

Any MCP client that supports stdio transport works. Point it at the agentstategraph-mcp binary.

The server creates stategraph.db in the current working directory. To change the path, set the working directory when launching the binary.

ToolDescription
stategraph_getRead a value at any branch/path. Use / for entire state.
stategraph_setWrite a value with intent metadata (category, description, reasoning, confidence).
stategraph_deleteRemove a value, creating a commit with intent.
ToolDescription
stategraph_branchCreate a branch from any ref. Supports namespaced names.
stategraph_list_branchesList all branches, optionally filtered by namespace prefix.
stategraph_mergeSchema-aware three-way merge. Returns conflicts if auto-resolution fails.
stategraph_diffStructured typed diff between two refs (not text diffs).
ToolDescription
stategraph_speculateCreate a lightweight O(1) speculation from a ref.
stategraph_spec_modifyApply set/delete operations within a speculation.
stategraph_compareCompare multiple speculations side-by-side.
stategraph_commit_specPromote a speculation to a real commit on its base branch.
stategraph_discardDiscard a speculation. All changes freed immediately.
ToolDescription
stategraph_logCommit history with full intent, reasoning, and metadata.
stategraph_queryComposable filters: agent, category, tags, reasoning text, confidence range.
stategraph_blameFind which commit last modified a path and why.
ToolDescription
stategraph_create_epochCreate an epoch to group related work.
stategraph_seal_epochSeal an epoch (immutable, tamper-evident). Cannot be undone.
stategraph_list_epochsList all epochs with status, dates, and commit counts.
ToolDescription
stategraph_sessionsList active agent sessions with parent-child relationships.
You: Store the cluster config under /cluster
Agent: [calls stategraph_set with path="/cluster/name", value="prod", ...]
You: Try two network approaches and compare them
Agent: [calls stategraph_speculate twice, stategraph_spec_modify on each,
stategraph_compare to diff them, stategraph_commit_spec on winner]
You: Who changed the network config and why?
Agent: [calls stategraph_blame with path="/cluster/network"]

See the full MCP Tools Reference for parameters and example payloads.