Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

codeql-mcp

MCP.Pizza Chef: JordyZomer

The codeql-mcp is an MCP server that wraps the CodeQL query server, enabling AI agents and tools like Cursor to interact with CodeQL through structured commands. It supports registering CodeQL databases, running full queries or quick symbol evaluations, decoding .bqrs files into JSON, and locating predicate or class symbol positions, facilitating advanced code analysis workflows.

Use This MCP server To

Register and manage CodeQL databases for query execution Run full CodeQL queries via structured MCP commands Quickly evaluate symbols in code using CodeQL queries Decode CodeQL .bqrs result files into JSON format Locate predicate or class symbol positions in source code Enable AI agents to perform code analysis with CodeQL Integrate CodeQL querying into developer tools like Cursor

README

CodeQL MCP Server

This project runs a Model Context Protocol (MCP) server that wraps the CodeQL query server. It enables tools like Cursor or AI agents to interact with CodeQL through structured commands and doc search.


Features

  • ✅ Register CodeQL databases
  • ✅ Run full queries or quick-evaluate a symbol
  • ✅ Decode .bqrs files into JSON
  • ✅ Locate predicate/class symbol positions

File Structure

File Purpose
server.py Main FastMCP server exposing CodeQL tools
codeqlclient.py CodeQLQueryServer implementation (JSON-RPC handler)

Requirements

Install with uv:

uv pip install -r requirements.txt

or with pip:

pip install fastmcp httpx

Running the MCP Server

uv run mcp run server.py -t sse

Cursor Config

Make sure your .cusor/config.json contains:

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

Notes

  • Tools like Cursor will invoke these commands directly via natural language.
  • You must have a codeql binary in your $PATH, or hardcode its path in codeqlclient.py.
  • You should probably specify query locations, query write locations and database paths in your prompts.

codeql-mcp FAQ

How do I install the codeql-mcp server?
Install dependencies using 'uv pip install -r requirements.txt' or 'pip install fastmcp httpx'.
How do I run the codeql-mcp server?
Use the command 'uv run mcp run server.py' to start the MCP server.
What CodeQL features does this MCP server expose?
It supports registering databases, running queries, quick symbol evaluation, decoding .bqrs files, and locating symbol positions.
Can AI agents interact with CodeQL through this MCP server?
Yes, AI agents like Cursor can send structured commands to perform CodeQL queries and code analysis.
Does the server support decoding CodeQL query results?
Yes, it can decode .bqrs files into JSON for easier consumption.
What programming languages or environments is this MCP server compatible with?
It works with any environment supported by CodeQL and can be integrated into tools that support MCP.
Is the codeql-mcp server compatible with multiple LLM providers?
Yes, it is designed to work with models like OpenAI, Claude, and Gemini through the MCP protocol.
How does this MCP server improve developer workflows?
It automates complex code analysis tasks by enabling AI-driven querying and symbol inspection within development tools.