Code MCP Server

Structural similarity-based code filter. Stops malicious code pattern reaching execution tools.

Local serverstdioPython

What is the Code MCP Server?

Structural similarity-based code filter. Stops malicious code pattern reaching execution tools.

What the server does

A structural similarity-based code security filter for MCP (Model Context Protocol). Blocks dangerous code patterns before they reach execution tools by comparing code structure against a blacklist of known-bad patterns.

Installation

code-firewall-mcp on PyPI is all you need. Most clients run it directly, so configuration is a few lines and a restart.

Available tools

The toolset is worth reading before you wire it up, because it tells you what the integration is really for:

  • firewall_system_check — Check system requirements — verify macOS, Apple Silicon, RAM
  • firewall_setup_ollama — Install via Homebrew — managed service, auto-updates
  • firewall_setup_ollama_direct — Install via direct download — no sudo, fully headless
  • firewall_ollama_status — Check Ollama availability — verify embeddings are ready
  • firewall_check — Check if a code file is safe to execute
  • firewall_check_code — Check code string directly (no file required)
  • firewall_blacklist — Add a dangerous pattern to the blacklist
  • firewall_record_delta — Record near-miss variants for classifier sharpening
  • firewall_list_patterns — List patterns in blacklist or delta collection
  • firewall_remove_pattern — Remove a pattern from blacklist or deltas
  • firewall_status — Get firewall status and statistics

Credentials and setup notes

Configuration is passed through the environment: FIREWALL_DATA_DIR, OLLAMA_URL. Treat anything key-shaped as a real credential — scope it to the minimum the server needs, and rotate it if it ever lands in a shared config.

  • Python 3.10+ (< 3.14 due to onnxruntime compatibility) - Ollama (for embeddings) - ChromaDB (for vector storage) - tree-sitter (optional, for better parsing)

Worth knowing first

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • Keep per-call confirmation enabled while you learn its behaviour; it is the cheapest safeguard you have.

Where it fits

Plenty of developer tooling servers cover similar ground. The differences that matter in practice are scope of access and how much setup stands between you and a working tool call. Code's toolset — firewall_system_check, firewall_setup_ollama, firewall_setup_ollama_direct and 8 more — is a fair guide to whether it matches your workflow. It is maintained by egoughnour; worth a glance at recent repository activity before you build anything load-bearing on it.

Recorded tools

  • firewall_system_check — Check system requirements — verify macOS, Apple Silicon, RAM
  • firewall_setup_ollama — Install via Homebrew — managed service, auto-updates
  • firewall_setup_ollama_direct — Install via direct download — no sudo, fully headless
  • firewall_ollama_status — Check Ollama availability — verify embeddings are ready
  • firewall_check — Check if a code file is safe to execute
  • firewall_check_code — Check code string directly (no file required)
  • firewall_blacklist — Add a dangerous pattern to the blacklist
  • firewall_record_delta — Record near-miss variants for classifier sharpening
  • firewall_list_patterns — List patterns in blacklist or delta collection
  • firewall_remove_pattern — Remove a pattern from blacklist or deltas
  • firewall_status — Get firewall status and statistics

More MCP options

Compare MCP servers by category, or browse hosted MCP servers if you prefer an endpoint over a local process.

Recorded tools

Check the linked publisher documentation and your connected client's tool list. Names and availability can vary with the server version and account permissions.

ToolWhat it does
firewall_system_check**Check system requirements** — verify macOS, Apple Silicon, RAM
firewall_setup_ollama**Install via Homebrew** — managed service, auto-updates
firewall_setup_ollama_direct**Install via direct download** — no sudo, fully headless
firewall_ollama_status**Check Ollama availability** — verify embeddings are ready
firewall_checkCheck if a code file is safe to execute
firewall_check_codeCheck code string directly (no file required)
firewall_blacklistAdd a dangerous pattern to the blacklist
firewall_record_deltaRecord near-miss variants for classifier sharpening
firewall_list_patternsList patterns in blacklist or delta collection
firewall_remove_patternRemove a pattern from blacklist or deltas
firewall_statusGet firewall status and statistics

How to install the Code MCP Server

{
  "mcpServers": {
    "code-firewall": {
      "command": "uvx",
      "args": ["code-firewall-mcp"],
      "env": {
        "FIREWALL_DATA_DIR": "your-value",
        "OLLAMA_URL": "your-value"
      }
    }
  }
}

Add to claude_desktop_config.json, then restart Claude Desktop.

Configuration

  • Python 3.10+ (< 3.14 due to onnxruntime compatibility) - Ollama (for embeddings) - ChromaDB (for vector storage) - tree-sitter (optional, for better parsing)
VariableDescriptionRequired
FIREWALL_DATA_DIRFilesystem location the server is allowed to use.Optional
OLLAMA_URLEndpoint or connection string the server talks to.Yes

Example prompts to try

  • “Use Code to firewall system check.”
  • “Use Code to firewall setup ollama.”
  • “Use Code to firewall setup ollama direct.”

Frequently asked questions

Structural similarity-based code filter. Stops malicious code pattern reaching execution tools. Confirm the tools offered by your installed version in the connected client. Tool availability and permissions depend on the server and account configuration.