Skip to main content
Glama

Compiler Explorer MCP

by torshepherd

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault

No arguments

Schema

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Tools

Functions exposed to the LLM to take actions

NameDescription
list_languages

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
list_compilers_for_language

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"]
list_compiler_versions

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"}, ...]
compile_code

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 ... )
get_opcode_documentation

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")

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