Skip to main content
Glama
torshepherd

Compiler Explorer MCP

by torshepherd

Compiler Explorer MCP

A Model Context Protocol (MCP) server that connects LLMs to the Compiler Explorer API, enabling them to compile code, explore compiler features, and analyze optimizations across different compilers and languages.

Example Questions

Here are some interesting questions you can ask your LLM using this MCP:

Compiler Feature Exploration

  • "What is the earliest version of GCC that supports the #embed directive?"

  • "Show me how different versions of Clang handle C++20 modules"

  • "What optimization flags are available in Clang 12 that weren't in Clang 11?"

  • "Can you demonstrate how MSVC and GCC handle C++20 coroutines differently?"

Optimization Analysis

  • "What's the assembly difference between -O2 and -O3 for a simple recursive Fibonacci function in GCC 13?"

  • "How does Clang's vectorization compare to GCC's for a basic matrix multiplication?"

  • "Show me how different optimization levels affect tail-call optimization in this recursive function"

  • "What's the impact of -ffast-math on this floating-point heavy computation?"

Language Feature Support

  • "Which C++20 features are supported in the latest versions of GCC, Clang, and MSVC?"

  • "Show me how different compilers implement std::optional's memory layout"

  • "Compare how GCC and Clang handle C++20's constexpr virtual functions"

  • "Demonstrate the differences in how Intel and GCC compilers auto-vectorize SIMD operations"

Assembly Deep Dives

  • "What's the most efficient way to implement a population count in x86 assembly across different CPU architectures?"

  • "Show me how different compilers optimize a simple string reverse function at -O3"

  • "Compare the assembly output of a virtual function call vs a normal function call"

  • "How do different compilers implement std::variant's type switching in assembly?"

Cross-Language Comparison

  • "Compare the generated assembly for the same algorithm in C++, Rust, and Go"

  • "How do exception handling mechanisms differ between C++ and Rust in terms of generated code?"

  • "Show me the overhead of Rust's bounds checking compared to unchecked C++ array access"

  • "Compare how C++ and D implement RAII in terms of generated assembly"

Performance Investigation

  • "What's the assembly-level difference between using std::sort and a hand-written quicksort?"

  • "Show me how different string concatenation methods compare in terms of generated instructions"

  • "Compare the efficiency of std::map vs std::unordered_map operations in assembly"

  • "How do different smart pointer implementations affect inlining and code size?"

Available Tools

5 tools
compile_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
    ... )
ParametersJSON Schema
NameRequiredDescriptionDefault
sourceYes
languageYes
compilerYes
optionsNo
filtersNo
librariesNo

TDQS

A3.7/5.0
Behavior3/5

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.

Conciseness4/5

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.

Completeness4/5

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.

Parameters4/5

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.

Purpose5/5

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.

Usage Guidelines2/5

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")
ParametersJSON Schema
NameRequiredDescriptionDefault
instruction_setYes
opcodeYes

TDQS

B3.4/5.0
Behavior2/5

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.

Conciseness4/5

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.

Completeness3/5

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.

Parameters2/5

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.

Purpose4/5

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.

Usage Guidelines5/5

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"]
ParametersJSON Schema
NameRequiredDescriptionDefault
languageYes

TDQS

A4.2/5.0
Behavior3/5

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.

Conciseness5/5

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.

Completeness4/5

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.

Parameters4/5

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.

Purpose5/5

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.

Usage Guidelines4/5

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"}, ...]
ParametersJSON Schema
NameRequiredDescriptionDefault
compiler_regexYes

TDQS

A4.4/5.0
Behavior4/5

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.

Conciseness4/5

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.

Completeness4/5

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.

Parameters5/5

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.

Purpose5/5

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.

Usage Guidelines4/5

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
ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.5/5.0
Behavior3/5

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.

Conciseness5/5

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.

Completeness4/5

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.

Parameters4/5

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.

Purpose4/5

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.

Usage Guidelines2/5

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.

TDQS

A3.9/5.0
Disambiguation5/5

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.

Naming Consistency4/5

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.

Tool Count5/5

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.

Completeness4/5

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

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A 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.
    3
    MIT
  • -
    license
    A
    quality
    Not graded
    maintenance
    A Model Context Protocol server that allows LLMs to interact with Python environments, enabling code execution, file operations, package management, and development workflows.
    9
  • F
    license
    Not graded
    quality
    D
    maintenance
    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.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/torshepherd/compiler-explorer-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server