loading…
Search for a command to run...
loading…
An intentionally vulnerable case management system designed for security training that provides MCP tools for SOC analyst workflows like case handling and indic
An intentionally vulnerable case management system designed for security training that provides MCP tools for SOC analyst workflows like case handling and indicator search. It enables users to explore and demonstrate common security weaknesses such as prompt injection, SQL injection, and broken authorization in an MCP-integrated environment.
MIT License Python GitHub stars
ThreatByte-MCP is a deliberately vulnerable, MCP-based case management web app. It mirrors a realistic SOC analyst workflow with a server-rendered UI and a real MCP server. The MCP tools are intentionally vulnerable for training and demonstration.
[!NOTE] For educational use in controlled environments only.
ThreatByte-MCP is a split architecture:
The MCP server exposes JSON-RPC at POST http://localhost:5002/mcp (Streamable HTTP). The web UI calls the MCP server through a server-side proxy to keep auth consistent with the SOC session; the proxy streams agent responses to the browser via SSE. A sample mcp.json manifest is included at the repo root.
All direct MCP calls must include MCP-Protocol-Version: 2025-11-25 and Accept: application/json, text/event-stream.
Architecture (simplified):
Browser
|
v
+------------------+ X-TBMCP-Token + X-TBMCP-User +-------------------+
| SOC Web App | ---------------------------------------> | MCP Server |
| (Flask, :5001) | /mcp-proxy (server-side) | (FastMCP, :5002) |
+------------------+ +-------------------+
| |
v v
SQLite DB Tool registry
Agent + tool handlers
Architecture (detailed):
Mode A (Web UI as HTTP MCP client)
Browser (Analyst)
|
v
SOC Web App (Flask, :5001)
- Auth session (cookie)
- Dashboards, cases, notes, files UI
- POST /mcp-proxy forwards JSON-RPC
- Injects X-TBMCP-Token + X-TBMCP-User to the MCP server
|
+--> SQLite DB (users/cases/notes/files/indicators)
+--> Uploads (app/uploads)
|
v
MCP Server (FastMCP, :5002)
- /mcp JSON-RPC (Streamable HTTP)
- Tool registry (mcp_tools)
- Agent runtime + tool handlers
- Persistence: agent_contexts, agent_logs, mcp_audit_logs
Mode B (Local agent/IDE as stdio MCP client)
Local Agent / IDE (e.g., Claude Desktop) spawns:
python run_mcp_server.py --stdio
and communicates via stdin/stdout JSON-RPC (stdio transport).
Diagram: ThreatByte-MCP architecture diagram
The web app proxies MCP calls with these headers:
X-TBMCP-Token: shared secret from TBMCP_MCP_SERVER_TOKEN (configured on both servers).X-TBMCP-User: current user id from the authenticated SOC session.Direct MCP calls require the same headers.
Supported tools:
cases.createcases.listcases.list_allcases.getcases.renamecases.set_statuscases.deletenotes.createnotes.listnotes.updatenotes.deletefiles.upload (base64)files.listfiles.get (base64)files.read_pathindicators.searchagent.summarize_caseagent.run_tasktools.registry.listtools.builtin.listtools.registry.registertools.registry.deleteThe following weaknesses are intentionally present for teaching:
files.read_pathcd ThreatByte-MCP
python -m venv venv_threatbyte_mcp
source venv_threatbyte_mcp/bin/activate
pip install -r requirements.txt
python db/create_db_tables.py
python run_mcp_server.py --http
python run.py
Open: http://localhost:5001
MCP Server: http://localhost:5002/mcp
This repository ships two MCP server transports:
/mcp-proxy forwarder.Examples:
# HTTP (required for the web app)
python run_mcp_server.py --http --host 127.0.0.1 --port 5002
# stdio (for MCP clients that support stdio transport; the web app will NOT work with this)
# In stdio mode there are no HTTP headers, so the server reads user context from env vars.
# Note: stdio mode runs the MCP server on AnyIO's Trio backend; ensure `trio>=0.28.0` is installed.
export TBMCP_MCP_SERVER_TOKEN=tbmcp-mcp-token
export TBMCP_MCP_USER_ID=1
python run_mcp_server.py --stdio
Some MCP clients (e.g., Claude Desktop) enforce strict tool name validation (^[a-zA-Z0-9_-]{1,64}$) and will reject dotted tool names like cases.create.
To run the MCP server in a Claude-compatible mode, set:
TBMCP_TOOL_NAME_MODE=claudeThis exposes tools as underscore names (e.g., cases_create, tools_registry_register, files_read_path) instead of dotted names.
For a complete walkthrough (Windows + WSL stdio), see Claude Desktop setup.
The repository includes a Dockerfile and startup script that initialize the DB and run both services in one container:
:5001:5002Build the image:
# Docker
docker build -t threatbyte-mcp .
# Podman
podman build -t threatbyte-mcp .
Run the container:
# Docker
docker run --rm -p 5001:5001 -p 5002:5002 threatbyte-mcp
# Podman
podman run --rm -p 5001:5001 -p 5002:5002 threatbyte-mcp
Run with optional environment variables:
# Docker
docker run --rm -p 5001:5001 -p 5002:5002 \
-e TBMCP_MCP_SERVER_TOKEN=tbmcp-mcp-token \
-e OPENAI_API_KEY=your_api_key \
-e TBMCP_OPENAI_MODEL=gpt-4o-mini \
threatbyte-mcp
# Podman
podman run --rm -p 5001:5001 -p 5002:5002 \
-e TBMCP_MCP_SERVER_TOKEN=tbmcp-mcp-token \
-e OPENAI_API_KEY=your_api_key \
-e TBMCP_OPENAI_MODEL=gpt-4o-mini \
threatbyte-mcp
Persist SQLite data between runs (optional):
# Docker
docker run --rm -p 5001:5001 -p 5002:5002 \
-v "$(pwd)/db:/app/db" \
-v "$(pwd)/app/uploads:/app/app/uploads" \
threatbyte-mcp
# Podman
podman run --rm -p 5001:5001 -p 5002:5002 \
-v "$(pwd)/db:/app/db:Z" \
-v "$(pwd)/app/uploads:/app/app/uploads:Z" \
threatbyte-mcp
python db/populate_db.py --users 8 --cases 20 --notes 40 --files 20
This creates random users, cases, notes, and file artifacts. All user passwords are Password123!.
The agent task endpoint requires a real LLM. Without an API key, the agent returns an error indicating it is unavailable.
Environment variables:
TBMCP_OPENAI_API_KEY or OPENAI_API_KEYTBMCP_OPENAI_MODEL (default: gpt-4o-mini)Keep API keys server-side only and never expose them in the browser.
The SOC web app proxies MCP calls to the MCP server using a shared token.
Environment variables:
TBMCP_MCP_SERVER_URL (default: http://localhost:5002/mcp)TBMCP_MCP_SERVER_TOKEN (shared secret between the SOC app and MCP server)http://localhost:5002/mcp (JSON-RPC). The UI calls them through /mcp-proxy.My Cases (all cases owned by the logged-in user)MCP Audit Logs (server-side audit trail of MCP tool calls from HTTP + stdio clients)Agent Logs (internal agent runner traces; populated by agent.run_task)Выполни в терминале:
claude mcp add threatbyte-mcp -- npx CSA PROJECT - FZCO © 2026 IFZA Business Park, DDP, Premises Number 31174 - 001
Безопасность
Низкий рискАвтоматическая эвристика по публичным данным — не гарантия безопасности.