Structural similarity-based code filter. Stops malicious code pattern reaching execution tools.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
We haven't yet run this listing's install command through our automated sandbox check. This isn't a red flag β we're steadily working through the catalog.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
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.
Code patterns like os.system("rm -rf /") and os.system("ls") have identical structure. By normalizing away the specific commands/identifiers, we can detect dangerous patterns regardless of the specific arguments used.
Security-sensitive identifiers are preserved during normalization (e.g., eval, exec, os, system, subprocess, Popen, shell) to ensure embeddings remain discriminative for dangerous patterns.
Option 1: PyPI (Recommended)
Option 2: Claude Desktop One-Click
Download the .mcpb from Releases and double-click to install.
Option 3: From Source
Add to ~/.claude/.mcp.json (Claude Code) or claude_desktop_config.json (Claude Desktop):
Code Firewall can automatically install and configure Ollama on macOS with Apple Silicon. There are two installation methods:
What this does:
brew install ollama)What this does:
~/Applications/ (no admin needed)ollama serve| Tool | Purpose |
|---|---|
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 |
| Tool | Purpose |
|---|---|
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 |
firewall_checkCheck if a code file is safe to pass to execution tools.
firewall_check_codeCheck code string directly (no file required).
firewall_blacklistAdd a dangerous pattern to the blacklist.
firewall_record_deltaRecord near-miss variants to sharpen the classifier.
firewall_list_patternsList patterns in the blacklist or delta collection.
firewall_remove_patternRemove a pattern from blacklist or deltas.
firewall_statusGet firewall status and statistics.
Environment variables:
| Variable | Default | Description |
|---|---|---|
FIREWALL_DATA_DIR | /tmp/code-firewall | Data storage directory |
OLLAMA_URL | http://localhost:11434 | Ollama server URL |
EMBEDDING_MODEL | nomic-embed-text | Ollama embedding model |
SIMILARITY_THRESHOLD | 0.85 | Block threshold (0-1) |
NEAR_MISS_THRESHOLD | 0.70 | Near-miss recording threshold |
Use code-firewall-mcp as a gatekeeper before passing code to rlm_exec:
Install massive-context-mcp with firewall integration:
When enabled, rlm_exec automatically checks code against the firewall before execution.
The blacklist grows through use:
rlm_auto_analyze finds security issues, add patternsThe normalizer strips:
my_var β _ (except security-sensitive ones)"hello" β "S"42 β NNo reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/code-firewall-mcp)<a href="https://allmcps.com/mcp/code-firewall-mcp"><img src="https://allmcps.com/api/badge/code-firewall-mcp?style=directory" alt="Code Firewall MCP on AllMCPs" /></a>