Create Claude Code cloud session
claude_create_cloud_sessionStarts a Claude Code cloud session from a task description, cloning a GitHub repo or local directory first. Returns a session ID and URL, or a job ID to poll for the final result.
Instructions
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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"description": "<description>"
},
"name": "claude_create_cloud_session"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo | No | Repository this session packages. A github.com owner/name or https://github.com/owner/name URL (any repository the Claude GitHub app can access; cloned into CLAUDE_MCP_REPO_CACHE), or an absolute directory on CLAUDE_MCP_REPOS. Omit to use CLAUDE_MCP_CWD. | |
| timeout_s | No | Per-process time limit for this create's git steps and claude --cloud, in seconds. Omit to use CLAUDE_MCP_TIMEOUT_MS. | |
| base_branch | No | Branch the cloud VM should clone, for a github.com repo. The cache checkout is moved to this branch before claude --cloud. Omit to use the remote's default branch. Not applied to a local directory. | |
| description | Yes | Task description for the new cloud session. | |
| environment_id | No | Cloud environment id (e.g. ccpool_...). Overrides CLAUDE_CLOUD_ENVIRONMENT_ID; omit to use that default. | |
| idle_timeout_s | No | Stop claude --cloud when it prints nothing for this many seconds. Omit to use CLAUDE_MCP_IDLE_TIMEOUT_MS (off when unset). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cli | Yes | CLI output with terminal control sequences removed. Until status is done, exit_code is null and stdout holds the last 4,000 characters so far. | |
| cwd | Yes | Directory the CLI ran in. | |
| args | Yes | ||
| repo | Yes | Normalized repository from the call, or null when the default directory was used. | |
| cache | Yes | How the GitHub cache checkout was prepared. Null until it is ready, and for a local or default directory. | |
| title | Yes | ||
| job_id | Yes | Background job for this create. Pass it to claude_get_session until status is done. | |
| parsed | Yes | True when both session_id and session_url were parsed from CLI output. | |
| status | Yes | cloning: preparing the GitHub cache checkout. starting: claude --cloud is running and has not printed a session yet. running: the session id was printed and the CLI has not exited. done: the CLI exited and the result below is final. cancelled: claude_cancel_session stopped the job; a session it already printed keeps running in the cloud. | |
| elapsed_ms | Yes | Time since the job started, or its total duration once done. | |
| session_id | Yes | ||
| base_branch | Yes | Branch the GitHub cache checkout was on, or null when no GitHub repository was selected. | |
| session_url | Yes | ||
| environment_id | Yes |