Godbolt Compiler Explorer
About
A Model Context Protocol (MCP) server that provides access to the Godbolt Compiler Explorer REST API endpoints. Built with the FastMCP Python library.
Details
- Author
- benestar
- Downloads
- 332
- Categories
- Developer Tools
Jump to
- Compile source code with user arguments, files, and libraries
- Compile CMake projects with compiler and library options
- Format source code using available code formatters
- List all supported programming languages
- Get available compilers and libraries per language
- Retrieve assembly instruction documentation for any opcode
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Godbolt Compiler ExplorerCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Clone the repository, create and activate a Python virtual environment, and install dependencies from requirements.txt. Run the server standalone with python godbolt_mcp.py, or add it to an MCP-compatible agent by specifying the virtual environment's Python interpreter and the path to godbolt_mcp.py in the MCP configuration JSON.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"godbolt compiler explorer": {
"godbolt-compiler-explorer": {
"command": "/absolute/path/to/godbolt-mcp/venv/bin/python",
"args": [
"/absolute/path/to/godbolt-mcp/godbolt_mcp.py"
]
}
}
}
}
McpServers
{
"godbolt-compiler-explorer": {
"command": "/absolute/path/to/godbolt-mcp/venv/bin/python",
"args": [
"/absolute/path/to/godbolt-mcp/godbolt_mcp.py"
]
}
}
Installation
1. Clone this repository:
git clone <repository-url>
cd godbolt-mcp
2. Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate
3. Install dependencies:
pip install -r requirements.txt
Usage
Standalone Usage
Run the MCP server directly:
python godbolt_mcp.py
Adding to MCP-Compatible Agents
Add the server to your MCP configuration (using virtual environment Python):
{
"mcpServers": {
"godbolt-compiler-explorer": {
"command": "/absolute/path/to/godbolt-mcp/venv/bin/python",
"args": ["/absolute/path/to/godbolt-mcp/godbolt_mcp.py"]
}
}
}
Note: Replace /absolute/path/to/godbolt-mcp with the actual absolute path to your installation directory.
Available Tools
Resources (Read-only access)
-resource://languages - List all supported programming languages
- resource://compilers/{language_id} - Get available compilers for a specific language
- resource://libraries/{language_id} - Get available libraries for a specific language
- resource://formats - List available code formatters
- resource://asm/{instruction_set}/{opcode} - Get assembly instruction documentation
- resource://version - Get Compiler Explorer version information
Tools (Actions)
-compile_code(compiler_id, source, user_arguments=None, files=None, libraries=None) - Compile source code
- compile_cmake(compiler_id, source, user_arguments=None, files=None, libraries=None) - Compile CMake project
- format_code(formatter, source) - Format source code
Examples
The examples/ folder contains sample source files you can use to test the MCP server:
- hello.cpp - Simple C++ "Hello World" program
- hello.rs - Simple Rust "Hello World" program
Try these prompts with MCP-compatible agents to generate assembly code for the example files:
For C++ example:
Compile the hello.cpp file from the examples folder with GCC and show me the exact generated assembly code with optimization level -O2.
For Rust example:
Compile the hello.rs file from the examples folder with the latest Rust compiler and show me the exact generated assembly code with release optimizations.
Dependencies
- fastmcp>=0.2.0 - MCP server framework
- httpx>=0.25.0 - HTTP client for API requests
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





