# Yagami AI Context Firewall

> Yagami AI Context Firewall is an open-source MCP server for knowledge and memory. Open-source gateway that routes AI requests by privacy policy and governs tool access. It runs as a hosted remote server, so there is nothing to install locally.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** self-hosted, CLI, API
- **Website:** https://matthewtracy.github.io/yagami/
- **Repository:** https://github.com/matthewtracy/yagami
- **MCP Registry name:** io.github.MatthewTracy/yagami
- **Categories:** knowledge and memory, security, AI models and LLM tooling
- **Listing updated:** 2026-11-14

## About

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.

## Features

- **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

## Install

### Claude Code (Terminal)

```sh
claude mcp add yagami -- uvx yagami
```

### Claude Desktop (claude_desktop_config.json)

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

### Cursor (~/.cursor/mcp.json)

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

### VS Code (.vscode/mcp.json)

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

### Windsurf (~/.codeium/windsurf/mcp_config.json)

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

### Other clients (your client's MCP settings (most use this shape))

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

## 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

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Nautilus Compass Memory](https://ai-powered.com/mcp/nautilus-compass-memory): Nautilus Compass Memory is an open-source MCP server for knowledge and memory.
- [Agent Roast](https://ai-powered.com/mcp/agent-roast): Agent Roast is an open-source MCP server for developer tools.
- [Midplane](https://ai-powered.com/mcp/midplane): Midplane is an open-source MCP server for databases.
- [Leash](https://ai-powered.com/mcp/leash): Leash is a free MCP server for security.

---
Source: https://ai-powered.com/mcp/yagami-ai-context-firewall
