context-firewall
A local MCP server that acts as a policy-based firewall for personal context, letting users control agent access to their data with deny-by-default rules, per-field grants, and an audit trail.
README
context-firewall
A local MCP server that answers agents' questions about you — through a policy.
Share your allergies with the restaurant-booking agent. Refuse your salary to everyone by default. Every request logged, every grant revocable, nothing in the cloud.
npx context-firewall init
npx context-firewall enroll "claude-code"
# paste the printed token into claude-code's MCP config env — see docs/clients/claude-code.md
npx context-firewall serve
See it work without any client at all:
git clone https://github.com/ketriumlabs/context-firewall.git && cd context-firewall
pnpm install && pnpm build
node examples/demo/restaurant-agent.mjs
That script is the whole pitch in ~30 lines of console output: an agent asks for allergies, gets refused until a human approves a single-use grant, reads it once, gets refused again on the second attempt (grant consumed), then asks for salary and is refused throughout — no scenario in the demo ever grants that. Self-verifying — it exits non-zero if the behavior ever drifts from this description.
Why
Portable AI-context projects (open-context, personal-context-manager,
Stanford Digital Economy Lab's Human Context Protocol work) are converging
on "give agents a file about you" — but none of them do field-level
privacy. This does: a deny-by-default policy engine between your context
and every agent that asks about it, so "share diet preferences" and
"share salary" are two different, separately-revocable decisions, not one
all-or-nothing file handoff.
The two files
context.yaml— your data, namespaced (identity,preferences,health,finance, ...). Human-editable, diffable, safe to back up in a private git repo.policy.yaml— who gets what. Per-client, per-field grants with expiry (once/ a TTL date /never).catit any time to see exactly who can see what.
Neither file is a database. Both are plain YAML you can read yourself —
full field reference in docs/format.md, with editor
autocomplete via the published JSON Schemas in schemas/.
Threat model — read this before trusting it
See docs/threat-model.md. Short version: this is
a consent and organization tool, not a sandbox. It does not protect
against local malware with filesystem access, a client that lies about
its own identity (a bearer token, not a cryptographic proof, is what
establishes identity in v0.1), or — yet — data at rest without your OS's
own disk encryption. It does give you a real audit trail, revocable
per-field grants, and policy files you can read yourself instead of
trusting a vendor's opaque memory feature.
Importing existing memory
context-firewall import chatgpt path/to/export.json
context-firewall import claude path/to/memory-export.json
Both write a *-imported-draft.yaml file — extracted text snippets under
an imported namespace with instructions to sort them into real
namespaces by hand. Deliberately not "smart": guessing that a memory
string is health vs. finance and getting it wrong silently would be
worse than not guessing.
CLI reference
| Command | What |
|---|---|
init |
Create context.yaml + policy.yaml |
enroll <name> |
Register an MCP client, print its one-time token |
serve |
Start the MCP server (reads CONTEXT_FIREWALL_TOKEN from env) |
status |
Show pending requests and current grants |
approve <id> [--once | --ttl-days N] |
Approve a pending request |
deny <id> |
Deny a pending request (remembered — never re-asked) |
import <chatgpt|claude> <file> |
Draft context.yaml from an export |
All commands accept --dir <path> to use a data directory other than
~/.context-firewall.
Citations
Namespace layout and field taxonomy adapted from the Stanford Digital
Economy Lab's Human Context Protocol work and the open-context project's
field categories — see docs/format.md for the mapping.
This project doesn't invent a new standard; if one of these converges into
something real, context-firewall converges with it.
Roadmap
See docs/roadmap.md — OS-keychain encryption at rest
is the tracked v0.2 flagship.
Contributing
See CONTRIBUTING.md. Policy/consent changes get extra scrutiny — see SECURITY.md.
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。