Code Firewall MCP
概要
作者による説明(英語の原文)
Structural similarity-based code filter. Stops malicious code pattern reaching execution tools.
できること
このサーバーのやさしい解説はまだ書いていません。以下はレジストリから読み取った事実です。
- 接続方法: パソコンで動く
- トランスポート: stdio
- カテゴリ: 開発者ツール
インストール
使っているAIアプリを選んで、設定をコピーしてください。
チェック 2/3 合格 · あなたのパソコンで動きます
まず:どの AI を使っていますか?
使っているアプリを選ぶと、下に手順が表示されます。
Claude につなげますが、先に準備が必要です
キー不要、インストール不要 · パソコン版 Claude アプリ(Windows または Mac)のみ。Web やスマホでは使えません
ファイルをダブルクリックし、パソコン版 Claude アプリで Install を押す
試してみる
Code Firewall MCP を使って、私に何ができるか教えて、1 つやってみせて✓ Claude が Code Firewall MCP を使っていると言うか、回答に Code Firewall MCP のツール名が出れば接続成功です
メニュー名は 2026年11月11日 に Anthropic のヘルプページで確認 · アプリのバージョンにより画面が少し違うことがあります
ChatGPT はまだ Code Firewall MCP につなげません
Code Firewall MCP はパソコンに入れて使うものですが、ChatGPT は Web 上で動くサーバーにしかつなげません
代わりにできること
A · Code Firewall MCP につなげるアプリを使う
- キー不要、インストール不要 · パソコン版 Claude アプリ(Windows または Mac)のみ。Web やスマホでは使えません
- Code Firewall MCP のキーが必要です(提供元のサイトで登録、費用がかかる場合あり) · 先にパソコンへ Python (uv) を入れてください(1 回だけ)
- Code Firewall MCP のキーが必要です(提供元のサイトで登録、費用がかかる場合あり) · 先にパソコンへ Python (uv) を入れてください(1 回だけ)
- Code Firewall MCP のキーが必要です(提供元のサイトで登録、費用がかかる場合あり) · 先にパソコンへ Python (uv) を入れてください(1 回だけ)
B · 開発者ツール の中で ChatGPT につなげる別のサーバー
同じカテゴリでよく使われているものから、キーなしでアドレスだけでつなげるものを選びました
- Sentry✓ ChatGPT
- Front-End Checklist✓ ChatGPT
- Compiler Explorer✓ ChatGPT
Claude Code につなげますが、先に準備が必要です
Code Firewall MCP のキーが必要です(提供元のサイトで登録、費用がかかる場合あり) · 先にパソコンへ Python (uv) を入れてください(1 回だけ)
ターミナルを開く
Mac:Command+スペースで Terminal と入力 · Windows:PowerShell を開く
このコマンドを貼り付けて Enter
claude mcp add code-firewall --env FIREWALL_DATA_DIR=your-value --env OLLAMA_URL=your-value --env EMBEDDING_MODEL=your-value --env SIMILARITY_THRESHOLD=your-value -- uvx code-firewall-mcpEnter の前に「your-value」を自分のキーに書き換えてください
キーはアプリの入力欄にだけ貼り付け、チャットに貼ったり人に送ったりしないでください
Claude Code で /mcp と入力
Code Firewall MCP が一覧にあり、接続済みと表示されれば OK です
試してみる
Code Firewall MCP を使って、私に何ができるか教えて、1 つやってみせて✓ Claude Code が Code Firewall MCP を使っていると言うか、回答に Code Firewall MCP のツール名が出れば接続成功です
メニュー名は 2026年11月11日 に Anthropic のヘルプページで確認 · アプリのバージョンにより画面が少し違うことがあります
Cursor につなげますが、先に準備が必要です
Code Firewall MCP のキーが必要です(提供元のサイトで登録、費用がかかる場合あり) · 先にパソコンへ Python (uv) を入れてください(1 回だけ)
Code Firewall MCP に登録してキーを作る
提供元のサイトで登録し、次の手順で使う API キーを作ります。費用がかかる場合があります。
キーの取り方は下の提供元 README にあります
キーを入力
Code Firewall MCP の設定で FIREWALL_DATA_DIR, OLLAMA_URL, EMBEDDING_MODEL, SIMILARITY_THRESHOLD が空です。自分のキーを入れて保存します
キーはアプリの入力欄にだけ貼り付け、チャットに貼ったり人に送ったりしないでください
Cursor の AI チャットを Agent モードで開く
試してみる
Code Firewall MCP を使って、私に何ができるか教えて、1 つやってみせて✓ Cursor が Code Firewall MCP を使っていると言うか、回答に Code Firewall MCP のツール名が出れば接続成功です
メニュー名は 2026年11月11日 に Cursor のヘルプページで確認 · アプリのバージョンにより画面が少し違うことがあります
VS Code につなげますが、先に準備が必要です
Code Firewall MCP のキーが必要です(提供元のサイトで登録、費用がかかる場合あり) · 先にパソコンへ Python (uv) を入れてください(1 回だけ)
Code Firewall MCP に登録してキーを作る
提供元のサイトで登録し、次の手順で使う API キーを作ります。費用がかかる場合があります。
キーの取り方は下の提供元 README にあります
キーを入力
Code Firewall MCP の設定で FIREWALL_DATA_DIR, OLLAMA_URL, EMBEDDING_MODEL, SIMILARITY_THRESHOLD が空です。自分のキーを入れて保存します
キーはアプリの入力欄にだけ貼り付け、チャットに貼ったり人に送ったりしないでください
VS Code の AI チャットを Agent モードで開く
試してみる
Code Firewall MCP を使って、私に何ができるか教えて、1 つやってみせて✓ VS Code が Code Firewall MCP を使っていると言うか、回答に Code Firewall MCP のツール名が出れば接続成功です
メニュー名は 2026年11月11日 に VS Code のヘルプページで確認 · アプリのバージョンにより画面が少し違うことがあります
Windsurf、Zed、Gemini CLI など MCP を使える他のアプリは追加方法がそれぞれ違います。アプリ一覧で確認してください
JSON 設定は下の「開発者向け」にあります
開発者向け:ターミナルのコマンドと JSON 設定
パソコンにインストール
Claude Code
claude mcp add code-firewall --env FIREWALL_DATA_DIR=your-value --env OLLAMA_URL=your-value --env EMBEDDING_MODEL=your-value --env SIMILARITY_THRESHOLD=your-value -- uvx code-firewall-mcpClaude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"code-firewall": {
"command": "uvx",
"args": [
"code-firewall-mcp"
],
"env": {
"FIREWALL_DATA_DIR": "your-value",
"OLLAMA_URL": "your-value",
"EMBEDDING_MODEL": "your-value",
"SIMILARITY_THRESHOLD": "your-value"
}
}
}
}Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"code-firewall": {
"command": "uvx",
"args": [
"code-firewall-mcp"
],
"env": {
"FIREWALL_DATA_DIR": "your-value",
"OLLAMA_URL": "your-value",
"EMBEDDING_MODEL": "your-value",
"SIMILARITY_THRESHOLD": "your-value"
}
}
}
}VS Code (mcp.json)
{
"servers": {
"code-firewall": {
"type": "stdio",
"command": "uvx",
"args": [
"code-firewall-mcp"
],
"env": {
"FIREWALL_DATA_DIR": "your-value",
"OLLAMA_URL": "your-value",
"EMBEDDING_MODEL": "your-value",
"SIMILARITY_THRESHOLD": "your-value"
}
}
}
}自分で入力する値
FIREWALL_DATA_DIRenvDirectory for storing ChromaDB dataOLLAMA_URLenvURL for Ollama server (default: http://localhost:11434)EMBEDDING_MODELenvOllama embedding model (default: nomic-embed-text)SIMILARITY_THRESHOLDenvBlock threshold 0-1 (default: 0.85)
この設定は、作者のレジストリ登録情報から作成しています。READMEと違う場合は、READMEに従ってください。
ひと目でわかる
使えるアプリ
このサーバーのつなぎ方と、各アプリの公式ドキュメントに基づきます。2026年11月10日に確認。
パソコン上で動かせるアプリ
ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast
できること
パソコンで動くサーバーです。インストールすると、ツール一覧がAIアプリに表示されます。
基本チェックi
誰でも見られる情報をチェックしており、コードは読んでいません。当てはまらない項目は数に入れていません。 · 2026年11月11日にチェック
- ✓ 合格
作者とリポジトリが一致
レジストリ名は、リポジトリを所有するGitHubアカウント egoughnour で確認済みです
- ! 注意
今もメンテナンスされている
コードの最終更新:10 か月前(6か月以上前)
- ✓ 合格
ライセンスがある
MITを使用
- – 対象外
エンドポイントが応答する
これはパソコンで動くため、インターネット上のエンドポイントはありません
- – 対象外
OAuthでサインイン
パソコンで動き、代わりにローカルの設定を使います
- … 未チェック
ツールの説明に隠れた指示がない
パソコンで動くサーバーです。ツール一覧を読み取れるのは、インターネット上のエンドポイントがある場合だけです
話し合い
質問、コツの共有、使えないことの報告ができます。「役に立った」の多い順です。
ユーザーレビュー
まだレビューはありません
開発者ツールのほかのサーバーとの比較i
- このカテゴリのほかの5760件のうち0%よりスターが多い
- このカテゴリのほかの5760件のうち2%より最近レジストリに公開
- 基本チェックの結果が、このカテゴリのほかの5760件のうち29%と同じかそれ以上
レジストリでこのカテゴリにある有効なすべてのサーバーと比較しています。スターは、公開者がリポジトリの所有者である場合だけ数えます。
よくある質問
Code Firewall MCPは安全ですか?
当てはまる基本チェック3項目のうち2項目に合格しました。コードは読んでいません。キーやトークンを追加する前に、サーバーがどんなアクセスを求めているかを確認し、必要な権限だけを持つキーを使ってください。
どんなキーやコードが必要ですか?
レジストリには必須のキーは載っていません。ただし、最初に使うときにサインインを求めるサーバーもあります。
パソコンで動きますか、それともクラウドですか?
あなたのパソコンで動きます。必要なときにAIアプリが起動し、データは作者のサーバーを通りません(サーバー自体がオンラインサービスを呼び出す場合を除きます)。
今もメンテナンスされていますか?
GitHubリポジトリの最終更新は10 か月前、最新バージョン(0.7.0)がレジストリに届いたのは10 か月前です。
どのアプリで使えますか?
Claude Desktop、Claude Code、Cursor、VS CodeなどのMCP対応アプリで使えます。パソコンにPython (uv), MCPBも必要です。
代わりに使えるものは?
同じカテゴリには:REA, Netdata, Front-End Checklist
代わりの候補
同じカテゴリで、ほかの作者が作ったサーバー。スターの多い順。
カードの見方:↓ 週あたりのダウンロードi★ GitHubスターi3つの柱:レビュー · チェック · 利用状況i更新=最新バージョンをレジストリに公開した日i
Netdata
Real-time infrastructure monitoring with metrics, logs, alerts, and ML-based anomaly detection.
Front-End Checklist
Review frontend code and live pages against 386 quality-gated web development rules.
作者のREADME
READMEを開く
作者のリポジトリから書かれたとおりにコピーしたものです。PopNx MCPは内容を確認・推奨していません。HTML、画像、スクリプトは取り除いています。リンクはこのサイトの外へ移動します。
Code Firewall MCP
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.
How It Works
flowchart LR
A[Code file/string] --> B[Parse & Normalize tree-sitter] B --> C[Embed Ollama] C --> D{Similarity Check vs Blacklist} D -->|≥ threshold| E[🚫 BLOCKED] D -->|< threshold| F[✅ ALLOWED] F --> G[Execution Tools rlm_exec, etc.]
style E fill:#ff6b6b,color:#fff style F fill:#51cf66,color:#fff style D fill:#339af0,color:#fff
- Parse code to Concrete Syntax Tree (CST) using tree-sitter
- Normalize by stripping identifiers and literals → structural skeleton
- Embed the normalized structure via Ollama
- Compare against blacklisted patterns in ChromaDB
- Block if similarity exceeds threshold, otherwise allow
Key Insight
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.
Installation
Quick Start
Option 1: PyPI (Recommended)
uvx code-firewall-mcp
or
pip install code-firewall-mcp
Option 2: Claude Desktop One-Click
Download the .mcpb from Releases and double-click to install.
Option 3: From Source
git clone https://github.com/egoughnour/code-firewall-mcp.git
cd code-firewall-mcp uv sync
Wire to Claude Code / Claude Desktop
Add to ~/.claude/.mcp.json (Claude Code) or claude_desktop_config.json (Claude Desktop):
{
"mcpServers": { "code-firewall": { "command": "uvx", "args": ["code-firewall-mcp"], "env": { "FIREWALL_DATA_DIR": "~/.code-firewall", "OLLAMA_URL": "http://localhost:11434" } } } }
Requirements
- Python 3.10+ (< 3.14 due to onnxruntime compatibility)
- Ollama (for embeddings)
- ChromaDB (for vector storage)
- tree-sitter (optional, for better parsing)
Setting Up Ollama (Embeddings)
Code Firewall can automatically install and configure Ollama on macOS with Apple Silicon. There are two installation methods:
Method 1: Homebrew Installation
# 1. Check system requirements
firewall_system_check()
2. Install via Homebrew
firewall_setup_ollama(install=True, start_service=True, pull_model=True)
What this does:
- Installs Ollama via Homebrew (
brew install ollama) - Starts Ollama as a managed background service
- Pulls nomic-embed-text model for embeddings
Method 2: Direct Download (No Sudo)
# 1. Check system
firewall_system_check()
2. Install via direct download - no sudo, no Homebrew
firewall_setup_ollama_direct(install=True, start_service=True, pull_model=True)
What this does:
- Downloads Ollama from https://ollama.com
- Extracts to
~/Applications/(no admin needed) - Starts Ollama via
ollama serve - Pulls nomic-embed-text model
Manual Setup
# Install Ollama
brew install ollama
or download from https://ollama.ai
Start service
brew services start ollama
or: ollama serve
Pull embedding model
ollama pull nomic-embed-text
Verify
firewall_ollama_status()
Tools
Setup & Status Tools
| 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 |
Firewall Tools
| 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_check
Check if a code file is safe to pass to execution tools.
result = await firewall_check(file_path="/path/to/script.py")
Returns: {allowed: bool, blocked: bool, similarity: float, ...}
firewall_check_code
Check code string directly (no file required).
result = await firewall_check_code(
code="import os; os.system('rm -rf /')", language="python" )
firewall_blacklist
Add a dangerous pattern to the blacklist.
result = await firewall_blacklist(
code="os.system(arbitrary_command)", reason="Arbitrary command execution", severity="critical" )
firewall_record_delta
Record near-miss variants to sharpen the classifier.
result = await firewall_record_delta(
code="subprocess.run(['ls', '-la'])", similar_to="abc123", notes="Legitimate use case for file listing" )
firewall_list_patterns
List patterns in the blacklist or delta collection.
firewall_remove_pattern
Remove a pattern from blacklist or deltas.
firewall_status
Get firewall status and statistics.
Configuration
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 |
Usage Pattern
Pre-filter for massive-context-mcp
Use code-firewall-mcp as a gatekeeper before passing code to rlm_exec:
# 1. Check code safety
check = await firewall_check_code(user_code)
if check["blocked"]: print(f"BLOCKED: {check['reason']}") return
2. If allowed, proceed with execution
result = await rlm_exec(code=user_code, context_name="my-context")
Integrated with massive-context-mcp
Install massive-context-mcp with firewall integration:
pip install massive-context-mcp[firewall]
When enabled, rlm_exec automatically checks code against the firewall before execution.
Building the Blacklist
The blacklist grows through use:
- Initial seeding: Add known dangerous patterns
- Audit feedback: When
rlm_auto_analyzefinds security issues, add patterns - Delta sharpening: Record near-misses to improve classification boundaries
# After security audit finds issues
await firewall_blacklist( code=dangerous_code, reason="Command injection via subprocess", severity="critical" )
Structural Normalization
flowchart TD
subgraph Input A1["os.system('rm -rf /')"] A2["os.system('ls -la')"] A3["os.system(user_cmd)"] end
subgraph Normalization B[Strip literals & identifiers Preserve security keywords] end
subgraph Output C["os.system('S')"] end
A1 --> B A2 --> B A3 --> B B --> C
style C fill:#ff922b,color:#fff
The normalizer strips:
- Identifiers:
my_var→_(except security-sensitive ones) - String literals:
"hello"→"S" - Numbers:
42→N - Comments: Removed entirely
Preserved identifiers (for better pattern matching):
eval,exec,compile,__import__os,system,popen,subprocess,Popen,shellopen,read,write,socket,connectgetattr,setattr,__globals__,__builtins__- And more security-sensitive names...
Example:
# Original
subprocess.run(["curl", url, "-o", output_file])
Normalized (preserves 'subprocess' and 'run')
subprocess.run(["S", _, "S", _])
Both subprocess.run(["curl", ...]) and subprocess.run(["wget", ...]) normalize to the same structure, so blacklisting one catches both.
License
MIT