ctxfile

ctxfile

A local-first MCP server that snapshots project working state into a structured context object, enabling agents to share and resume sessions seamlessly without leaving your machine.

Category
访问服务器

README

<p align="center"> <img src="apps/web/public/brand/logo-mark-256.png" alt="ctxfile" width="96" height="96" /> </p>

<h1 align="center">ctxfile</h1>

<p align="center"><strong>One context, every agent, all local.</strong></p>

<p align="center"> <a href="https://github.com/ctxfile/ctxfile/actions/workflows/ci.yml"><img src="https://github.com/ctxfile/ctxfile/actions/workflows/ci.yml/badge.svg" alt="CI" /></a> <a href="https://www.npmjs.com/package/ctxfile"><img src="https://img.shields.io/npm/v/ctxfile" alt="npm" /></a> <a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue" alt="Apache-2.0" /></a> <a href="https://modelcontextprotocol.io"><img src="https://img.shields.io/badge/MCP-2025--11--25-black" alt="MCP" /></a> <a href="https://github.com/ctxfile/ctxfile/stargazers"><img src="https://img.shields.io/github/stars/ctxfile/ctxfile?style=social" alt="GitHub stars" /></a> </p>

<p align="center"> <a href="https://ctxfile.dev">Website</a> · <a href="https://ctxfile.dev/docs">Docs</a> · <a href="#30-second-quickstart">Quickstart</a> · <a href="https://ctxfile.dev/convention">The .ctxfile convention</a> · <a href="https://ctxfile.dev/security">Security</a> </p>


You work with more than one AI agent. Claude Code in the terminal, Cursor in the editor, a chat tab for thinking. Each one starts cold, because your working state (the plan, the key files, the git state, what you decided an hour ago) lives in your head and in scrollback.

ctxfile is a local-first MCP server that snapshots your project's working state into one structured context object, and hands it to any MCP agent in a single call. Save a session in one agent, continue it in another. Nothing leaves your machine.

you → ctxfile → the same context, in every agent

30-second quickstart

Claude Code

claude mcp add ctxfile -- npx -y ctxfile

Cursor (.cursor/mcp.json in your project, or ~/.cursor/mcp.json globally)

{
  "mcpServers": {
    "ctxfile": { "command": "npx", "args": ["-y", "ctxfile"] }
  }
}

Claude Desktop: download ctxfile.mcpb from releases and drag it into Settings → Extensions.

Any other MCP client: it is a standard stdio server. npx -y ctxfile is the whole command.

Then, in your agent: "load my context" (or call get_context). Requires Node ≥ 20 (≥ 22 on Windows).

Private by default

This is the part we care about most, so it goes first:

  • The default path makes zero network calls. Files and git only.
  • Secret-looking content (cloud keys, tokens, private keys, JWTs, password= assignments) is redacted before it enters the snapshot. .env*, key files, and credential files are never read at all.
  • Core is read-only over your project. It never writes to your repo, your git state, or anything else.
  • No telemetry by default. An anonymous weekly install ping exists, and it is opt-in only.
  • Network connectors (Notion, local Ollama summarization, Sync) activate only when you explicitly configure them.

The full model, including what Pro and Sync add and what they can never see, is documented at ctxfile.dev/security.

What it does

Snapshot get_context returns one structured ContextObject: plan docs, ranked key files fitted to a token budget, git state, optional Notion pages and local-LLM summary.
Save and resume save_session stores an agent-written summary of the current conversation. continue_thread hands the merged, provenance-labeled history to the next agent. Different harness, different provider, cold start: it picks up where you left off.
Threads Durable identities for a piece of work ("Q3 campaign"), spanning agents and machines. handoff: true enforces a complete takeover package: state, decisions with rationale, ordered open items, gotchas.
Universal ingest ingest_context is the schema-enforced door for any harness without a native parser. The prompt is the adapter, so every MCP-speaking agent is supported, including ones that do not exist yet.
Cloud agents ctxfile export writes a static, repo-safe artifact for agents that never touch your machine (hosted coding agents, CI). The format is an open spec: the .ctxfile convention.
Dashboard ctxfile ui: a local cockpit on 127.0.0.1. Run snapshots, watch connectors, browse context, inspect git state.
Sync (optional) An end-to-end encrypted vault through a relay you can self-host. Argon2id key derivation, XChaCha20-Poly1305 per blob. The relay stores ciphertext only.

The monorepo

Package What License
packages/core ctxfile on npm: the MCP server, snapshot engine, threads, ingest, export, Sync client, dashboard host Apache-2.0
packages/relay @ctxfile/relay on npm: the self-hostable Sync relay and team hub (encrypted vaults, /mcp endpoint, federation, audit log). One Docker image Apache-2.0
packages/dashboard + packages/ui-kit The local instrument UI served by ctxfile ui Apache-2.0
apps/web ctxfile.dev: site and docs Apache-2.0

Open core, honestly

Everything in this repo is Apache-2.0 and works standalone, forever. The paid Pro add-on (a separate, closed package) adds session connectors that read your recent sessions from Claude Code, Cursor, Codex CLI, OpenCode, Gemini CLI, Aider, OpenClaw, and Hermes Agent, plus encrypted cross-session memory, multi-provider consult, and local voice capture. Licensing is an Ed25519-signed key verified offline. No phone-home, ever. Pro funds the open-source work.

Contributing

We want your issues, your PRs, and your weird harness reports. Start with CONTRIBUTING.md. Every ingested format, every MCP client quirk, every redaction gap you find makes the whole thing better.

  • Bugs and features: issues
  • Questions and show-and-tell: discussions
  • Security reports: SECURITY.md (please do not open public issues for vulnerabilities)
git clone https://github.com/ctxfile/ctxfile.git && cd ctxfile
npm install
npm run build && npm test    # the whole gate: lint, typecheck, tests

Star history

If ctxfile saves you a cold start, a star is how other people find it.

<a href="https://star-history.com/#ctxfile/ctxfile&Date"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=ctxfile/ctxfile&type=Date&theme=dark" /> <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=ctxfile/ctxfile&type=Date" /> <img alt="Star history chart" src="https://api.star-history.com/svg?repos=ctxfile/ctxfile&type=Date" /> </picture> </a>

License

Apache-2.0. "ctxfile" and the ctxfile logo are trademarks of ctxfile; the license covers the code, not the name.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选