Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Experimental official ce-mcp

License

NotificationsYou must be signed in to change notification settings

compiler-explorer/ce-mcp

Repository files navigation

A Model Context Protocol (MCP) server that provides efficient access to Compiler Explorer (godbolt.org) compilation and execution services.

Features

  • Token-efficient responses - Minimized output while preserving essential information
  • Use-case driven tools - Specific functions for common compilation scenarios
  • Smart filtering - Context-aware output filtering based on the task
  • Comprehensive language support - C++, C, Rust, Go, Python, and more
  • Claude Code integration - Automated setup for Claude Code workflows

Quick Start (Claude Code Users)

If you're using Claude Code, simply run:

git clone https://github.com/compiler-explorer/ce-mcpcd ce-mcp./setup-claude-code.sh

This will automatically install and configure everything. That's it!

Quick Setup

Prerequisites

  • Python 3.10+ - Required for running the MCP server
  • UV - Fast Python package manager (recommended)

1. Install UV (if not already installed)

curl -LsSf https://astral.sh/uv/install.sh| sh

Or on macOS with Homebrew:

brew install uv

2. Clone and Setup

# Clone the repositorygit clone https://github.com/compiler-explorer/ce-mcpcd ce-mcp# Option A: Quick setup (Linux/macOS)./setup.sh# Option B: Manual setupuv venvsource .venv/bin/activate# On Windows: .venv\Scripts\activateuv pip install -e".[dev]"

3. Run Tests (Optional)

# Run unit tests.venv/bin/pytest tests/ -m"not integration"# Run integration tests (requires internet).venv/bin/pytest tests/ -m integration# Run all tests.venv/bin/pytest tests/

4. Start the MCP Server

# Basic usagece-mcp# With custom configurationce-mcp --config~/.config/ce-mcp/config.yaml# With verbose loggingce-mcp --verbose

Available Tools

The server provides 12 specialized MCP tools for compilation, analysis, and sharing. Seedocs/available_tools.md for detailed documentation of each tool.

Core Tools:

  • compile_check_tool - Syntax validation
  • compile_and_run_tool - Compile and execute
  • compile_with_diagnostics_tool - Error analysis

Analysis Tools:

  • analyze_optimization_tool - Assembly optimization analysis
  • compare_compilers_tool - Compiler comparison
  • lookup_instruction_tool - Assembly instruction documentation

Discovery & Sharing:

  • generate_share_url_tool - Create Compiler Explorer URLs
  • find_compilers_tool - Find compilers with filtering
  • get_libraries_tool - List available libraries
  • get_library_details_tool - Library information
  • get_languages_tool - List supported languages
  • download_shortlink_tool - Download shared code

Configuration

Create a configuration file at~/.config/compiler_explorer_mcp/config.yaml:

compiler_explorer_mcp:api:endpoint:"https://godbolt.org/api"timeout:30defaults:language:"c++"compiler:"g132"output_limits:max_stdout_lines:100max_stderr_lines:50

Development

Setting up for Development

# Install with development dependenciesuv pip install -e".[dev]"# Run tests.venv/bin/pytest tests/# Run integration tests (requires internet).venv/bin/pytest tests/ -m integration# Format codeblack.isort.# Type checkingmypy ce_mcp/# Code quality checksuv run black ce_mcp/ tests/isort ce_mcp/ tests/

Alternative: Traditional pip setup

If you prefer using pip instead of UV:

# Create virtual environmentpython3 -m venv .venvsource .venv/bin/activate# On Windows: .venv\Scripts\activate# Install dependenciespip install -e".[dev]"# Run the serverpython -m ce_mcp.cli

Troubleshooting

Common Issues

"command not found: ce-mcp"

  • Make sure your virtual environment is activated
  • Try running directly:python -m ce_mcp.cli

"ModuleNotFoundError: No module named 'packaging'"

  • Install missing dependency:uv pip install packaging
  • Or reinstall with all dependencies:uv pip install -e .

"ModuleNotFoundError: No module named 'ce_mcp'"

  • Install in development mode:uv pip install -e .
  • Check your virtual environment is activated

Integration tests failing

  • Tests require internet access to godbolt.org
  • Some tests may be skipped if the API is temporarily unavailable
  • Run unit tests only:pytest tests/ -m "not integration"

"uv not found"

  • Install UV:curl -LsSf https://astral.sh/uv/install.sh | sh
  • Or use pip:pip install -e ".[dev]"

Configuration

Create~/.config/ce-mcp/config.yaml for custom settings:

compiler_explorer_mcp:api:timeout:30defaults:language:"c++"compiler:"g132"output_limits:max_stdout_lines:50

License

BSD-2-Clause

About

Experimental official ce-mcp

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp