Claude Code MCP Bridge
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Claude Code MCP Bridgeedit src/index.ts to add error handling"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Claude Code MCP Bridge
A stateless MCP (Model Context Protocol) server that exposes Claude Code's capabilities as individual tools for any MCP-compatible host to consume.
Why This Exists
Claude Code is a powerful coding agent, but its primary interface is an interactive terminal. Hosting it as an MCP server lets any MCP-compatible agent or application invoke Claude Code's file editing, command execution, and test-running capabilities as discrete, composable tools — without pty management, terminal UI, or session lifecycle.
The stateless architecture was a deliberate tradeoff: each tool call spawns a fresh claude -p (print-mode) subprocess instead of maintaining a persistent session. This avoids the fragile prompt-pattern matching, first-run wizards, theme selectors, and pty state management that a persistent session requires. The cost is a ~5s cold-start latency per call; the benefit is zero session-related failures.
Related MCP server: claude-code-mcp
Tools
cc_execute_command
Run arbitrary commands through Claude Code. It handles shell execution, file system operations, package management, and any terminal-compatible task.
Parameter | Type | Description |
| string (required) | The command to execute |
| string (optional) | Working directory (defaults to current) |
| integer (optional) | Max seconds to wait (default 120) |
Returns exit_code, stdout, stderr, and a truncated flag if output exceeded limits.
cc_edit_file
Make targeted edits to files using Claude Code's semantic understanding. Unlike raw sed or regex, this tool identifies the correct location even when indentation or minor formatting varies.
Parameter | Type | Description |
| string (required) | File to edit |
| string (required) | Existing text to replace |
| string (required) | Replacement text |
| string (optional) | Language hint for syntax-aware editing |
Returns success, diff (unified format), syntax_ok, and warnings.
cc_run_tests
Run test commands through Claude Code and receive structured results. Parses test output into summary, failure details, and timing.
Parameter | Type | Description |
| string (required) | Test command to run |
| boolean (optional) | Watch mode (default false) |
Returns summary (total/passed/failed/skipped), failures array, and duration_seconds.
Quick Start
# Prerequisites
# - Python 3.11+
# - Claude Code installed and authenticated (claude command in PATH)
# - OPENAI_API_KEY or ANTHROPIC_API_KEY for Claude Code
git clone https://github.com/alexscarano/claude-code-mcp.git
cd claude-code-mcp
# Option A: uv (recommended)
uv sync
uv run python server.py
# Option B: pip
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python server.py
# Option C: run.sh (auto-detects uv or pip)
./run.shThe server starts in stdio mode, which is the standard transport for MCP. Configure your MCP host to spawn the server as a subprocess.
Configuration
Variable | Default | Notes |
|
| Path to the Claude Code binary |
Set via environment variable:
export CLAUDE_BIN=/path/to/claude
./run.shArchitecture
MCP Host (e.g. Hermes Agent)
│ stdio transport
▼
server.py (FastMCP entry point)
│
├── cc_edit_file → session._run() → claude -p ...
├── cc_execute_command → session._run() → claude -p ...
└── cc_run_tests → session._run() → claude -p ...Each tool call:
Builds a prompt from a template (templates.py)
Forwards it to
claude -p --dangerously-skip-permissionsExtracts the structured
<mcp-result>response from stdoutReturns a validated dictionary to the caller
Note: The
<mcp-result>wrapping ensures the MCP host receives structured JSON rather than conversational text. Claude Code is instructed to emit only this tagged block, andextract_resultparses it with a regex pattern.
Constraints
Cold start: Each call spawns a fresh subprocess (~5s overhead). Not suited for high-frequency invocation.
Permission model: Uses
--dangerously-skip-permissions. The tool's host is responsible for access control — review what commands are sent to the server.Timeout handling: The server imposes a configurable per-call timeout (default 120s). Long-running commands may need adjustment.
Prompt size: Very large prompts (100KB+) increase processing time. The prompt is passed as a CLI argument, constrained by
ARG_MAX(typically 2MB on Linux).
When to Use This vs Direct Claude Code
Use this bridge when:
Your primary agent needs occasional code modifications or analysis
You want composable tool invocations (call edit, then test, then commit)
You run in an environment where maintaining a persistent pty is impractical
You need structured, machine-parseable responses
Use Claude Code directly when:
You need an interactive coding session with back-and-forth
Latency per operation must be under 1 second
You want the full Claude Code TUI experience
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
One MCP endpoint for Claude, GPT & Gemini: 100+ tools + no-code connectors + agent workers.
Claude Code / MCP skills for the dev pipeline: discover, spec, design, build, ship, operate.
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
Give any MCP-compatible AI assistant a builder for live, hosted web tools and workflows.
Related MCP Servers
- AlicenseAqualityCmaintenanceLocal MCP server that wraps the headless Claude Code CLI as MCP tools, providing stateless access to Claude's coding capabilities through prompt-based interactions. It enables users to execute Claude Code commands with various prompt formats and structured outputs directly from MCP clients.3MIT
- AlicenseAqualityDmaintenanceWraps Claude Code as tools for MCP clients, enabling autonomous coding tasks via a 4-tool lifecycle with session management, async polling, and permission controls.443 npm20MIT
- AlicenseNot gradedqualityDmaintenanceEnables MCP clients to spawn and control Codex CLI and Claude Code sessions on the host machine, with session management and filesystem access.4MIT
- AlicenseAqualityDmaintenanceWraps Anthropic Claude Code CLI as tools, allowing MCP clients to invoke headless Claude Code sessions.2945 npmMIT