Skip to main content
Glama
README.md
<p align="center">
  <img src="./mcpspy-banner.jpg" alt="MCP Firewall β€” mcpspy secret shield and tool-call inspector" width="100%" />
</p>

<h1 align="center">MCP Firewall</h1>

<p align="center">
  <strong>mcpspy is a local MCP firewall for Cursor, Claude Code, and Claude Desktop.</strong><br />
  Search terms: MCP firewall, MCP security proxy, secret redaction, tool-call inspector.
</p>

<p align="center">
  <a href="https://www.npmjs.com/package/@mcp2pro/mcpspy"><img src="https://img.shields.io/npm/v/@mcp2pro/mcpspy?color=06b6d4&label=npm" alt="npm version" /></a>
  <a href="https://www.npmjs.com/package/@mcp2pro/mcpspy"><img src="https://img.shields.io/npm/dm/@mcp2pro/mcpspy?color=10b981" alt="npm downloads" /></a>
  <a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License" /></a>
  <a href="https://polar.sh/ai-forve-your-saas-developer/products/f679e369-bc00-455b-91f6-d63e89263a6d"><img src="https://img.shields.io/badge/Personal%20%241%20%C2%B7%20Team%20%245-8b5cf6" alt="MCP Firewall Personal $1, Team $5" /></a>
  <a href="https://glama.ai/mcp/servers/ShahFahadHashmi/mcpspy"><img src="https://glama.ai/mcp/servers/ShahFahadHashmi/mcpspy/badges/score.svg" alt="mcpspy on Glama" /></a>
</p>

---

```
  πŸ“Œ PINNED     5 tool schema(s) locked (rug-pull protection active)
  🟒 READ       filesystem/read_file    β†’ src/index.ts         12ms
  πŸ›‘οΈ  REDACTED  2 secret(s) (Stripe Key, .env Secret) in read_file
  βœ‚οΈ  CAPPED     query_db response trimmed β€” saved ~14,200 tokens
  πŸ”’ SANDBOX    filesystem/read_file    sensitive credential path (~/.ssh/id_rsa)
  πŸ”΄ DELETE     filesystem/delete_file  β†’ .env                 ← BLOCKED
```

**MCP Firewall (`mcpspy`)** is a zero-dependency stdio firewall that wraps any MCP server with **no cloud, no VPS, and no config headache**:

| Protection | What It Does |
| :--- | :--- |
| πŸ›‘οΈ **Auto-Secret Redaction** | Masks OpenAI (`sk-...`), Anthropic (`sk-ant-...`), AWS (`AKIA...`), GitHub (`ghp_...`), Stripe (`sk_live_...`), Slack, Polar, npm tokens, `.env` passwords, DB URLs, and PEM private keys *before* they reach the LLM. |
| πŸ”’ **Blast-Radius Sandbox** | Blocks `~/.ssh`, `~/.aws`, `.npmrc`, `.gnupg`, and optional `--jail` path traversal outside your project directory. |
| πŸ“Œ **Rug-Pull Schema Pinning** | SHA-256 pins `tools/list` definitions on first run and alerts (or freezes with `--strict-pin`) if a 3rd-party MCP server silently mutates a tool description later. |
| βœ‚οΈ **Token-Bloat Cost Shield** | Estimates tokens per call and caps oversized tool responses (`--max-chars 24000`) so one sloppy query never blows up your API bill. |
| ⚑ **1-Command Auto-Setup** | `npx @mcp2pro/mcpspy setup` automatically wraps Cursor & Claude Desktop with backup + `unwrap`. |

---

## Quick Start (1 Command)

Automatically wrap all MCP servers in **Cursor** (`~/.cursor/mcp.json`) and **Claude Desktop** (`claude_desktop_config.json`):

```bash
npx @mcp2pro/mcpspy setup
```

Revert anytime:

```bash
npx @mcp2pro/mcpspy unwrap
```

---

## Manual Usage & Flags

```bash
# Wrap any stdio MCP server
npx @mcp2pro/mcpspy -- npx @modelcontextprotocol/server-filesystem /your/project

# Full firewall mode (workspace path jail + strict rug-pull freeze)
npx @mcp2pro/mcpspy --jail --strict-pin -- npx @modelcontextprotocol/server-filesystem .

# Custom response size cap (default: 24000 chars)
npx @mcp2pro/mcpspy --max-chars 12000 -- python my_mcp_server.py

# Disable automatic secret redaction
npx @mcp2pro/mcpspy --no-redact -- node ./my-server/index.js
```

If an MCP server intentionally updates its tools, re-trust it:

```bash
npx @mcp2pro/mcpspy trust
```

---

## Custom Block & Warn Rules

Create `~/.mcpspy/rules.json`:

```bash
npx @mcp2pro/mcpspy init
```

```json
{
  "block": ["delete_file", "send_email"],
  "warn":  ["write_file", "execute_command"]
}
```

---

## How It Works

`mcpspy` sits transparently between your AI client and any stdio MCP server over JSON-RPC 2.0, rendering alerts to `stderr` so it never interferes with protocol traffic on `stdout`.

```
AI Client (Cursor / Claude) ──stdin──► mcpspy ──stdin──► MCP Server
                            ◄─stdout──        ◄─stdout──
                                        β”‚
                                  stderr (live UI)
```

---

## Pricing

Free mode includes the firewall and **unlimited tool calls**. Paid keys add an audit log on disk.

| Feature | Free | Personal $1 | Team $5 |
| :--- | :---: | :---: | :---: |
| Live terminal UI + secret redaction | βœ… | βœ… | βœ… |
| Sandbox + rug-pull pinning + token cap | βœ… | βœ… | βœ… |
| 1-command `setup` / `unwrap` | βœ… | βœ… | βœ… |
| Tool calls | Unlimited | Unlimited | Unlimited |
| Local JSONL audit logs (`~/.mcpspy/logs/`) | ❌ | βœ… | βœ… |
| Team name on each log line | ❌ | ❌ | βœ… |

Prices are one-time. Polar sends a personal key like `MCPSPY-XXXX-XXXX-XXXX` or a team key like `MCPSPYTEAM-XXXX-XXXX-XXXX`.

**[Personal, $1 β†’](https://polar.sh/ai-forve-your-saas-developer/products/f679e369-bc00-455b-91f6-d63e89263a6d)** Β· **[Team, $5 β†’](https://buy.polar.sh/polar_cl_4aqbSLtXHaBJlAyuauW9XuOmKEIySgJDqaYoW2g5Jf0)**

```bash
npx @mcp2pro/mcpspy activate MCPSPY-XXXX-XXXX-XXXX
npx @mcp2pro/mcpspy activate MCPSPYTEAM-XXXX-XXXX-XXXX --team "Your Team"
```

---

## License

MIT Β© [ShahFahadHashmi](https://github.com/ShahFahadHashmi)

TDQS

A4.3/5.0

Scored across 4 tools

Disambiguation5/5

Each tool maps to a distinct action on a single resource (read/list/delete/write a note) with no functional overlap. write_note explicitly covers create-or-replace, so there is no need for a separate create/update tool and no resulting boundary confusion.

Naming Consistency5/5

All four names follow the same verb_noun snake_case pattern (read_note, list_notes, delete_note, write_note). The only variation is the plural noun in list_notes, which is semantically correct and does not break the pattern.

Tool Count5/5

Four tools is a well-scoped, minimal surface for a title-keyed note store; nothing is redundant and no operation is split artificially. It sits comfortably within the 3-15 range for a focused server.

Completeness4/5

The full lifecycle is covered: write handles create and update, read retrieves bodies, list enumerates and filters by title, and delete removes notes. There are minor gaps (no content-based search, no append or rename), but agents can work around these with read plus write.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues