Threadctx Mcp

io.github.threadctx-dev由 GitHub 账号 threadctx-dev 发布v0.5.0更新于 Oct 24, 2026

Shared memory MCP server for AI coding agents — local by default, team-shared via threadctx.dev.

已验证STDIO仅桌面知识与记忆开发者工具

概览

AI 生成的概览

为编码智能体提供共享记忆存储,使其能跨会话和团队成员保存并检索项目决策与经验教训。

可以做什么
Threadctx 提供 memory_write 和 memory_query 工具,让智能体记录不易察觉的修复、架构决策和经验,并在开始有风险或重复性工作前查询。本地模式把记忆保存在本机一个纯 JSON 文件中,按当前仓库限定范围并以关键词匹配。云端模式通过语义搜索在团队间共享记忆。capture 命令可用你自己的 LLM 提供商密钥把最近的 git 提交提炼成记忆。
适用场景
当多个智能体或团队成员在同一个仓库中工作,且你希望决策和经验在会话之间延续而不是被反复重新发现时,适合添加。本地模式适合不想注册、不依赖网络的单个开发者;云端模式适合需要一份共享记忆的团队。
运行要求
需要 Node.js 18 或更高版本,通过 npx 在本地运行。本地模式无需账号、密钥,除你自己的 LLM 提供商外无需网络。云端模式需要设置 THREADCTX_MODE=cloud 以及由 threadctx.dev 签发的 THREADCTX_API_KEY。可选的 capture 命令需要 THREADCTX_CAPTURE_ENABLED=1 以及你自己的 ANTHROPIC_API_KEY 或 OPENAI_API_KEY。
安装前请注意
首次在项目中启动时,服务器会自动写入或修改智能体规则文件,例如 AGENTS.md、CLAUDE.md 和 .cursor/rules/threadctx.mdc,并把指令注入 MCP initialize 握手;可用 THREADCTX_NO_AUTO_RULES=1 或 --no-rules 关闭。云端模式会把记忆发送到 threadctx.dev,且属于付费档位。capture 默认关闭,因为它会调用你的 LLM 提供商并计入你的密钥费用。请勿把 THREADCTX_API_KEY 写入提交的文件。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Threadctx Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

threadctx-mcp

[smithery badge]

Shared memory MCP server for AI coding agents. Works identically with Claude Code, Cursor, and any MCP client — same package, same config shape, no per-client integration work. On first start it also drops a "check team memory" instruction into whichever agents' rule files your repo uses (AGENTS.md, CLAUDE.md, Copilot, Windsurf, Cline, Gemini) so the memory actually gets read, not just exposed.

This repo runs on itself: its own AGENTS.md and CLAUDE.md were set up with npx threadctx-mcp init, the same command you'd run — check the git history if you want to see it happen.

Modes

  • Local (default, free, no signup): memory stored as a plain JSON file at ~/.threadctx/local.json — zero native dependencies, so npx threadctx-mcp installs instantly on any machine with Node 18+ (no compiler, no node-gyp step). No network calls except to whichever LLM provider your agent already uses. Matching is keyword-based, scoped to the current repo (detected via git remote). Run npx threadctx-mcp list any time to see exactly what your agents have stored.
  • Cloud (paid Team tier+): memory shared across everyone on the repo, with real semantic search. Requires an API key from threadctx.dev (or your own self-hosted deployment — see ../cloud/README.md).

Quick start

bash
# Local mode — nothing to configure. Also auto-adds the "check team memory"# instruction to your agents' rule files (AGENTS.md, CLAUDE.md, and any# detected tool-specific files) on first start.npx threadctx-mcp
# Set a repo up for your whole team (run once, commit the results)npx threadctx-mcp init
# Cloud mode — shared team memory via threadctx.devnpx threadctx-mcp init --mode=cloud --api-key=tctx_xxx
# Joining a repo a teammate already set up? One command:npx threadctx-mcp join
# See what your agents have written to this machinenpx threadctx-mcp list            # this reponpx threadctx-mcp list --all      # every repo

init writes three committable, secret-free files: .threadctx.json (just { "mode": ... }), .mcp.json (Claude Code project config), and .cursor/mcp.json (Cursor project config). Commit all three — every teammate who then opens the repo in Claude Code or Cursor is prompted to enable threadctx automatically, with nothing to install or configure. Teammates on other MCP clients run npx threadctx-mcp join, which sets up their machine the same way and prints the config block for their client.

Your API key never appears in any committed file. It is read from the THREADCTX_API_KEY environment variable at runtime (export it in your shell profile), so secrets stay out of version control by construction.

threadctx also adds a small, clearly-marked instruction to your project rules telling the agent to call memory_query before a task and memory_write after. It writes the two universal files every time — AGENTS.md (the cross-tool standard read by Copilot, Cursor, Windsurf, Zed, Codex, Aider, and ~24 others) and CLAUDE.md (Claude Code's richer native format) — plus .cursor/rules/threadctx.mdc. It then adds a tool-specific file only when that tool's footprint is detected in the repo, so it never litters your project with rule files for tools you don't use:

ToolFile writtenWritten when
Cross-tool standardAGENTS.mdalways
Claude CodeCLAUDE.mdalways
Cursor.cursor/rules/threadctx.mdcalways
GitHub Copilot.github/copilot-instructions.md.github/ exists
Windsurf.windsurf/rules/threadctx.md.windsurf/ exists
Cline.clinerules/threadctx.md.clinerules exists
Gemini CLIGEMINI.md.gemini/ exists

Shared files (AGENTS.md, CLAUDE.md, Copilot, Gemini) get a marker-fenced block spliced in, preserving your own content around it; dedicated files are owned in full. This happens automatically the first time the server starts in a project — you don't need to run init for it. Running init just triggers it explicitly and prints the result; either way it's idempotent (safe to re-run, never duplicates). Opt out entirely with THREADCTX_NO_AUTO_RULES=1, or per-init-call with --no-rules.

The same instruction is also sent as part of the MCP initialize handshake itself (the protocol's instructions field), so it reaches the model even before any rules file exists, and for clients that don't read project-rules files at all. The file-based rules are belt-and-suspenders on top of that, since not every MCP client is guaranteed to surface instructions prominently.

Claude Code setup

Add to your Claude Code MCP config (claude mcp add or edit ~/.claude/mcp.json directly):

json
{  "mcpServers": {    "threadctx": {      "command": "npx",      "args": ["-y", "threadctx-mcp"],      "env": {        "THREADCTX_MODE": "cloud",        "THREADCTX_API_KEY": "tctx_xxx"      }    }  }}

Cursor setup

Add the same block to .cursor/mcp.json in your project root (or via Cursor Settings → Tools & MCP):

json
{  "mcpServers": {    "threadctx": {      "command": "npx",      "args": ["-y", "threadctx-mcp"],      "env": {        "THREADCTX_MODE": "cloud",        "THREADCTX_API_KEY": "tctx_xxx"      }    }  }}

That's it — the same package and config work in both clients because MCP is a portable, open protocol.

Passive capture — turn git history into memory

Memory shouldn't depend on an agent remembering to call memory_write. threadctx capture reads the commits landed since its last run, uses your own LLM provider key to distill the genuinely reusable decisions and gotchas (skipping trivial commits), dedups them against what's already stored, and writes the survivors. It's tool-agnostic — it doesn't matter whether the work happened in Claude Code, Cursor, Copilot, or a plain editor.

bash
# Off by default because it calls an LLM (billed to your provider). Enable it:export THREADCTX_CAPTURE_ENABLED=1export ANTHROPIC_API_KEY=sk-...     # or OPENAI_API_KEY
npx threadctx-mcp capture --dry-run     # preview what it would storenpx threadctx-mcp capture               # store them (incremental since last run)npx threadctx-mcp capture --since=v1.2.0 --diffs   # a range, with patches
# Scaffold a GitHub Action that captures every merged PR automatically:npx threadctx-mcp capture --print-workflow > .github/workflows/threadctx-capture.yml

Capture calls your LLM provider directly — nothing is routed through threadctx's servers, so local mode keeps its "no network call beyond your own LLM provider" promise. It is off unless THREADCTX_CAPTURE_ENABLED=1 (or a one-off --force), so it can never run up token cost as a side effect.

Environment variables

VariableRequiredDescription
THREADCTX_MODEnolocal (default) or cloud
THREADCTX_API_KEYonly in cloud modeissued via cloud/scripts/create-tenant.ts
THREADCTX_API_URLnodefaults to https://threadctx.dev/api/v1; override for self-hosting
THREADCTX_REPOnooverrides repo auto-detection from git remote
THREADCTX_DB_PATHnolocal-mode store path; defaults to ~/.threadctx/local.json
THREADCTX_NO_AUTO_RULESnoset to 1 to disable auto-injecting agent rule files on server start
THREADCTX_CAPTURE_ENABLEDfor captureset to 1 to enable the LLM-backed capture command (off by default)
THREADCTX_CAPTURE_PROVIDERnoforce anthropic or openai when both keys are present
THREADCTX_CAPTURE_MODELnooverride the extraction model (defaults: Haiku / gpt-4o-mini)
ANTHROPIC_API_KEY / OPENAI_API_KEYfor captureyour own provider key; capture calls it directly

Local development

bash
npm installnpm run dev     # runs the server via tsx, watches for changesnpm run build   # compiles to dist/ for publishing

How the tools work

  • memory_write(content, tags?) — the agent calls this after resolving a non-obvious bug, making an architectural decision, or learning something worth remembering.
  • memory_query(task_description, max_results?) — the agent calls this before starting risky or repeated work. Results are returned with a consistent attribution footer (· via threadctx — shared team memory (N hits)) so the same string is recognizable whether you're reading Claude Code's terminal output or Cursor's agent panel.

Tool descriptions are written to bias the model toward calling memory_query proactively, and — as of 0.3.0 — the server reinforces this two more ways with zero setup required: the MCP initialize response carries the same instruction to every connecting client, and CLAUDE.md / .cursor/rules/threadctx.mdc get it auto-injected on first start. MCP tools are still fundamentally pull-based (no mechanism can force a tool call), but these three layers together are the strongest guarantee we can build.

CLI subcommands

CommandWhat it does
npx threadctx-mcpRuns the MCP server (this is what Claude Code / Cursor launch). Auto-injects project rules on first start in a project.
npx threadctx-mcp init [--mode=cloud --api-key=…] [--no-rules]Sets a repo up for the team: writes .threadctx.json, committable Claude Code/Cursor project MCP configs, and the project-rules files.
npx threadctx-mcp joinJoins a repo a teammate already set up: project MCP configs, rules, and per-client instructions.
npx threadctx-mcp list [--all] [--full] [--json]Shows what's stored in the local on-disk memory.
npx threadctx-mcp capture [--dry-run] [--since=<ref>] [--max=N] [--diffs] [--model=ID] [--print-workflow]Distills recent git history into memories via your own LLM key. Off unless THREADCTX_CAPTURE_ENABLED=1 (or --force).

Browse, search, edit, and prune team (cloud) memory in a human dashboard at threadctx.dev/dashboard — sign in with your team API key.

来源:README.md,提交 1a8fb01

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.5.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分