claude-sessions-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
claude-sessions-mcp
An MCP server for creating and driving Claude Code sessions inside a running Remote Control server, over the REST API the bridge itself uses.
An agent can call in a colleague that is not running yet, hand it a prompt, and have it start working — as a session that belongs to the project's server, with its worker under that server, visible in claude.ai and reachable from the other sessions on the machine. The same tools let you survey and steer every agent running there from a session opened on a phone.
Runs as a single process per machine (streamable-HTTP on 127.0.0.1), not as a
stdio subprocess per session.
See the design for the verified API surface, how bridge servers are discovered without any host-specific configuration, the tools, and the safety rails around spawning agents.
Usage
Build
npm install
npm run buildInstall as a systemd user service
Copy the unit into your systemd user directory and adjust the two paths to where you checked out this repository:
cp deploy/claude-sessions-mcp.service ~/.config/systemd/user/Edit WorkingDirectory= and ExecStart= in the copied unit if the repository
does not live directly under your home directory (the shipped unit assumes
~/claude-sessions-mcp). Then enable and start it:
systemctl --user enable --now claude-sessions-mcpRegister it with Claude Code
claude mcp add --transport http --scope user sessions http://127.0.0.1:8765/mcpEnvironment variables
Variable | Default | Meaning |
|
| Interface to bind. Only |
|
| Port the server listens on (loopback only). |
|
| Ceiling on sessions this server may have spawned and left active per bridge. |
|
| Where Claude Code keeps its config, including bridge pointer files. |
|
| Path to the claude.ai OAuth credentials file. |
Requirements
Node.js 22 or newer (the code is ESM and uses ES2023 library features).
Linux only — bridge discovery reads /proc to find running Remote Control
servers and their workers. The server must run as the same user as the
bridges it talks to: it reads their process table and the shared credentials
file, both of which are only visible to that user.
The one piece of state the server keeps is its spawn registry: an empty file
per session it has spawned, under $XDG_STATE_HOME/claude-sessions-mcp/spawned/sessions
(override the directory with CLAUDE_SESSIONS_MCP_STATE_DIR). The spawn
ceiling is counted from it with one status lookup per entry; archived and
deleted sessions are dropped as they are found. It replaces counting by paging
the whole session list, which holds every archived session too and outgrew
the page cap once the history passed 2000 sessions. On first use the registry
is seeded once from the full list. The MCP server and the CLI share it, and a
file per entry keeps their concurrent writes from losing one another's.
Nothing else persists between calls. wait_for_idle holds an event stream
open for the duration of that one call, and alongside it polls the session's
status, because archiving a session cuts its turn short without emitting
anything on the stream. Both end with the call: nothing is subscribed or
watched between calls.
After a bridge restart
A stopped bridge does not release the work leases of its sessions. When it comes back, it re-queues only the one session its pointer file names; every other session stays without a worker until the old lease expires (about six minutes, measured on CLI 2.1.284) and a client re-opens it. A user message alone never gets it a worker. In the claude.ai client this looks like "Remote Control disconnected" for a bridge that is in fact up.
claude-sessions reattach <instance> hands the bridge back every live session
of its environment that has no worker, through the same
/v1/environments/<env>/bridge/reconnect call the bridge makes for its own
anchor, which does not wait for the lease. It waits up to a minute for the
bridge to show up, so it can run as an ExecStartPost= of the unit that runs
the bridge:
ExecStartPost=-/path/to/claude-sessions reattach %iIt prints a JSON report (reattached, failed) and exits non-zero only when
the bridge never appeared. send_message does the same for the one session it
writes to, when that session has no worker (reattached: true in its result).
Scheduled task runs
claude-sessions run <instance>--<task> runs one task from the project's
.claude/background/tasks.json: it spawns a session tagged
role:vector-prime on that bridge, waits for its turn to end (timeout_min,
default 60), archives it, prints a JSON report and exits non-zero on failure.
model picks the session's model; without it the bridge's default applies.
A task can declare a precheck, a shell command run in the project directory
(with WORKDIR set) before anything is spawned. Its stdout lists the work
there is. The run is skipped (outcome: "skipped", exit 0) when that output is
empty, or identical to what it was at the last successful run; state lives in
$XDG_STATE_HOME/vector-task/<instance>--<task>.json, written only after a
successful run, so failed work is retried on the next firing. A precheck that
exits non-zero, or runs over 60 s, lets the task run as if it had none.
precheck_max_skip_h forces a run when that many hours passed since the last
real one, as a guard against a precheck that wrongly reports no work.
"zabbix-watch": {
"cron": "*/30 * * * *", "prompt_file": "zabbix-watch.md",
"model": "claude-haiku-4-5",
"precheck": "$HOME/dev/.config/claude-background/prechecks/zabbix-watch.sh",
"precheck_max_skip_h": 24
}Safety rails
permission_modeacceptsauto,acceptEdits,plan,manualordontAskonly.bypassPermissionsis refused outright, never downgraded.Sessions can be spawned only in bridges discovered on this machine, never in a raw environment id.
CLAUDE_SESSIONS_MCP_MAX_SPAWNEDbounds how many active sessions this server may have created per bridge; if that count cannot be established completely, the spawn is refused rather than allowed.Every created session is tagged
mcp:claude-sessions-mcpandspawned-by:<caller>.
Related MCP server: herdr-spawn
Releasing
The version lives in one place, package.json; the server reports it in the
MCP handshake, and a test asserts the two agree.
npm run release -- patch | minor | major | X.Y.ZThe script refuses a dirty tree or a branch other than master, checks that
the target tag is free and that origin is not ahead, runs the build and the
tests, then bumps the version, commits and tags vX.Y.Z. Pushing is left to
you — it prints the command.
Pushing the tag opens a draft release with generated notes
(.github/workflows/release-draft.yml); edit it into something worth reading
and publish it by hand. Nothing else reacts to a tag: there is no build to
trigger and nothing to deploy.
Every push and pull request runs the build and the test suite
(.github/workflows/ci.yml).
Inside Claude Code, /build [patch|minor|major|X.Y.Z] walks the whole cycle:
release script, tag push, both workflows, the draft notes, and a restart of the
local service if one is installed. It stops short of publishing the release.
License
MIT — see LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Start and manage Reason cloud coding agents, projects and sessions from any MCP client.
People and AI agents build software together in persistent cloud sessions for Claude Code.
Build Apps and run code in 30 languages — sandboxed, with persistent sessions for agent loops.
Sync coding-agent sessions and resume them in any other agent: Claude Code, Codex, Cursor, more.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables MCP clients to spawn and control Codex CLI and Claude Code sessions on the host machine, with session management and filesystem access.4MIT
- AlicenseNot gradedqualityBmaintenanceSpawns a real coding agent on a specified host, submits a prompt from a chat, and returns a link to the session (for Claude Code) or a command to continue, enabling chat-driven work on your own machines.1MIT
- AlicenseNot gradedqualityBmaintenanceEnables a Claude Desktop or Claude Code session to start, drive, and supervise interactive Claude Code CLI worker runs, including sending prompts, reading terminal output, waiting for completion, stopping runs, and managing settings and permissions.MIT

RClaude MCP Serverofficial
AlicenseNot gradedqualityBmaintenanceExposes a Streamable HTTP endpoint that lets other agents, such as claude.ai connectors and Claude Code, start and continue Claude Code sessions remotely. It provides session control over the same single-user Claude Code environment that the web console and REST API manage.2MIT