CodeQL MCP Server logo

CodeQL MCP Server

by JordyZomer

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.

View on GitHub

Last updated: N/A

What is CodeQL MCP Server?

The CodeQL MCP Server is a server that wraps the CodeQL query server using the Model Context Protocol (MCP). This allows tools like Cursor and AI agents to interact with CodeQL in a structured way.

How to use CodeQL MCP Server?

  1. Install the requirements using uv pip install -r requirements.txt or pip install fastmcp httpx. 2. Run the server using uv run mcp run server.py -t sse. 3. Configure your Cursor config file (.cusor/config.json) to point to the server URL (http://localhost:8000/sse). 4. Ensure you have a codeql binary in your $PATH or hardcode its path in codeqlclient.py. Specify query locations, query write locations and database paths in your prompts.

Key features of CodeQL MCP Server

  • Register CodeQL databases

  • Run full queries or quick-evaluate a symbol

  • Decode .bqrs files into JSON

  • Locate predicate/class symbol positions

Use cases of CodeQL MCP Server

  • Integrating CodeQL analysis into AI-powered code editors

  • Enabling natural language interaction with CodeQL

  • Automating CodeQL queries through AI agents

  • Providing structured access to CodeQL functionality for various tools

FAQ from CodeQL MCP Server

What is MCP?

Model Context Protocol

What is CodeQL?

A semantic code analysis engine.

Why use this server?

To enable tools like Cursor or AI agents to interact with CodeQL through structured commands and doc search.

What are the requirements?

fastmcp, httpx, and a codeql binary in your $PATH.

How do I configure Cursor?

Make sure your .cusor/config.json contains the server URL (http://localhost:8000/sse).