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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.