Skip to main content
Glama
Claude Code MCP Server

Claude Code MCP Server

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
CLAUDE_BINNoPath or name of the Claude Code CLI binary.claude
CLAUDE_MCP_CWDNoDirectory 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_PYTHONNoPython 3 interpreter used to allocate the pseudo-terminal for create.python3
CLAUDE_MCP_TRUST_CWDNo1, 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_MSNoHard 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_IDNoDefault 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

CapabilityDetails
tools
{
  "listChanged": true
}

Tools

Functions exposed to the LLM to take actions

NameDescription
claude_create_cloud_sessionA

Create a new Claude Code cloud session via claude --cloud on a pseudo-terminal (the CLI rejects this form when stdout is a pipe). The work runs as a background job and this call returns within a few seconds. If status is done, the result is final: the parsed session_id and session_url, or, when parsing fails, parsed false and the CLI output (terminal controls removed) in cli. Otherwise poll claude_get_session with job_id until job.status is done or the call returns an error; failures surface there with the same error codes. A github.com repo is cloned into CLAUDE_MCP_REPO_CACHE (origin set to that GitHub repository) and, when base_branch is set, checked out there before the CLI runs. Any other absolute directory must be on CLAUDE_MCP_REPOS. Omit repo to use CLAUDE_MCP_CWD. When Claude Code asks to trust the chosen folder, the call fails with WORKSPACE_NOT_TRUSTED unless CLAUDE_MCP_TRUST_CWD=1. The cloud VM's clone, push, and pull request use the Claude GitHub app (or /web-setup), not this server. If the session later can't push its branch to GitHub, ask it via claude_send_followup for a git format-patch (or full git diff) of its changes and apply, test, push and open the PR yourself.

claude_send_followupA

Queue a follow-up message into an existing Claude Code cloud session via claude --cloud <session> -p <message>. Replies are only visible at the session_url; claude_get_session reports the pushed branch and pull request. If the session can't push to GitHub, use this to ask for git format-patch origin/<base>..HEAD --stdout (or a full git diff including new files), then apply it locally with git am / git apply --3way and push it yourself.

claude_get_sessionA

With a job id from claude_create_cloud_session, report that create's progress in job (status, elapsed time, the tail of the CLI output, and session_id once the CLI prints it), its final result once job.status is done, or its error. With a job id from claude_run_local, report that run in local_job the same way. A job read uses memory only and runs nothing. With a session id or URL, report the branch a cloud session pushed and any pull request it opened. Prepares the github.com checkout in CLAUDE_MCP_REPO_CACHE (origin set to that repository), then runs print-mode claude --teleport=<session> --debug there and stops when the CLI exits. Print mode checks out the session branch and exits; it is not given a prompt and it is not started on a terminal, so it does not continue as a local interactive session. The branch is taken from the debug line Branch after checkout when that matches HEAD, otherwise from a HEAD move. The pull request number and URL come from that output when present, otherwise from a read-only gh pr list. Claude's GitHub app (or /web-setup) is what pushes the branch and opens the pull request; this tool only reads them.

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 stopped. This does not stop a cloud session: one the CLI already created keeps running at its session_url. A job that already finished is left as it is (cancelled false), and one that failed returns its error.

claude_run_localA

Run Claude Code headless on this machine (claude -p) in an existing checkout, instead of a cloud session: for work that needs the local toolchain or hardware. cwd must be inside a CLAUDE_MCP_LOCAL_ROOTS directory after resolving symlinks; with no roots configured every call fails with LOCAL_RUNS_DISABLED. Unless CLAUDE_MCP_LOCAL_ALLOW_SHELL is set, the run uses Claude Code's --restricted mode: no shell or code tools, no WebFetch, no MCP servers, and the checkout's settings, hooks and .mcp.json are not loaded (needs Claude Code 2.1.248 or later). The run is a background job and this call returns within a few seconds: if status is not done, poll claude_get_session with job_id until local_job.status is done or the call returns an error. The final result has the session_id (pass it as resume to continue), the result text, turns, cost and usage, denied tools, and the files git status lists. permission_mode defaults to dontAsk, which denies anything not read-only or in allowed_tools; permission bypass is never used. Pre-approving Bash or using auto mode runs shell commands unasked and fails with LOCAL_SHELL_DISABLED unless CLAUDE_MCP_LOCAL_ALLOW_SHELL is set. claude_cancel_session stops a run.

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 -p --restricted -- /usage, a local command that makes no model call and costs nothing; readings are reused for 60 s unless refresh is true. When CLAUDE_MCP_USAGE_STOP_PERCENT is set, blocked_by names the window that makes create and claude_run_local fail with USAGE_LIMIT_NEAR. windows is null when the CLI can't read plan usage.

claude_auth_statusA

Report whether the local Claude Code CLI is signed in, via claude auth status. If it is not, sign in with claude first (run it once in a terminal and complete the claude.ai login). A missing CLI returns CLI_NOT_FOUND with the install command (npm install -g @anthropic-ai/claude-code).

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A4.4/5.0

Scored across 7 tools

Disambiguation4/5

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.

Naming Consistency4/5

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.

Tool Count5/5

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.

Completeness4/5

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.

Maintenance

ActivityMaintained
ResponsivenessOutdated data