CPPCon MCP Server
An MCP server that enables users to compile C++ code and retrieve assembly output through the Compiler Explorer (godbolt.org) API. It supports standard tool calls and Server-Sent Events for streaming compilation status and results.
README
CPPCon MCP Server
This project implements a Model Context Protocol (MCP) server that provides a tool to compile C++ code using the Compiler Explorer (godbolt.org) API. It allows clients to request the assembly output for given C++ code and compiler options, supporting both standard tool invocation and Server-Sent Events (SSE) for streaming results.
Features
- MCP Compliant: Built using
mcp-server[fastmcp], ensuring adherence to the Model Context Protocol. get_assemblyTool: Exposes a tool that compiles C++ code using MSVC (via godbolt.org) and returns the generated assembly.- SSE Support: Provides a Server-Sent Events endpoint (
/sse) for streaming compilation status and results. - Tool Discovery: Exposes a
/capabilitiesendpoint for clients to discover available tools and their schemas. - Client Messaging: Supports a
/messageendpoint for general client-to-server communication.
Setup
Prerequisites
- Python 3.11 or higher
Installation
-
Create a virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate` -
Install dependencies:
pip install "mcp-server[fastmcp]" uvicorn requests pydantic
Running the Server
To start the MCP server, execute the server.py script:
python server.py
The server will run on http://127.0.0.1:8000 by default.
Usage
The server exposes several endpoints compliant with the Model Context Protocol.
1. Get Server Capabilities
Clients can discover the server's capabilities, including available tools, by sending a GET request to the /capabilities endpoint.
curl http://127.0.0.1:8000/capabilities
2. Invoke get_assembly Tool (Standard POST)
To get the assembly output for C++ code in a single request/response cycle, send a POST request to the /tool/get_assembly endpoint.
Example Request:
curl -X POST
-H "Content-Type: application/json"
-d '{"code": "int main() { return 0; }", "options": "/O2"}'
http://127.0.0.1:8000/tool/get_assembly
3. Stream get_assembly Results (Server-Sent Events)
For streaming compilation status and results, connect to the /sse endpoint using GET. The code and options for compilation are passed as URL query parameters. An optional sessionId can also be provided for client tracking.
Example Request:
curl -N "http://127.0.0.1:8000/sse?code=int%20main()%20%7B%20return%200%3B%20%7D&options=/O2&sessionId=my_compiler_session_123"
The server will stream events in the following format:
event: message
data: {"status": "starting_compilation", "sessionId": "my_compiler_session_123"}
event: result
data: {"type": "text", "text": "; Assembly output here..."}
event: message
data: {"status": "compilation_complete", "sessionId": "my_compiler_session_123"}
In case of an error, an event: error will be sent:
event: error
data: {"type": "server_error", "text": "Error details here...", "sessionId": "my_compiler_session_123"}
4. Send Client Messages
Clients can send general messages to the server via a POST request to the /message endpoint. These messages can be used for various client-initiated communications.
Example Request:
curl -X POST
-H "Content-Type: application/json"
-d '{"type": "client_ping", "sessionId": "my_compiler_session_123", "data": "Are you alive?"}'
http://127.0.0.1:8000/message
The server will respond with:
{"status": "message_received", "sessionId": "my_compiler_session_123"}
5. Test Server Using modelcontextprotocol/inspector
npx @modelcontextprotocol/inspector
6. Configure using VSCode http MCP server command create mcp.json and start tool
{
"servers": {
"my-mcp-server-4620e938": {
"url": "http://localhost:8000/sse",
"type": "http"
}
},
"inputs": []
}
7. Chat with Copilot, when context need assembly, it will invoke
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.