Code Firewall

A structural similarity-based security filter for MCP that blocks dangerous code patterns before execution.
  • python

0

GitHub Stars

python

Language

4 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "egoughnour-code-firewall-mcp": {
      "command": "uvx",
      "args": [
        "code-firewall-mcp"
      ],
      "env": {
        "OLLAMA_URL": "http://localhost:11434",
        "FIREWALL_DATA_DIR": "~/.code-firewall"
      }
    }
  }
}

Code Firewall MCP provides a structural similarity–based code security filter for MCP (Model Context Protocol). It blocks dangerous code patterns before they reach execution tools by comparing code structure against a blacklist of known-bad patterns, helping you keep automated code execution safe while preserving legitimate use cases.

How to use

You use Code Firewall MCP as a gatekeeper before sending code snippets or files to your MCP execution tools. The firewall analyzes code by parsing it, normalizing its structure, embedding that structure, and comparing it to a blacklist. If the similarity to a dangerous pattern exceeds a threshold, the code is blocked; otherwise it is allowed to proceed to your execution tools.

How to install

Prerequisites you need before installing the firewall MCP server.

Install via the recommended method using the provided command line utility.

Configuration and runtime

To wire the firewall MCP into Claude Code or Claude Desktop, you can register a local MCP server that runs the firewall as a subprocess. The following configuration shows how to connect Claude to the local firewall service.

{
  "mcpServers": {
    "code_firewall": {
      "command": "uvx",
      "args": ["code-firewall-mcp"],
      "env": {
        "FIREWALL_DATA_DIR": "~/.code-firewall",
        "OLLAMA_URL": "http://localhost:11434"
      }
    }
  }
}

Additional notes

Environment variables control where data is stored and how embeddings are retrieved. The firewall relies on Ollama for embeddings and a vector store for blacklist patterns. Ensure Ollama is available and reachable at the configured URL.

Tools and capabilities

The firewall provides a set of utilities to manage, test, and operate the protection layer.

Available tools

firewall_system_check

Check system requirements including OS, architecture, and available RAM to ensure the firewall can operate correctly.

firewall_setup_ollama

Install and configure Ollama via Homebrew, start the service, and pull the embedding model.

firewall_setup_ollama_direct

Install Ollama via direct download without needing sudo, start the service, and pull the embedding model.

firewall_ollama_status

Check the status of the Ollama service and the readiness of embeddings.

firewall_check

Evaluate a code file to determine if it is safe to pass to execution tools.

firewall_check_code

Evaluate a code string directly to determine safety without a file.

firewall_blacklist

Add a dangerous pattern to the blacklist with a rationale and severity.

firewall_record_delta

Record near-miss variants to sharpen the classifier and improve accuracy.

firewall_list_patterns

List patterns currently in the blacklist or delta collection.

firewall_remove_pattern

Remove a pattern from the blacklist or delta collection.

firewall_status

Get current firewall status and usage statistics.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational