Expose Compiler Explorer's compile, list, shortlink and asm-docs APIs via
a Model Context Protocol (MCP) endpoint mounted at /mcp. This lets
MCP-aware clients (Claude, etc.) drive CE directly as a tool, including:
- compile: compile source and return assembly / stdout / stderr, with
optional execution
- list_languages / list_compilers / list_libraries
- generate_short_url / get_shortlink_info: round-trip CE shortlinks,
returning full URLs derived from the incoming request
- lookup_asm_instruction: query the asm-docs database
Implementation:
- New lib/mcp/ module wiring @modelcontextprotocol/sdk into the existing
Express router via StreamableHTTPServerTransport
- Refactor StorageBase static helpers (encodeBuffer, isCleanText,
getSafeHash) to module-level functions so MCP tools can build shortlink
hashes without instantiating a storage backend
- Expose ApiHandler.compileHandler and split out getAvailableLanguages()
so MCP can reuse the same code paths the REST API uses
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>