2026-07-05

Give your LangGraph agents shared team memory in 5 minutes

threadctx is a standard MCP server, and LangGraph agents talk to MCP servers through LangChain's own langchain-mcp-adapters package. That means there's no threadctx-specific LangGraph plugin to install or maintain — the same config that works in Claude Code and Cursor works here too.

1. Install

shell
pip install langchain-mcp-adapters
# threadctx itself needs no separate install — "npx" below fetches
# and runs it on demand, the same way it does for Claude Code and Cursor.

2. Connect threadctx as an MCP server

agent.py
from langchain_mcp_adapters.client import MultiServerMCPClient

client = MultiServerMCPClient({
    "threadctx": {
        "command": "npx",
        "args": ["-y", "threadctx-mcp"],
        "transport": "stdio",
        # Omit "env" entirely for local mode — a free, on-disk store,
        # no signup. Add it back once you're ready to share across a team:
        # "env": {"THREADCTX_MODE": "cloud", "THREADCTX_API_KEY": "tctx_..."},
    }
})

tools = await client.get_tools()

3. Bind the tools to your agent

tools now includes memory_write(content, tags?) and memory_query(task_description, max_results?) alongside whatever tools your graph already has — bind them the same way.

agent.py
from langgraph.prebuilt import create_react_agent

agent = create_react_agent(
    model="anthropic:claude-sonnet-5",
    tools=tools,  # includes memory_write + memory_query alongside your own tools
    prompt=(
        "Before starting risky or repeated work, call memory_query to check "
        "what the team already knows. After resolving something non-obvious, "
        "call memory_write so the next agent doesn't redo the work."
    ),
)

That's it

Local mode is free and stores memory on disk — good for trying it out solo. Switch to Team mode (set THREADCTX_MODE=cloud with an API key) the moment a second teammate's agent — LangGraph, Claude Code, or Cursor — needs to see the same memory. See the full LangChain & LangGraph overview for more on why MCP is the connector LangChain built for exactly this.

Give your team a shared memory.

Free and local for solo use. Team plans start at $11/seat/month when the memory needs to be shared.