MCP Hub
Back to servers

claudecode-mcp

Local 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.

glama
Updated
Apr 19, 2026

claudecode-mcp

Local stdio MCP server that wraps the headless Claude Code CLI as MCP tools. Stateless, spawn-per-client.

Tools

  • claude_prompt { prompt, model?, system_prompt? }
  • claude_prompt_with_context { prompt, context?, files?, model?, system_prompt? }
  • claude_prompt_structured { prompt, schema, model?, system_prompt? } — uses claude --json-schema; fails loudly if the installed CLI lacks that flag.

Build

npm install
npm run build
node dist/server.js

Register

Claude Code (~/.claude/mcp.json):

{
  "mcpServers": {
    "claudecode": {
      "command": "node",
      "args": ["/home/trevor/claudecode-mcp/dist/server.js"]
    }
  }
}

Test live

npm run test:live

Runs tiny real prompts against claude. Skipped unless CLAUDECODE_MCP_LIVE=1.

Design notes

  • No session tracking. No session_id in tool inputs. --no-session-persistence always.
  • No working_dir parameter. Uses process.cwd() of the MCP server process.
  • No timeout enforcement. Trusts CLI-native turn limits.
  • Argv array spawning — never shell-interpolated.
  • Sanitized child env: NO_COLOR=1, inherited PATH/HOME/auth.
  • --bare is intentionally NOT used: it disables OAuth/keychain reads and would force ANTHROPIC_API_KEY. The MCP inherits whatever auth the user's claude CLI is already configured with (OAuth, keychain, or env key).

Reviews

No reviews yet

Sign in to write a review