Skip to content

Connecting a host

The MCP server speaks the standard Model Context Protocol over stdio, so any compliant host can launch it as a subprocess. You can also embed the same VerifiableMemory adapter directly in Python.

Terminal window
pip install "hypermesh[mcp,engine,analytics]"

Confirm it runs:

Terminal window
python -m hypermesh_mcp # starts the stdio server; Ctrl-C to stop

Add the server to your claude_desktop_config.json (mcpServers block):

{
"mcpServers": {
"hypermesh-memory": {
"command": "python",
"args": ["-m", "hypermesh_mcp"],
"env": {
"HMDB_DIR": "/absolute/path/to/your/memory-db",
"HM_MCP_TABLE": "MEMORY"
}
}
}
}

Restart Claude; the six tools (remember, recall, reason, prove, verify, detect) appear as available tools.

Add an entry to your MCP config (~/.cursor/mcp.json or the project’s .cursor/mcp.json):

{
"mcpServers": {
"hypermesh-memory": {
"command": "hypermesh-mcp",
"env": { "HMDB_DIR": "/absolute/path/to/your/memory-db" }
}
}
}

hypermesh-mcp is the console script installed with the mcp extra; it is equivalent to python -m hypermesh_mcp.

Spawn the server over stdio with the MCP SDK and call the tools:

import asyncio
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
params = StdioServerParameters(
command="python", args=["-m", "hypermesh_mcp"],
env={"HMDB_DIR": "/path/to/memory-db", "HM_MCP_TABLE": "MEMORY"},
)
async def main():
async with stdio_client(params) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
print([t.name for t in (await session.list_tools()).tools])
await session.call_tool("remember", {
"members": ["account:admin", "host:db01"], "formation": "LOGIN",
})
hits = await session.call_tool("recall", {"query": "admin", "top_k": 10})
print(hits.structuredContent)
asyncio.run(main())

If you’re building in Python, skip MCP entirely and use the adapter directly — identical semantics, no subprocess:

from hypermesh_mcp.memory import VerifiableMemory
with VerifiableMemory("/path/to/memory-db", table="MEMORY") as mem:
mem.remember(["drone:d1", "drone:d2"], weight=0.9, event_ts=1000)
print(mem.recall(node_ids=[mem.registry.resolve("drone:d1")]))
print(mem.reason()) # forward-chain over trusted rules
print(mem.prove(goal_pred="coordinated_threat"))
# gate a draft answer
draft = "The two drones converged into a coordinated threat [HEDGE-0]."
print(mem.verify(draft))

Reasoning fires the rules in the curated RuleStore — agents cannot write them through MCP (that’s the trust boundary). Rules are range-restricted Horn clauses authored as JSON; see the Neuro-Symbolic RAG rules reference for the full rule schema. A minimal example:

from hypermeshdb.rag import RuleStore
RuleStore("/path/to/memory-db").upsert({
"id": "rule:coordinated_threat",
"name": "Coordinated drone threat",
"enabled": True,
"if": [
{"pred": "formation", "args": ["?E", "DRONE_EVENT"]},
{"pred": "weight", "args": ["?E", "?W"]},
{"compare": ["?W", ">=", 0.8]},
],
"then": {"pred": "coordinated_threat", "args": ["?E"], "confidence": 0.9},
})

Once a rule is enabled, reason/prove/verify will fire it over any remembered edges whose inferred formation and weight match.

  • Determinismrecall, reason, prove, and verify are deterministic and LLM-free; the same memory + rules produce the same output.
  • Persistence — memory and the entity name↔id registry live under HMDB_DIR and persist across runs.
  • Shutdown — the server flushes the entity registry and closes the engine on exit; in-process callers should use the context manager or call mem.close().