Enables static code analysis of GitHub repositories using Joern's Code Property Graph technology, supporting code browsing, taint analysis, and security vulnerability detection across multiple programming languages.
Provides static code analysis capabilities within VS Code through GitHub Copilot integration, enabling code property graph queries, dataflow analysis, and security scanning.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@CodeBadgerfind potential buffer overflow vulnerabilities in this C codebase"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
𦑠codebadger
A containerized Model Context Protocol (MCP) server providing static code analysis using Joern's Code Property Graph (CPG) technology with support for Java, C/C++, JavaScript, Python, Go, Kotlin, C#, Ghidra, Jimple, PHP, Ruby, and Swift.
Prerequisites
Before you begin, make sure you have:
Docker and Docker Compose installed
Python 3.10+ (Python 3.13 recommended)
pip (Python package manager)
To verify your setup:
docker --version
docker-compose --version
python --versionQuick Start
1. Install Python Dependencies
# Create a virtual environment (optional but recommended)
python -m venv venv
# Install dependencies
pip install -r requirements.txt2. Start the Docker Services (Joern)
docker compose up -dThis starts:
Joern Server: Static code analysis engine (runs CPG generation and queries)
Verify services are running:
docker compose ps3. Start the MCP Server
# Start the server
python main.py &The MCP server will be available at http://localhost:4242.
4. Stop All Services
# Stop MCP server (Ctrl+C in terminal)
# Stop Docker services
docker-compose down
# Optional: Clean up everything
bash cleanup.shCleanup Script
Use the provided cleanup script to reset your environment:
bash cleanup.shThis will:
Stop and remove Docker containers
Kill orphaned Joern/MCP processes
Clear Python cache (
__pycache__,.pytest_cache)Optionally clear the playground directory (CPGs and cached codebases)
Integrations
GitHub Copilot Integration
Edit the MCP configuration file for VS Code (GitHub Copilot):
Path:
~/.config/Code/User/mcp.jsonExample configuration:
{
"inputs": [],
"servers": {
"codebadger": {
"url": "http://localhost:4242/mcp",
"type": "http"
}
}
}Claude Code Integration
To integrate codebadger into Claude Desktop, edit:
Path:
Claude β Settings β Developer β Edit Config β claude_desktop_config.jsonAdd the following:
{
"mcpServers": {
"codebadger": {
"url": "http://localhost:4242/mcp",
"type": "http"
}
}
}Available Tools
Core
generate_cpg: Generate a Code Property Graph (CPG) for a codebase (local path or GitHub URL).get_cpg_status: Check whether a CPG exists and retrieve status metadata.run_cpgql_query: Execute a raw CPGQL query against a CPG and return structured results.get_cpgql_syntax_help: Show CPGQL syntax helpers, tips, and common error fixes.
Code browsing
list_methods: List methods/functions with optional regex/file filters.list_files: Show source files as a paginated tree view.get_method_source: Retrieve the source code for a named method.list_calls: List call sites between functions (caller β callee).get_call_graph: Build a human-readable call graph (incoming or outgoing).list_parameters: Get parameter names, types, and order for a method.get_codebase_summary: High-level metrics (files, methods, calls, language).get_code_snippet: Return a file snippet by start/end line numbers.
Semantic analysis
get_cfg: Produce a control-flow graph (nodes and edges) for a method.get_type_definition: Inspect struct/class types and their members.get_macro_expansion: Heuristically detect likely macro-expanded calls.
Taint & vulnerability analysis
find_taint_sources: Find likely external input points (sources).find_taint_sinks: Locate dangerous sinks where tainted data can flow.find_taint_flows: Detect dataflows from sources to sinks (taint analysis).get_program_slice: Build backward/forward program slices for a call.get_variable_flow: Trace data dependencies for a variable at a location.find_bounds_checks: Search for bounds-checks near a buffer access.find_use_after_free: Heuristic detection of use-after-free patterns.find_double_free: Detect potential double-free issues.find_null_pointer_deref: Find likely null pointer dereferences.find_integer_overflow: Detect integer overflow patterns.
Contributing & Tests
Thanks for contributing! Here's a quick guide to get started with running tests and contributing code.
Prerequisites
Python 3.10+ (3.13 is used in CI)
Docker and Docker Compose (for integration tests)
Local Development Setup
Create a virtual environment and install dependencies
python -m venv venv
pip install -r requirements.txtStart Docker services (for integration tests)
docker-compose up -dRun unit tests
pytest tests/ -qRun integration tests (requires Docker Compose running)
# Start MCP server in background
python main.py &
# Run integration tests
pytest tests/integration -q
# Stop MCP server
pkill -f "python main.py"Run all tests
pytest tests/ -qCleanup after testing
bash cleanup.sh
docker-compose downCode Contributions
Please follow these guidelines when contributing:
Follow repository conventions
Write tests for behavioral changes
Ensure all tests pass before submitting PR
Include a clear changelog in your PR description
Update documentation if needed
Configuration
The MCP server can be configured via environment variables or config.yaml.
Environment Variables
Key settings (optional - defaults shown):
# Server
MCP_HOST=0.0.0.0
MCP_PORT=4242
# Joern
JOERN_BINARY_PATH=joern
JOERN_JAVA_OPTS="-Xmx4G -Xms2G -XX:+UseG1GC -Dfile.encoding=UTF-8"
# CPG Generation
CPG_GENERATION_TIMEOUT=600
MAX_REPO_SIZE_MB=500
# Query
QUERY_TIMEOUT=30
QUERY_CACHE_ENABLED=true
QUERY_CACHE_TTL=300
# Telemetry (OpenTelemetry)
OTEL_ENABLED=false
OTEL_SERVICE_NAME=codebadger
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
OTEL_EXPORTER_OTLP_PROTOCOL=grpcConfig File
Create a config.yaml from config.example.yaml:
cp config.example.yaml config.yamlThen customize as needed.
Telemetry (OpenTelemetry)
CodeBadger has built-in OpenTelemetry support for distributed tracing. When enabled, all MCP tool calls are automatically traced, plus custom spans for CPG generation, Joern server management, and query execution.
Quick Start
Install the telemetry dependencies (included in
requirements.txt):
pip install opentelemetry-sdk opentelemetry-exporter-otlpEnable via environment variables:
export OTEL_ENABLED=true
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
python main.pyOr via config.yaml:
telemetry:
enabled: true
service_name: codebadger
otlp_endpoint: http://localhost:4317
otlp_protocol: grpc # or "http/protobuf"Local Development with Jaeger
# Start Jaeger (provides UI at http://localhost:16686)
docker run -d --name jaeger \
-p 16686:16686 \
-p 4317:4317 \
jaegertracing/all-in-one:latest
# Start CodeBadger with telemetry
OTEL_ENABLED=true python main.pyWhat Gets Traced
Span | Description |
| Every MCP tool invocation (automatic via FastMCP) |
| Full CPG generation pipeline |
| Joern CLI command execution inside Docker |
| Joern server instance creation |
| CPG file loading into Joern server |
| CPGQL query execution with timing and success attributes |
Configuration Reference
Setting | Env Variable | Default | Description |
|
|
| Enable/disable telemetry |
|
|
| Service name in traces |
|
|
| OTLP collector endpoint |
|
|
| Export protocol ( |
When telemetry is disabled (default), all tracing is no-op with zero overhead.
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.