# ctxfw

ctxfw strips peripheral code down to typed stubs before it reaches the agent's context, and screens incoming prompts for injection attempts.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 8 repo stars
- Author: heuristicolab
- License: Apache-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/heuristicolab/ctxfw
- Updated: 2026-10-29
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/mcp/ctxfw

## What it does

ctxfw sits between a codebase and a coding agent as an MCP layer. It parses dependency files with an AST engine and swaps out the implementation of neighboring modules for interface signatures and type stubs, keeping full code only for the file being worked on. The point is to stop the agent from loading code it never fully reads anyway.

A second layer checks architecture briefs before execution: the server rejects specs that skip invariants, variable bounds, or error handling. A separate filter called SARA screens incoming text for prompt injection. The server runs over stdio with no network telemetry in its standard mode.

Installing it means running `uvx ctxfw`, which requires `uv` on the machine.

## Requirements
- Needs: Python and uv (commands run via uvx)

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add ctxfw -- uvx ctxfw
```
uvx runs the command named after the package; if the README names another one, use uvx --from ctxfw <command>

### Codex

**Platform CLI**
```bash
codex mcp add ctxfw -- uvx ctxfw
```
uvx runs the command named after the package; if the README names another one, use uvx --from ctxfw <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "ctxfw": {
            "command": "uvx",
            "args": [
                "ctxfw"
            ]
        }
    }
}
```
uvx runs the command named after the package; if the README names another one, use uvx --from ctxfw <command>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "ctxfw": {
            "type": "stdio",
            "command": "uvx",
            "args": [
                "ctxfw"
            ]
        }
    }
}
```
uvx runs the command named after the package; if the README names another one, use uvx --from ctxfw <command>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add ctxfw uvx ctxfw
```
uvx runs the command named after the package; if the README names another one, use uvx --from ctxfw <command>

## When to use it
- cut the context an agent pulls in from dependency files
- hand the agent interface stubs instead of full module code
- block architecture briefs missing invariants or error handling
- catch prompt injection in incoming files before processing
- keep code processing local without network telemetry

## Example prompts
- Wire up ctxfw and prune the context before refactoring `cli.py`
- Run this architecture brief through ctxfw to check for missing invariants
- Scan this incoming file with SARA for prompt injection

## Similar
- [knowing](https://affpapa.org/en/nevibecode/mcp/knowing.md) — MCP server · ★ 24 repo stars
- [Girder](https://affpapa.org/en/nevibecode/mcp/girder.md) — MCP server · ★ 15 repo stars
- [cxpak](https://affpapa.org/en/nevibecode/plugins/cxpak.md) — plugin · ★ 34 repo stars
- [run.pay — Agent Marketplace](https://affpapa.org/en/nevibecode/mcp/runpay-agent-marketplace.md) — MCP server · 414 installs
- [ClawGuard Shield](https://affpapa.org/en/nevibecode/mcp/clawguard-shield.md) — MCP server · 395 installs
- [skill-scanner](https://affpapa.org/en/nevibecode/skills/skill-scanner.md) — skill · 4200 installs

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
