Skip to main content
Glama
Claude Code MCP Server

Claude Code MCP Server

by pandysp

Claude Code MCP Server

npm CI

MCP server that runs Claude Code as a tool -- with session continuity.

Provides two tools via the Model Context Protocol:

  • claude_code -- Run Claude Code in one-shot mode with any prompt

  • claude_code_reply -- Continue a previous conversation by thread ID

Both tools parse structured JSON output from the CLI, returning session_id for threading and is_error for error detection. A 30-minute execution timeout prevents runaway processes.

Quick Start

npx @pandysp/claude-code-mcp@latest

Requires Node.js 20+ and the Claude CLI installed locally.

First-time setup

Accept the CLI permissions once before the MCP server can use them:

npm install -g @anthropic-ai/claude-code
claude --dangerously-skip-permissions

Related MCP server: Sub-Agents MCP Server

Configuration

Add to your MCP client config:

Claude Desktop / Cursor

{
  "mcpServers": {
    "claude-code-mcp": {
      "command": "npx",
      "args": ["-y", "@pandysp/claude-code-mcp@latest"]
    }
  }
}

Windsurf

{
  "mcpServers": {
    "claude-code-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@pandysp/claude-code-mcp@latest"]
    }
  }
}

OpenClaw (Docker)

When running inside a Docker container (e.g., as an OpenClaw MCP adapter server), use the container's node binary directly instead of npx:

{
  "command": "node",
  "args": ["/path/to/dist/server.js"]
}

Tools Reference

claude_code

Run Claude Code with a one-shot prompt.

Parameter

Type

Required

Description

prompt

string

yes

The prompt to send to Claude Code

workFolder

string

no

Absolute path to the working directory

Returns the CLI result text. If the CLI outputs JSON with a session_id, the response includes structuredContent.threadId for use with claude_code_reply.

claude_code_reply

Continue a previous Claude Code conversation.

Parameter

Type

Required

Description

threadId

string

yes

Session ID from a previous call

prompt

string

yes

Follow-up prompt

workFolder

string

no

Should match the original call's working directory

Uses --resume <threadId> under the hood to maintain conversation context.

Environment Variables

Variable

Default

Description

CLAUDE_CLI_NAME

claude

Override the CLI binary name or absolute path

MCP_CLAUDE_DEBUG

false

Enable verbose debug logging to stderr

CLAUDE_CLI_NAME supports simple names (looked up in PATH) or absolute paths. Relative paths are rejected.

Development

npm install
npm run build
npm run test:unit    # 100 unit tests, fully mocked
npm run dev          # dev mode with tsx

Attribution

Originally forked from @steipete/claude-code-mcp.

License

MIT

Available Tools

2 tools
claude_codeA

Claude Code Agent: Your versatile multi-modal assistant for code, file, Git, and terminal operations via Claude CLI. Use workFolder for contextual execution.

• File ops: Create, read, (fuzzy) edit, move, copy, delete, list files, analyze/ocr images, file content analysis └─ e.g., "Create /tmp/log.txt with 'system boot'", "Edit main.py to replace 'debug_mode = True' with 'debug_mode = False'", "List files in /src", "Move a specific section somewhere else"

• Code: Generate / analyse / refactor / fix └─ e.g. "Generate Python to parse CSV→JSON", "Find bugs in my_script.py"

• Git: Stage ▸ commit ▸ push ▸ tag (any workflow) └─ "Commit '/workspace/src/main.java' with 'feat: user auth' to develop."

• Terminal: Run any CLI cmd or open URLs └─ "npm run build", "Open https://developer.mozilla.org"

• Web search + summarise content on-the-fly

• Multi-step workflows (Version bumps, changelog updates, release tagging, etc.)

• GitHub integration Create PRs, check CI status

• Confused or stuck on an issue? Ask Claude Code for a second opinion, it might surprise you!

Prompt tips

  1. Be concise, explicit & step-by-step for complex tasks. No need for niceties, this is a tool to get things done.

  2. For multi-line text, write it to a temporary file in the project root, use that file, then delete it.

  3. If you get a timeout, split the task into smaller steps.

  4. Seeking a second opinion/analysis: If you're stuck or want advice, you can ask claude_code to analyze a problem and suggest solutions. Clearly state in your prompt that you are looking for analysis only and no actual file modifications should be made.

  5. If workFolder is set to the project path, there is no need to repeat that path in the prompt and you can use relative paths for files.

  6. Claude Code is really good at complex multi-step file operations and refactorings and faster than your native edit features.

  7. Combine file operations, README updates, and Git commands in a sequence.

  8. Claude can do much more, just ask it!

Inputs: prompt (required), workFolder.

claude_code_replyA

Continue a Claude Code conversation by providing the thread ID and a new prompt. Use this to send follow-up instructions that build on prior context from a previous claude_code call. If the original call used a workFolder, provide the same workFolder here to maintain execution context.

Inputs: prompt (required), threadId (required), workFolder.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 2 tools

    Disambiguation4/5

    The two tools have distinct roles: `claude_code` starts a new delegated task, while `claude_code_reply` continues an existing thread. There is little direct misselection risk, though `claude_code` is an intentionally broad catch-all.

    Naming Consistency5/5

    Both names use consistent snake_case and share the `claude_code` prefix, with `_reply` clearly indicating the continuation variant. The convention is predictable despite there being only two tools.

    Tool Count3/5

    A two-tool surface is borderline thin for a server advertising file, code, Git, terminal, web, GitHub, and multi-step workflow capabilities. The reply tool earns its place, but the main tool is heavily overloaded.

    Completeness4/5

    The catch-all tool claims broad coverage across files, Git, terminal, web, and GitHub operations, and the reply tool supports conversational follow-up. However, explicit session status, cancellation, or thread listing operations are absent.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers