Skip to main content

🦡 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 --version

Quick Start

1. Install Python Dependencies

# Create a virtual environment (optional but recommended)
python -m venv venv

# Install dependencies
pip install -r requirements.txt

2. Start the Docker Services (Joern)

docker compose up -d

This starts:

  • Joern Server: Static code analysis engine (runs CPG generation and queries)

Verify services are running:

docker compose ps

3. 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.sh

Cleanup Script

Use the provided cleanup script to reset your environment:

bash cleanup.sh

This 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.json

Example 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.json

Add the following:

{
  "mcpServers": {
    "codebadger": {
      "url": "http://localhost:4242/mcp",
      "type": "http"
    }
  }
}

Available Tools

Core Tools (hash-based)

  • generate_cpg: Generate a CPG for a codebase (from local path or GitHub URL)
  • get_cpg_status: Get status and existence of a CPG by codebase_hash
  • run_cpgql_query: Execute CPGQL queries (synchronous)

Code Browsing Tools

  • get_codebase_summary: Get codebase overview

  • list_files: List source files

  • list_methods: Discover methods/functions

  • get_method_source: Retrieve method source code

  • list_calls: Find function call relationships

  • get_call_graph: Build call graphs

  • list_parameters: Get parameter information

  • find_literals: Search for hardcoded values

  • get_code_snippet: Retrieve code snippets

  • find_taint_sources: Locate external input points

  • find_taint_sinks: Locate dangerous sinks

  • find_taint_flows: Find dataflow paths

  • find_argument_flows: Find expression reuse

  • check_method_reachability: Check call graph connections

  • list_taint_paths: List detailed taint paths

  • get_program_slice: Build program slices

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

  1. Create a virtual environment and install dependencies
python -m venv venv
pip install -r requirements.txt
  1. Start Docker services (for integration tests)
docker-compose up -d
  1. Run unit tests
pytest tests/ -q
  1. Run 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"
  1. Run all tests
pytest tests/ -q
  1. Cleanup after testing
bash cleanup.sh
docker-compose down

Code Contributions

Please follow these guidelines when contributing:

  1. Follow repository conventions
  2. Write tests for behavioral changes
  3. Ensure all tests pass before submitting PR
  4. Include a clear changelog in your PR description
  5. 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

Config File

Create a config.yaml from config.example.yaml:

cp config.example.yaml config.yaml

Then customize as needed.

Metadata

Release files for iflow-mcp_codebadger 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iflow-mcp_codebadger 0.3.2
File Size Uploaded
iflow_mcp_codebadger-0.3.2.tar.gz 82.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for iflow-mcp_codebadger 0.3.2
File Interpreter ABI Platform
iflow_mcp_codebadger-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 158.4 kB

Release files / iflow_mcp_codebadger-0.3.2.tar.gz

Download URL iflow_mcp_codebadger-0.3.2.tar.gz
Size 82.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9d8c3f0308269fa56c51e60ce1078723a9b816d014f3ffddbdb734a1ae9d0ba4
BLAKE2b-256 checksum
How to use checksums
de45119680cbd12774b7bc64ad0a012b0db01a7a12054992dccc14ed5b711b35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / iflow_mcp_codebadger-0.3.2-py3-none-any.whl

Download URL iflow_mcp_codebadger-0.3.2-py3-none-any.whl
Size 76.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
51a9f849317cb96cc51409f3c807b14a02c9e1e4edb523c8fcc663511561b75d
BLAKE2b-256 checksum
How to use checksums
f60851920000846a82cd604e240936183875e0efa8372657babd69aa304d169a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page