home / mcp / codeql mcp server

CodeQL MCP Server

Provides a CodeQL-based MCP server that runs queries, decodes results, and supports symbol lookups via a live SSE endpoint.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "jordyzomer-codeql-mcp": {
      "url": "http://localhost:8000/sse"
    }
  }
}

You set up an MCP server that wraps the CodeQL query infrastructure, exposing a structured API so tools and AI agents can run queries, inspect results, and search documentation through clear commands.

How to use

Connect your MCP client to the CodeQL MCP Server at the URL provided when the server is running. You can register CodeQL databases, run full queries or quick-evaluate symbols, decode .bqrs files into JSON, and locate symbol positions. Use natural language prompts to issue these capabilities through your client, and rely on the server to translate your requests into CodeQL actions.

How to install

Prerequisites: ensure you have Python available and a tool to run MCP servers. You will also need a CodeQL binary accessible in your system PATH.

uv pip install -r requirements.txt

Alternatively, you can install the MCP runtime dependencies directly with pip.

pip install fastmcp httpx

Starting the MCP server

Launch the MCP server so it serves requests over the SSE endpoint. The server will listen at the specified URL for client connections.

uv run mcp run server.py -t sse

Configuration and usage notes

Configure your MCP client to point at the server URL. If you use a Cursor-like tool, place the URL in its MCP configuration so it can issue queries to CodeQL through the MCP server.

Example MCP server connection configuration for your client:

{
  "mcpServers": {
    "CodeQL": {
      "url": "http://localhost:8000/sse"
    }
  }
}

Available tools

registerDatabase

Register CodeQL databases so they can be used by queries and symbol lookups.

runQuery

Execute full CodeQL queries or perform quick-evaluate operations on a given symbol.

decodeBqrs

Decode .bqrs results into JSON for easy consumption by clients.

locateSymbol

Locate predicate or class symbol positions within codebase contexts.