Claude Code MCP Server
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| CLAUDE_BIN | No | Path or name of the Claude Code CLI binary. | claude |
| CLAUDE_MCP_CWD | No | Directory the CLI runs in. claude --cloud packages this tree, and workspace trust is resolved from it. A relative path is resolved at startup. The path must exist and be a directory. | process working directory |
| CLAUDE_MCP_PYTHON | No | Python 3 interpreter used to allocate the pseudo-terminal for create. | python3 |
| CLAUDE_MCP_TRUST_CWD | No | 1, true, or yes lets create accept Claude Code's workspace-trust dialog for CLAUDE_MCP_CWD only (the process working directory when that is unset). 0, false, no, or unset leaves the dialog unanswered and the call fails with WORKSPACE_NOT_TRUSTED. | |
| CLAUDE_MCP_TIMEOUT_MS | No | Hard timeout for each spawned CLI process, in milliseconds (positive integer). On timeout the process gets SIGTERM, then SIGKILL 5 s later. | 300000 |
| CLAUDE_CLOUD_ENVIRONMENT_ID | No | Default cloud environment id (for example ccpool_...), passed as --environment when a call does not pass environment_id. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
Starts and drives Claude Code cloud sessions, and, when CLAUDE_MCP_LOCAL_ROOTS is set, local headless runs. Requires the Claude Code CLI on this machine, installed with npm install -g @anthropic-ai/claude-code and signed in by running claude once (claude_auth_status checks this). CLI_NOT_FOUND and CLI_NOT_SIGNED_IN errors say which step is missing.
claude_create_cloud_session returns within a few seconds. When its status is not done, the session is still being prepared in the background: call claude_get_session with the returned job_id every few seconds until job.status is done (session_id and session_url are then set) or the call returns an error. Job ids are kept in this server's memory only. claude_cancel_session stops a job that is stuck; it stops only processes on this machine, and a cloud session that was already created keeps running.
claude_run_local runs Claude Code on this machine in a checkout under CLAUDE_MCP_LOCAL_ROOTS, for work that needs the local toolchain. It also returns a job_id: poll claude_get_session until local_job.status is done, then read result, files and session_id; pass that session_id as resume to continue.
claude_usage reports how much of the Claude plan's usage allowance is used, per window, with reset times. It costs nothing to call. Check it before starting several sessions, and when a window is close to 100% schedule new work after its resets_at instead of retrying into the limit. When the operator sets CLAUDE_MCP_USAGE_STOP_PERCENT, create and claude_run_local refuse with USAGE_LIMIT_NEAR above it.
Check results with claude_get_session, which reports the branch a session pushed and any pull request it opened; the conversation and replies are only visible at the session's session_url.
If a cloud session can't push its branch to GitHub (claude_get_session finds no branch, or the session says the push failed), don't wait for it to retry. Use claude_send_followup to ask it to print its changes as a patch: preferably git format-patch origin/<base>..HEAD --stdout against the base branch, otherwise a full unified git diff that includes new files. Copy the patch from the session_url, apply it to your own checkout (git am, or git apply --3way), run the tests, then commit, push and open or update the pull request yourself.
Report problems with this server as GitHub issues at https://github.com/sohampatwardhan/claude-code-mcp-server/issues, using your own GitHub access. Report a tool result that looks wrong for what happened: an error code that doesn't fit, an unexpected CLI_EXIT_NONZERO or CLI_TIMEOUT, parsed false on output that did name a session, a job that never finishes, or a CLI prompt or message the server didn't recognise. Search open issues first and comment on a match instead of opening a duplicate. Title it fix: <what went wrong> (or feat: <what is missing>), and include the tool name and arguments, the error code and message, cli.exit_code and the relevant lines of cli.stdout and cli.stderr, the server version from serverInfo, the host OS, what you expected, and whether it happens again. Before posting, remove tokens, credentials, email addresses, and private repository names, paths and code; the issue tracker is public. Don't file issues for problems in the session's own work (failing tests, a wrong change), or for an error whose message already says what to do (CLI_NOT_FOUND, CLI_NOT_SIGNED_IN, WORKSPACE_NOT_TRUSTED, REPO_NOT_ALLOWED) unless doing that didn't help.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| claude_create_cloud_sessionA | Create a new Claude Code cloud session via |
| claude_send_followupA | Queue a follow-up message into an existing Claude Code cloud session via |
| claude_get_sessionA | With a job id from claude_create_cloud_session, report that create's progress in |
| claude_cancel_sessionA | Stop a claude_create_cloud_session job or claude_run_local job that is still running: every process it started on this machine (git, the pty helper, claude --cloud or claude -p) gets SIGTERM, then SIGKILL 5 s later. Pass the job_id, or for a create job the session id or URL it already printed. Waits up to about 6 s for the processes to exit and reports |
| claude_run_localA | Run Claude Code headless on this machine ( |
| claude_usageA | Report how much of the Claude plan's usage allowance is used: each window (the rolling session window, weekly windows, model- or surface-scoped ones) with its percent, reset time and severity, plus usage-credit spend. Runs print-mode |
| claude_auth_statusA | Report whether the local Claude Code CLI is signed in, via |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 7 tools
Each tool has a largely distinct role: create cloud session, run local job, send follow-up, cancel, usage, auth. The main soft spot is claude_get_session, which serves two purposes (polling a background job and inspecting a session's branch/PR), but its description clearly separates the job-id versus session-id modes so an agent can still pick correctly.
All names share a claude_ prefix and snake_case, with verb_noun forms like create_cloud_session, send_followup, get_session, cancel_session, run_local. The two noun-only names (claude_usage, claude_auth_status) are a minor deviation but are still readable as report-style tools.
Seven tools is well-scoped for a Claude Code job runner: lifecycle (create/run/cancel/poll), interaction (followup), and environment checks (auth/usage). No tool feels redundant or missing from the count perspective.
The surface covers the full lifecycle of cloud and local jobs plus auth and usage preflight checks, which are the key dead-end preventers. The notable gap is the absence of a list/enumerate tool, so agents must retain session and job ids themselves, with no cleanup operation for stale sessions.