Skip to content
MCP server

Yagami AI Context Firewall

Open-source gateway that routes AI requests by privacy policy and governs tool access

Install
Pricing
Open source
Platforms
self-hosted, CLI, API
Runs
Remotely
Version
0.8.6
Listing updated
3 days ago

About Yagami AI Context Firewall

Yagami AI Context Firewall is an open-source MCP server for knowledge and memory. It runs as a hosted remote server, so there is nothing to install locally.

The default rule is strict: once context is labelled phi, phi_medical or secret, it is forced to a local backend. Callers can declare a sensitivity of none, phi, phi_medical or secret, and a hint can make the policy stricter but cannot lower what Yagami detects. Each decision comes with a policy passport listing the policy version and hash, matched rules, lineage, transformations and approval evidence, without copying raw prompt content into the audit record.

Applications connect by changing one OpenAI client base_url to the local gateway and using the model name yagami-auto. Beyond routing between local and cloud models, it governs retrieval, memory and tool use, and can require an identity-bound, one-time approval before a dangerous tool call. Examples cover the OpenAI SDK, CrewAI, AutoGen, LangGraph, LiteLLM and others.

A demo starts with uvx yagami demo, using an Ollama model if one is installed. The project says plainly that it is an enforcement component, not a compliance certification, and that detection can miss sensitive data.

Install

Run in a terminal

claude mcp add yagami -- uvx yagami

Add to claude_desktop_config.json

{
  "mcpServers": {
    "yagami": {
      "command": "uvx",
      "args": [
        "yagami"
      ]
    }
  }
}
Install in CursorOpens Cursor, which asks you to confirm. Or add it by hand:

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "yagami": {
      "command": "uvx",
      "args": [
        "yagami"
      ]
    }
  }
}
Install in VS CodeOpens VS Code, which asks you to confirm. Or add it by hand:

Add to .vscode/mcp.json

{
  "servers": {
    "yagami": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "yagami"
      ]
    }
  }
}

Add to ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "yagami": {
      "command": "uvx",
      "args": [
        "yagami"
      ]
    }
  }
}

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "yagami": {
      "command": "uvx",
      "args": [
        "yagami"
      ]
    }
  }
}

Configuration

  • YAGAMI_HEADLESS
  • YAGAMI_MCP_SERVER_ENABLED
  • YAGAMI_REQUIRE_AUTH

What it does

Policy-based routing
Sends each request to a local or cloud model according to task and privacy policy.
Local-only for sensitive data
Context labelled phi, phi_medical or secret stays on a local backend by default.
OpenAI-compatible API
Existing SDK apps adopt it by changing the base_url.
Policy passports
Content-free evidence of each decision, including matched rules and lineage.
Tool approvals
One-time, identity-bound approval before risky tool calls.
Retrieval and memory control
Governs what context, memory and retrieval sources an agent may use.

Good for

  • Keep repository secrets on-device while a coding agent works
  • Stop sensitive patient text reaching cloud models
  • Require approval before an agent runs a dangerous tool
  • Cut cloud API spend by answering simple tasks locally
  • Audit where agent context went without storing the content

Pricing

Open source

Open source Python package; cloud model usage is billed by the providers you configure.

Prices change. Check matthewtracy.github.io before you buy.

Yagami AI Context Firewall FAQ

How do I try it?

Run uvx yagami demo, or pip install yagami then yagami demo; Docker is also supported. The demo needs no API key and disables cloud routing.

Is it a compliance product?

No. The docs say it is an enforcement component, not a compliance certification, and that detection can miss sensitive data.

Which frameworks have examples?

OpenAI SDK, OpenAI Agents, PydanticAI, CrewAI, AutoGen, Semantic Kernel, LiteLLM, LangGraph and Foundry Local.

Where does it run?

On your own machine or server; the registry package is the PyPI package yagami, serving MCP at 127.0.0.1:8000/mcp by default.

Is Yagami AI Context Firewall free?

Yes. Yagami AI Context Firewall is open source, so you can use and self-host it for free.

How do I add Yagami AI Context Firewall to Claude Code?

Run this command in your terminal: claude mcp add yagami -- uvx yagami

What are the best alternatives to Yagami AI Context Firewall?

The closest alternatives to Yagami AI Context Firewall are REA, Codebase Memory, XERJ, Claude Code Ultimate Guide and Nautilus Compass Memory.

Alternatives to Yagami AI Context Firewall

  1. REA

    MCP server

    CLI and MCP server that lets coding agents reverse engineer apps and binaries

    Runs locally
    • Open source
    • 464K GitHub stars
    • Developer tools
  2. Codebase Memory

    MCP server

    Local MCP server that builds a code knowledge graph for AI coding agents

    Runs locally
    • Open source
    • 48.7K GitHub stars
    • Knowledge and memory
  3. XERJ

    MCP server

    Local search engine for AI agents with cited answers over your code and docs

    Runs locally
    • Open source
    • 19.2K GitHub stars
    • Knowledge and memory
  4. MCP server for searching the Claude Code Ultimate Guide from any MCP client

    Runs locally
    • Open source
    • 6.5K GitHub stars
    • AI models and LLM tooling
  5. Local-first long-term memory layer for AI agents, served over MCP

    Not checked yet
    • 5 tools
    • Remote
    • Open source
    • 1.3K GitHub stars
    • Knowledge and memory
  6. Agent Roast

    MCP server

    Offline review that flags agent changes which weaken tests, assertions or CI

    Runs locally
    • Open source
    • 4 Hacker News points
    • Developer tools