claudecode-mcp
Summary: This schema exposes only a legacy one-shot/stateless Claude Code prompt interface—not the 2.0 async task-runner features described in the README.
Run a single headless prompt and get the model's text response.
Pass an optional model alias/full name and system prompt.
Prepend free-form context and/or file contents before the prompt.
Request structured JSON output, optionally guided and loosely validated by a JSON Schema.
Work only in the server process's current working directory.
Cannot start/track/steer durable tasks, use worktrees, wait, page events, get diffs, cancel/close tasks, resume sessions, or use repo URLs—those README capabilities are absent from this schema.
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., "@claudecode-mcp claude_prompt_structured write a Python function to calculate factorial with schema validation"
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.
claudecode-mcp
An MCP server that runs Claude Code as an async task runner. Any MCP client can hand coding work or a review to Claude Code, track progress, steer it, and collect the result.
Each task runs in its own git worktree and branch (or in place).
Tasks are persistent sessions: they survive an MCP server restart and can be resumed later or taken over by hand with
claude --resume.Several tasks run in parallel, up to a cap; the rest wait in a queue.
A blocking
asktool gives quick, read-only reviews and answers.
The design and its decisions are in docs/DESIGN-v2.md.
2.0 replaces the old 1.x one-shot claude_prompt* tools. It is installed
from source; it is not published to npm.
Requirements
macOS or Linux. No Windows.
Node 22 or newer.
The
claudeCLI, version 2.1.287 or newer, on yourPATHand logged in (claude auth status). A Pro or Max subscription login works; so do API keys and cloud providers. The server uses theclaudelogin you already have.gitfor worktree tasks.gh(optional) forclose_taskdraft PRs.
Related MCP server: claude-bridge-mcp
Install
From source:
git clone https://github.com/trevoraspencer/claudecode-mcp.git
cd claudecode-mcp
npm ci
npm run buildRegister it with your MCP client, using the absolute path to dist/cli.js.
For Claude Code:
claude mcp add claudecode -- node /absolute/path/to/claudecode-mcp/dist/cli.jsOr in a client's JSON config:
{
"mcpServers": {
"claudecode": {
"command": "node",
"args": ["/absolute/path/to/claudecode-mcp/dist/cli.js"]
}
}
}Optional: npm link in the clone puts a claudecode-mcp command on your
PATH. After git pull, run npm ci && npm run build again.
HTTP mode (for a server on your tailnet)
claudecode-mcp --http serves the same tools over HTTP instead of stdio.
It listens on 127.0.0.1:8787 only, so put
tailscale serve in front of it to
reach it from other machines. Every request needs a bearer token; make one
per client device:
claudecode-mcp token add macbook # prints the token once
claudecode-mcp token list
claudecode-mcp token revoke macbook # takes effect at once(Without npm link, run node dist/cli.js token ... and
node dist/cli.js --http from the clone.)
Add the server's tailnet name to http.allowed_hosts (see Configuration).
Standing the server up on a Proxmox VM (systemd, Tailscale, tokens) is
docs/DEPLOY-proxmox.md. Registering that VM on
a dev machine, next to a local stdio install, is design step N5.
Tools
Tool | What it does |
| Start Claude Code on a task in |
| Status, last result, usage, rate-limit summary, recent steps, queue position, and a take-over command. |
| Wait (up to 50 s per call) until the current turn ends. Call again to keep waiting. |
| Page through the compact transcript with a byte cursor. |
| Message a task. During a turn it joins that turn; |
| Commits, diff stat, new files, and the diff (capped at 200 KiB) since the task's base commit. |
| Stop the task. Its session can be resumed later. |
| Finish a task: |
| Task summaries, newest first, filtered by |
| Blocking question or review (up to 600 s). Read-only by default (plan mode, file-writing tools blocked). Without |
A typical flow: start_task → wait_task (loop) → get_diff →
send_message to steer → close_task with push_pr.
Task states
queued → starting → running ⇄ idle → closing → closed, plus
stalled (no events for stall_minutes, still alive), interrupted
(runner gone, e.g. after a reboot; a message resumes it), failed,
timed_out, cancelled, and rate_limited.
Taking over by hand
get_task returns a ready command, for example:
cd '/repo/.claude/worktrees/t1a2b3c4d5e' && claude --resume 6f1c…Cancel the task first if its runner is still active, so two processes never drive one session.
Repos by URL
A server can also take a git URL instead of a local path, so callers on other machines can hand it work on repos it does not have yet. Turn it on with an allowlist in the config:
{
"workspaces_dir": "~/claudecode-workspaces",
"repo_urls": ["https://github.com/your-name/*", "git@github.com:your-name/*"]
}start_task and ask then accept repo_url (exactly one of repo or
repo_url). The server keeps one clone per repo at
<workspaces_dir>/<scheme>_<host>/<owner>/<repo>.git and fetches it before
each task.
base_ref defaults to the remote's default branch; a branch name means the
remote branch. repo_url tasks always get a worktree. Accepted URL forms:
https://host/owner/repo, ssh://user@host/owner/repo, and
user@host:owner/repo; * in a pattern matches within one path segment.
Results come back through get_diff and close_task with push_pr,
which opens the draft PR against the branch the task started from. When the
server has GH_TOKEN in its environment, it uses that token for the push
and the PR; tasks never get it, so Claude itself cannot push.
claudecode-mcp prune-workspaces [--dry-run] [--force] removes clones that
no open task uses. It only touches clones it made, and keeps a clone with
unpushed local commits, a stash, or loose files unless --force.
Configuration
Optional file: ~/.config/claudecode-mcp/config.json (or
$XDG_CONFIG_HOME/claudecode-mcp/config.json, or the path in
CLAUDECODE_MCP_CONFIG). Without it, the defaults below apply. The file is
strict: unknown keys or bad values stop the server at startup with a clear
error.
{
"allowed_roots": ["~/code"],
"max_concurrent": 3,
"max_minutes": 120,
"stall_minutes": 10,
"idle_minutes": 15,
"max_events_mb": 100,
"default_profile": "worker",
"profiles": {
"worker": {
"permission_mode": "auto",
"setting_sources": ["project", "local"],
"mcp_servers": {},
"personal_skills": ["commit-style"]
},
"reviewer-clean": {
"permission_mode": "auto",
"setting_sources": ["project"],
"skills": false
}
}
}Key | Default | Meaning |
| your home folder | Repos must be inside one of these (checked by real path). |
| 3 | Turns running at once; more tasks wait as |
| 120 | Cap per turn. Idle time does not count. |
| 10 | Flag a turn as |
| 15 | Keep an idle |
| 100 | Cap on a task's transcript; reaching it stops the task. |
|
| HTTP mode listen address. Loopback only ( |
| 8787 | HTTP mode port. |
|
| MCP endpoint path. |
|
| Extra |
|
| Browser origins to accept. Requests with any other |
|
| Per-device token hashes (mode 0600). |
|
| Managed clones for |
|
| Allowlist of URL patterns for |
Profiles
A profile decides how the child Claude Code is set up, separate from your
personal setup. The default worker profile uses auto permission mode, no
MCP servers, and the target repo's own settings, hooks, skills, and
CLAUDE.md.
Field | Effect |
|
|
| Which settings load: |
| A settings file path or an inline settings object. |
| The exact MCP servers for the child. This server is never allowed. |
| Use your own MCP servers too. |
| Block tools, or allow only these built-in tools. |
| Load these plugin folders. |
|
|
| Chosen hooks from your |
| Chosen skills from |
| A fully separate Claude home (needs its own login). |
| Defaults for the child. |
Run claudecode-mcp list-personal-config to see your hooks (with indexes)
and skills.
Safety model
Permissions:
automode lets a safety check decide each action and blocks high-risk ones (seeclaude auto-mode defaults). Nothing ever waits for a person: anything that would prompt is denied and reported inpermission_denials.Repo URLs: only URLs matching
repo_urlsare cloned; other schemes (ext::,http://,git://,file://), credentials in URLs, and option-like values are refused, and git may only use https and ssh.Isolation: worktree tasks never touch your main checkout. Worktrees are excluded from your
git status.No recursion: the child gets
CLAUDECODE_MCP_DEPTH; a nested server refuses to start tasks, and profiles cannot reset that marker.Environment: the child gets an explicit allowlist of variables, never your whole environment. Host-session variables are never passed.
HTTP mode: loopback only, a per-device bearer token on every request (checked in constant time; only hashes are stored), Host and Origin checks, and an 8 MiB body cap. Anyone with a token can run Claude Code on that machine, so give each device its own token and revoke lost ones.
Data: task state lives in
~/.local/state/claudecode-mcp(mode 0700). Errors sent to clients are redacted.
State on disk
~/.local/state/claudecode-mcp/ ($XDG_STATE_HOME, or CLAUDECODE_MCP_STATE_DIR)
tasks/<task-id>/task.json status, session, workspace, result, usage
tasks/<task-id>/events.jsonl full stream-json transcript
tasks/<task-id>/runner.log the runner's own log
sessions/<session-id>.lock one process per sessionEach task has a detached runner process, so tasks keep running when the MCP server restarts. A restarted server finds them on disk.
Environment variables
Variable | Use |
| Config file path. |
| State folder (keep it short: socket paths are limited to 103 bytes). |
| Path to the |
| Path to the |
| Comma-separated extra variables to pass to the child. |
|
|
| Queue dispatcher interval (default 2000). |
|
|
| HTTP mode: how long SIGTERM waits for in-flight requests (default 10000). |
| Structured debug logs on stderr. |
Troubleshooting
claude CLI ... is too old: update Claude Code to 2.1.287 or newer.claude started in permission mode "default", not "auto":automode needs sonnet or opus. Pick one of those models, or abypassPermissionsprofile.repo is outside allowed_roots: add the folder toallowed_roots.not a git repository: passisolation: "in_place".A task shows
interrupted: its runner stopped (reboot, crash). Send it a message to resume.Runner problems: see
tasks/<id>/runner.login the state folder.
Development
npm install
npm run format:check && npx tsc --noEmit && npm test
npm run test:live # tiny real prompts; needs a logged-in claudeOffline tests use a fake claude that emits stream-json. See
AGENTS.md for invariants and conventions, and
CONTRIBUTING.md for pull requests.
License
MIT
Available Tools
3 toolsclaude_promptA
Run a one-shot prompt against the Claude Code CLI in headless, stateless mode (no session persistence, no resume). Returns the model's text response. Uses the server process's current working directory.
Inputs: prompt (required), model, system_prompt.
claude_prompt_structuredA
Run a one-shot prompt against the Claude Code CLI in headless, stateless mode and return a structured JSON object. If schema (a JSON Schema) is provided, the tool instructs the model to conform to it and validates the parsed output against the schema (basic type/required-field checks). Returns the parsed JSON as the tool response content. Uses the server process's current working directory.
Inputs: prompt (required), schema, model, system_prompt.
claude_prompt_with_contextA
Run a one-shot prompt against the Claude Code CLI in headless, stateless mode, with additional free-form context and/or file contents prepended to the prompt. Returns the model's text response. Uses the server process's current working directory; file paths are resolved relative to cwd.
Inputs: prompt (required), context, files, model, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
The three tools have clearly distinct purposes: one returns plain text, one returns structured JSON, and one accepts additional context/files. However, the core functionality of running a one-shot prompt is identical across all three, which could cause minor confusion about when to use each variant.
All tool names follow a perfect 'claude_prompt_' prefix pattern with descriptive suffixes (_structured, _with_context). The naming is completely consistent and predictable, making it easy to understand the tool hierarchy at a glance.
Three tools is reasonable for a Claude Code CLI interface, covering the main variations needed (text, structured, contextual). However, this feels slightly minimal - additional tools for session management or configuration might be expected but aren't strictly necessary for the stated headless, stateless approach.
The tools cover the basic prompt execution variations well, but there are notable gaps for a complete Claude Code CLI surface. Missing operations include session management (contradicting the stateless approach), model selection, parameter tuning, streaming responses, and error handling tools that would be expected for production use.
Maintenance
Related MCP Connectors
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Augments MCP Server - A comprehensive framework documentation provider for Claude Code
MCP server for Clipkit — gives AI agents a video toolbox via the Clipkit schema.
Related MCP Servers
- AlicenseBqualityDmaintenanceAn implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.825 npm188MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that exposes your local Claude Code CLI over HTTP+SSE, enabling any MCP-compatible client to use your Claude Code MAX/PRO subscription remotely.14 npm2MIT
- AlicenseNot gradedqualityBmaintenanceMCP server that wraps AI CLI tools — Claude Code, Antigravity CLI, and Codex CLI — so any MCP client can call them as tools.401 npm21MIT
- FlicenseAqualityDmaintenanceProvides a secure interface to run Anthropic's Claude Code CLI as an MCP server, enabling task execution, persistent memory, and integration with MCP-enabled IDEs.12-