Compiler Explorer MCP
Explorador de compiladores MCP
Un servidor de Protocolo de contexto de modelo (MCP) que conecta los LLM a la API del explorador del compilador, lo que les permite compilar código, explorar características del compilador y analizar optimizaciones en diferentes compiladores y lenguajes.
Preguntas de ejemplo
Aquí hay algunas preguntas interesantes que puedes hacerle a tu LLM usando este MCP:
Exploración de características del compilador
"¿Cuál es la versión más antigua de GCC que admite la directiva
#embed?"Muéstrame cómo las diferentes versiones de Clang gestionan los módulos C++20.
"¿Qué indicadores de optimización están disponibles en Clang 12 que no estaban en Clang 11?"
"¿Puede demostrar cómo MSVC y GCC manejan las corrutinas C++20 de manera diferente?"
Análisis de optimización
"¿Cuál es la diferencia de ensamblaje entre
-O2y-O3para una función de Fibonacci recursiva simple en GCC 13?""¿Cómo se compara la vectorización de Clang con la de GCC para una multiplicación de matrices básica?"
"Muéstrame cómo los diferentes niveles de optimización afectan la optimización de las llamadas finales en esta función recursiva"
"¿Cuál es el impacto de
-ffast-mathen este cálculo pesado de punto flotante?"
Compatibilidad con funciones de idioma
"¿Qué características de C++20 son compatibles con las últimas versiones de GCC, Clang y MSVC?"
"Muéstrame cómo los diferentes compiladores implementan la distribución de memoria de std::optional"
Compare cómo GCC y Clang gestionan las funciones virtuales constexpr de C++20.
Demuestre las diferencias en cómo los compiladores Intel y GCC vectorizan automáticamente las operaciones SIMD.
Inmersiones profundas en el ensamblaje
"¿Cuál es la forma más eficiente de implementar un recuento de población en ensamblaje x86 en diferentes arquitecturas de CPU?"
"Muéstrame cómo diferentes compiladores optimizan una función de inversión de cadena simple en -O3"
Comparar la salida del ensamblado de una llamada a una función virtual con la de una llamada a una función normal.
"¿Cómo implementan los diferentes compiladores el cambio de tipo de std::variant en ensamblador?"
Comparación entre idiomas
Comparar el ensamblaje generado para el mismo algoritmo en C++, Rust y Go.
"¿En qué se diferencian los mecanismos de manejo de excepciones entre C++ y Rust en términos del código generado?"
"Muéstrame la sobrecarga de la comprobación de límites de Rust en comparación con el acceso sin comprobación a matrices de C++"
Compare cómo C++ y D implementan RAII en términos de ensamblaje generado.
Investigación de desempeño
"¿Cuál es la diferencia a nivel de ensamblaje entre usar std::sort y un quicksort escrito a mano?"
"Muéstrame cómo se comparan los diferentes métodos de concatenación de cadenas en términos de instrucciones generadas"
Comparación de la eficiencia de las operaciones std::map y std::unordered_map en ensamblador.
"¿Cómo afectan las diferentes implementaciones de punteros inteligentes a la inserción en línea y al tamaño del código?"
Available Tools
5 toolscompile_codeA
Compile source code using specified compiler and options.
Args:
source: Source code to compile
language: Programming language of the source code
compiler: Compiler name or ID to use
ctx: MCP context for logging and error reporting
options: Compiler flags and options
filters: Configuration for filtering compiler output
libraries: List of library dependencies
Returns:
Dictionary containing compilation results with keys:
- code: Exit code of the compilation
- stdout: Standard output from the compiler
- stderr: Standard error from the compiler
- asm: Generated assembly (if applicable)
Raises:
HTTPException: If compilation fails, compiler not found, or API request fails
Example:
>>> result = await compile_code(
... source="int main() { return 0; }",
... language="cpp",
... compiler="gcc",
... ctx=ctx
... )
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | ||
| language | Yes | ||
| compiler | Yes | ||
| options | No | ||
| filters | No | ||
| libraries | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It does mention that compilation can fail and raises HTTPException, which is useful. However, it doesn't cover important behavioral aspects like whether compilation is synchronous/asynchronous, execution time limits, resource consumption, authentication requirements, or rate limits. The 'Raises' section adds some value but leaves significant gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections (Args, Returns, Raises, Example) and front-loads the core purpose. Every sentence serves a purpose, though the parameter list could be more concise. The example is helpful but adds length. Overall, it's appropriately sized for a complex tool with many parameters.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (6 parameters, no annotations, no output schema), the description does a good job covering the essentials. It explains the purpose, parameters, return structure, and error conditions. The main gaps are behavioral details (execution characteristics, limits) and usage guidance relative to sibling tools. The return value documentation partially compensates for the missing output schema.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema description coverage, the description compensates well by listing all 7 parameters (including 'ctx' not in schema) with brief explanations. It provides meaningful context for each parameter beyond just naming them, especially for 'filters' and 'libraries'. However, it doesn't explain parameter interactions or provide format details for 'language' and 'compiler' values.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with specific verb ('compile') and resource ('source code'), and distinguishes it from sibling tools like 'get_opcode_documentation' or 'list_compilers_for_language' which are informational rather than execution tools. The first sentence directly answers 'what does this tool do?'
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. While it's clear this is for compilation, there's no mention of prerequisites, when to use sibling tools like 'list_compilers_for_language' first, or what scenarios warrant using this tool over other compilation methods. The example shows usage but doesn't provide contextual guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_opcode_documentationB
Get documentation for a specific opcode in a given instruction set. If a user asks about an opcode, but you don't have the instruction set, you can query list_compiler_versions for a specific compiler and it will tell you the instruction set. You are not an expert on opcodes, so if a user asks about an opcode, you should always use this tool!
Args:
instruction_set: Instruction set to search for opcode documentation
opcode: Opcode to search for documentation
Example:
>>> await get_opcode_documentation("amd64", "lea")| Name | Required | Description | Default |
|---|---|---|---|
| instruction_set | Yes | ||
| opcode | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. While it mentions the tool's purpose and usage context, it lacks details on behavioral traits such as error handling, rate limits, authentication needs, or what happens if the opcode is not found. The example shows a successful case but doesn't cover edge cases.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized and front-loaded with the core purpose. The usage guidelines and example are relevant, though the second sentence could be more concise. Overall, most sentences earn their place by providing necessary context and instructions.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (2 parameters, no output schema, no annotations), the description covers purpose and usage well but lacks details on behavioral traits and parameter semantics. It is complete enough for basic use but leaves gaps in understanding how the tool behaves in practice.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It lists the parameters ('instruction_set' and 'opcode') and provides an example with values ('amd64', 'lea'), but does not explain their semantics, valid formats, or constraints beyond the example. This adds minimal value beyond the schema's property names.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Get documentation for a specific opcode in a given instruction set.' It specifies the verb ('Get documentation') and resource ('opcode'), but does not explicitly differentiate from sibling tools like 'list_compiler_versions' beyond mentioning it as a prerequisite step.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides explicit guidance on when to use this tool: 'If a user asks about an opcode, but you don't have the instruction set, you can query list_compiler_versions...' and 'You are not an expert on opcodes, so if a user asks about an opcode, you should always use this tool!' It names an alternative tool ('list_compiler_versions') for prerequisite information and gives a clear rule for usage.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_compilers_for_languageA
Get available compilers for a specific programming language.
Args:
language: Programming language to get compilers for (e.g., 'cpp', 'rust')
Returns:
List of unversioned compiler names available for the language
Raises:
HTTPException: If the API request fails
Example:
>>> await list_compilers_for_language("cpp")
["gcc", "clang", "msvc"]
| Name | Required | Description | Default |
|---|---|---|---|
| language | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It discloses that the tool makes an API request and can raise an HTTPException on failure, adding useful behavioral context. However, it lacks details on rate limits, authentication needs, or pagination behavior, which are relevant for a tool that fetches data.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized and front-loaded, starting with the core purpose, followed by structured sections for Args, Returns, Raises, and an Example. Every sentence adds value without redundancy, making it efficient and easy to parse.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's low complexity (1 parameter, no output schema), the description is mostly complete, covering purpose, input, output, errors, and an example. It could improve by specifying the return format more precisely (e.g., list structure) or mentioning any dependencies, but it adequately supports tool selection and invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema description coverage, the description compensates well by explaining the 'language' parameter's purpose and providing an example with values ('cpp', 'rust'). This adds meaningful semantics beyond the basic schema, though it could further clarify allowed language formats or constraints.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with a specific verb ('Get') and resource ('available compilers for a specific programming language'), distinguishing it from siblings like 'list_compiler_versions' (which focuses on versions) and 'list_languages' (which lists languages).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage context by specifying the input parameter ('language') and providing an example, but does not explicitly state when to use this tool versus alternatives like 'list_compiler_versions' or 'compile_code'. It clearly indicates the tool's scope but lacks explicit exclusions or comparisons.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_compiler_versionsA
Get available compiler versions matching a compiler name regex.
NOTE: This may return a lot of results! Choose a specific regex to narrow down the results and not overflow the MCP client.
Args:
compiler_regex: Regular expression to match compiler names (case-insensitive)
Returns:
List of dictionaries containing matching compiler information, each with keys:
- id: Unique identifier for the compiler
- name: Display name of the compiler
- semver: Version string of the compiler
Raises:
HTTPException: If the API request fails
Example:
>>> await list_compiler_versions("gcc")
[{"id": "gcc-12.2", "name": "GCC 12.2"}, {"id": "gcc-11.3", "name": "GCC 11.3"}]
>>> await list_compiler_versions("clang.*trunk")
[..., {"id": "irclangtrunk", "name": "clang (trunk)", "lang": "llvm", "compilerType": "", "semver": "(trunk)", "instructionSet": "amd64"}, ...]
| Name | Required | Description | Default |
|---|---|---|---|
| compiler_regex | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key traits: it's a read operation (implied by 'Get'), warns about potential large result sets and overflow risks, specifies case-insensitive matching, and mentions error handling with 'Raises: HTTPException'. This covers most behavioral aspects needed for safe use.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with sections for Args, Returns, Raises, and Examples, making it easy to scan. It is appropriately sized, though the example section is slightly verbose with detailed output. Most sentences earn their place by adding value, such as the cautionary note and parameter explanation.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (1 parameter, no output schema, no annotations), the description is largely complete. It covers purpose, usage, parameters, returns, errors, and examples. However, it lacks explicit output schema details, though the Returns section partially compensates. For a tool with no annotations, it provides sufficient context for effective use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 0%, so the description must fully compensate. It adds significant meaning beyond the basic schema by explaining that 'compiler_regex' is a 'Regular expression to match compiler names (case-insensitive)', provides examples of usage, and clarifies its purpose in narrowing results. This fully documents the single parameter's semantics.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with a specific verb ('Get') and resource ('available compiler versions'), and distinguishes it from siblings by focusing on version listing rather than compilation or language-specific listings. It explicitly mentions matching by 'compiler name regex', which adds specificity.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context on when to use this tool (to find compiler versions matching a regex) and includes a cautionary note about narrowing results to avoid overflow, which implies usage guidance. However, it does not explicitly compare to alternatives like 'list_compilers_for_language' or state when not to use it, missing full sibling differentiation.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_languagesA
Get a list of supported programming languages.
Returns:
List of dictionaries containing language information, each with keys:
- id: Unique identifier for the language
- name: Display name of the language
- extensions: List of file extensions associated with the language
Raises:
HTTPException: If the API request fails
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It adds value by describing the return format (list of dictionaries with specific keys) and error handling (raises HTTPException), which goes beyond the basic purpose. However, it doesn't cover aspects like rate limits, authentication needs, or performance characteristics, leaving some behavioral gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured and front-loaded with the core purpose, followed by clear sections for returns and raises. Every sentence adds value: the first states the action, the second details the output format, and the third covers error handling. There is no wasted text, making it highly concise.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is reasonably complete. It explains what the tool does, the return format, and potential errors. However, it lacks usage guidelines and doesn't fully compensate for the absence of annotations by detailing all behavioral aspects, such as side effects or constraints, preventing a perfect score.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has 0 parameters, and the schema description coverage is 100% (as there are no parameters to describe). The description doesn't need to add parameter information, so it appropriately focuses on output and errors. A baseline of 4 is applied since no parameters exist, and the description doesn't attempt to explain non-existent inputs.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with 'Get a list of supported programming languages', which is a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'list_compilers_for_language' or 'list_compiler_versions', which might also involve listing operations. This keeps it from a perfect score of 5.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools or contextual scenarios, such as using it before compilation or for language selection. This lack of explicit when-to-use or when-not-to-use information results in a low score.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
5 tool updates
- First observed
compile_code - First observed
get_opcode_documentation - First observed
list_compiler_versions - First observed
list_compilers_for_language - First observed
list_languages
TDQS
Scored across 5 tools
Each tool has a distinct, non-overlapping purpose: compile_code handles compilation, get_opcode_documentation provides opcode docs, list_compilers_for_language lists compilers by language, list_compiler_versions lists compiler versions, and list_languages lists supported languages. There is no ambiguity in tool selection.
Tools follow a consistent verb_noun pattern (compile_code, get_opcode_documentation, list_compilers_for_language, list_compiler_versions, list_languages), all using snake_case. The minor deviation is that get_opcode_documentation uses 'get' while others use 'list' or 'compile', but this is appropriate for its action and doesn't break consistency.
With 5 tools, this is well-scoped for a compiler exploration server. Each tool serves a clear purpose in the workflow (listing languages/compilers, compiling code, getting documentation), and none feel redundant or missing given the domain.
The toolset covers core compiler exploration tasks: listing languages and compilers, compiling code, and accessing opcode documentation. A minor gap is the lack of tools for managing compilation sessions or saving/loading code snippets, but the provided tools enable basic compilation and exploration workflows without dead ends.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Enable secure connectivity between Sentry issues and debugging data, and LLM clients, using a Model Context Protocol (MCP) server.
The OpenRouter MCP server plugs OpenRouter into the AI tools you already use. Once connected, your assistant can pull live OpenRouter data (models, prices, your credits, rankings, and docs) and send quick test messages, all without leaving your editor.
Related MCP Servers
- AlicenseBqualityFmaintenanceA Model Context Protocol server that enables LLMs to read, search, and analyze code files with advanced caching and real-time file watching capabilities.615 npm39MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables Large Language Models to interact with Binary Ninja for reverse engineering tasks like viewing assembly code, decompiled code, renaming functions, and adding comments.3MIT
- FlicenseAqualityNot gradedmaintenanceA Model Context Protocol server that allows LLMs to interact with Python environments, enabling code execution, file operations, package management, and development workflows.9-
- FlicenseNot gradedqualityDmaintenanceAn 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.-