Skip to content
MCP server

Ctxfw

Local firewall for coding agents: AST context pruning and prompt-injection screening

Runs locallyStatus and history
Install
Pricing
Open source
Platforms
CLI, self-hosted
Runs
Locally
Version
4.2.1
Listing updated
today

Similar MCP servers

About Ctxfw

Ctxfw is an open-source MCP server for security. It runs locally on your machine and is started by your AI client.

CTXFW sits between a coding agent and your repository and works locally over stdio with no network telemetry, according to its README. Its two main jobs are trimming context and screening it. An in-memory polyglot syntax-tree pruner replaces the files around the one you are editing with interface signatures and stubs while leaving the focal file untouched, and the README reports token reductions between about 24 and 78 percent across tested repositories such as Zulip, PostHog and Airflow.

The security side includes a prompt-injection defense it calls SARA, an intake check that rejects architecture briefs lacking required invariants and governance for MCP tool calls. It compares itself with cloud runtime firewalls by operating before context leaves the developer machine.

The core is installed from PyPI as ctxfw. The author also sells paid standalone source capsules and a bundle, so the project is open-core.

Install

Run in a terminal

claude mcp add ctxfw -- uvx ctxfw

Add to claude_desktop_config.json

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

Add to ~/.cursor/mcp.json

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

Add to .vscode/mcp.json

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

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

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

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

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

Using several servers? Build one config file with the MCP config generator.

Tools this server provides (1)

Taken from the project documentation; the running server may differ.

ctxfw.resolve_context_bundle
Builds a pruned context bundle for a target file and its dependencies.

What it does

AST context pruning
Replaces nearby files with interface stubs to save tokens.
Focal file preserved
The file you are editing stays byte-for-byte intact.
Prompt-injection defense
SARA screens incoming context for injected instructions.
MCP governance
Applies controls on MCP tool use.
Local only
Runs over stdio with no telemetry egress.
Semantic cache
Uses a SQLite cache for repeat requests.

Good for

  • Cut token use when an agent reads a large codebase
  • Screen repository content for injected instructions
  • Keep agent context local on a developer machine
  • Verify architecture briefs before an agent acts

Pricing

Open source

Open core on PyPI; optional paid capsules from $99

Ctxfw FAQ

Does it send data anywhere?

The README says standard operation has zero network telemetry egress.

How is it installed?

From PyPI as ctxfw.

Is everything free?

The core is open; the author also sells paid capsules and bundles.

Which languages does pruning cover?

The README describes polyglot syntax-tree grammars; the full list is not given.

Is Ctxfw free?

Yes. Ctxfw is open source, so you can use and self-host it for free.

How do I add Ctxfw to Claude Code?

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

What are the best alternatives to Ctxfw?

The closest alternatives to Ctxfw are REA, Context7, Chrome DevTools MCP, Codebase Memory and GitHub.

Where this comes from

  • Description: written from the project's README.
  • Install steps: from the official MCP Registry entry.

How AIPoweredBot checks servers