SuperAPIAI Directory

threadctx-mcp

github.com · AI agents

Local-first shared team memory for coding agents: decisions, fixes and gotchas persist per repo and are shared across teammates' agents.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)

About this tool

threadctx-mcp is a shared-memory MCP server for AI coding agents, and it works the same way in Claude Code, Cursor, and any MCP-capable client—the same package, the same configuration structure, with no extra integration needed per client. It solves the problem of "memory not being shared" when teams use coding agents: a tricky bug that one agent solved, an architectural decision that was made, or a pitfall that was hit can be read and reused by other members' agents under the same repository.

Main capabilities

  • Local-first, free by default: Memory is stored as ordinary JSON files in ~/.threadctx/local.json, with no native dependencies, and under Node 18+ it can be installed with npx threadctx-mcp , with no compiler or node-gyp step. Other than the LLM provider used by the agent itself, no network requests are made.
  • Repository-level scope: Memory matching is keyword-based, and the scope is identified as the current repository via the git remote. You can run npx threadctx-mcp list at any time to view what the agent has stored.
  • Consistent across clients: The same configuration can be used for both Claude Code and Cursor, because MCP is an open and portable protocol.
  • Automatic rule injection: On first startup, it writes an instruction to "check team memory" into the agent rule files used by the repository, covering AGENTS.md, CLAUDE.md, Copilot, Windsurf, Cline, Gemini, and others, so that memory is actually read, not merely exposed.

How to use

  1. Initialize: Run npx threadctx-mcp init. This command writes three files that can be committed and contain no secrets:.threadctx.json(whose content is only { "mode": ... })、.mcp.json(Claude Code project configuration) and .cursor/mcp.json(Cursor project configuration). After committing these three files, any teammate who opens the repository in Claude Code or Cursor will be automatically prompted to enable threadctx, with no installation or configuration needed. Teammates using other MCP clients can run npx threadctx-mcp join to complete local configuration, and it prints the configuration block required by their client.
  2. Configure MCP: Add the configuration block in the Claude Code MCP configuration (claude mcp add or directly edit ~/.claude/mcp.json); in the project root's .cursor/mcp.json(or via Cursor Settings → Tools & MCP) add the same configuration block.
  3. Tool calls:memory_write(content, tags?) is called by the agent after solving a non-obvious problem, making an architectural decision, or learning something worth recording;memory_query(task_description, max_results?) is called by the agent before starting risky or repetitive work. Query results have a unified signature footer ( · via threadctx — shared team memory (N hits)), making them easy to identify in the Claude Code terminal or the Cursor agent panel.
  4. Passive capture:threadctx capture reads commits that landed since the last run, uses your own LLM provider key to distill truly reusable decisions and pitfalls (skipping trivial commits), and writes them after deduplicating against stored memory. This feature is tool-agnostic and does not care whether the work was done in Claude Code, Cursor, Copilot, or an ordinary editor. Capture calls your LLM provider directly and does not go through the threadctx server, so local mode still keeps the promise of "no network calls other than your own LLM provider." It is off by default, and only runs if THREADCTX_CAPTURE_ENABLED=1 is set or the one-time --force is used, avoiding unexpected token costs.

Rule injection mechanism

threadctx writes a clearly marked instruction into the project rules, requiring the agent to call memory_query before a task and memory_write after a task. Each time, it writes two general files:AGENTS.md(a cross-tool standard read by about 24 tools including Copilot, Cursor, Windsurf, Zed, Codex, Aider, etc.) and CLAUDE.md(Claude Code's native format), as well as .cursor/rules/threadctx.mdc. Tool-specific files are only added when traces of that tool's usage are detected in the repository, avoiding piling up rule files for unused tools. Shared files (AGENTS.md, CLAUDE.md, Copilot, Gemini) are concatenated in marked fenced blocks, preserving your own content; tool-specific files are entirely owned by threadctx. This process happens automatically when the server first starts in a project, with no need to run init; running init merely triggers it explicitly and prints the result. Both approaches are idempotent, safe to run repeatedly, and will not generate duplicates. You can completely opt out via THREADCTX_NO_AUTO_RULES=1 , or on a single init call use --no-rules.

The same instructions are also sent as part of the MCP initialize handshake (the protocol instructions field), so even if no rule file exists yet, or the client does not read project rule files at all, the instructions can still reach the model. File-based rules are a double safeguard on top of this, because not all MCP clients prominently display instructions.

Cloud Mode and Team Sharing

Cloud (paid Team tier and above) supports sharing memories among all members of a repository and provides true semantic search. It requires an API key from threadctx.dev, or use a self-hosted deployment. The API key does not appear in any committed file, but is read at runtime from the THREADCTX_API_KEY environment variable (exported in your shell profile), guaranteeing by construction that the key does not enter version control. You can log in at threadctx.dev/dashboard with a team API key to browse, search, edit, and clean up team (cloud) memories through a human-readable dashboard.

Applicable Scenarios and Limitations

It is suitable for repositories with multi-person collaboration where team members each use coding agents such as Claude Code and Cursor, and want to distill the experience of individual agents into shared team memory. In terms of limitations: local mode uses keyword matching rather than semantic search, and semantic search is only available in the paid cloud tier; MCP tools are inherently pull-based, and there is no mechanism to force an agent to call a tool; threadctx tries to increase the probability of invocation through three layers—tool descriptions, initialize instructions, and rule files—but still cannot guarantee it; passive capture is off by default and must be explicitly enabled; the specific pricing of cloud mode and self-hosting details are not yet provided in the materials.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools