Claude Code CLI MCP Server
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., "@Claude Code CLI MCP Server run a synchronous task to analyze the project structure"
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.
Claude Code CLI MCP Server
Version: 0.2.0 (post-sprint-N+1)
A local STDIO MCP server that exposes tools and reusable prompts for running the Anthropic Claude Code CLI (claude) inside a controlled workspace.
Links
Model Context Protocol (MCP): https://modelcontextprotocol.io/
FastMCP: https://github.com/PrefectHQ/fastmcp
FastMCP docs: https://gofastmcp.com/
uv docs: https://docs.astral.sh/uv/
Pydantic: https://github.com/pydantic/pydantic
Pydantic Settings: https://github.com/pydantic/pydantic-settings
Claude Code CLI: https://claude.ai/
Related MCP server: claudecode-mcp
Why This Project Exists
This project is a multi-provider fork of agy-mcp-server (the sister project wrapping the Google Antigravity CLI). Both projects share the same underlying architecture to provide a thin, secure CLI shim that exposes terminal-based AI tools as Model Context Protocol (MCP) servers.
Using the Claude Code CLI directly inside an editor or orchestrator workspace poses security and configuration challenges. This MCP server encapsulates the claude process, enforcing directory access controls, standardizing outputs, and providing a file-based persistent memory layer so that system prompts and session history survive across project reloads.
Now you can leverage your Claude Pro/Team subscription or ANTHROPIC_API_KEY seamlessly inside any MCP-enabled IDE:
Cursor
Windsurf
Trae
Features
Tools
claude_health: Checks that theclaudebinary is installed, authenticated, and returns its version and authentication status.claude_run_task: Runs a synchronous (blocking) task inside the target workspace directory. Acceptsmodelandfallback_modelto select the Claude model per-run.claude_start_task: Starts an asynchronous background task inside the target workspace. Accepts the samemodelandfallback_modelparameters.claude_poll_task: Polls the status, stdout, stderr, and output changes of an active background task.claude_cancel_task: Cancels a running background task (supporting an optional force signal).claude_list_runs: Lists recent tasks managed by the server and their statuses.claude_init_persistence: Initializes the persistence layer folder and creates template markdown files.claude_read_persistence: Reads the contents of a persistent memory file (AGENTS.md,PROJECTS.md, orMEMORY.md).claude_append_persistence: Appends high-signal updates (e.g., session memories) to a persistence file.claude_update_persistence: Replaces or appends to a specific section of a persistence file by heading anchor.claude_load_persistence_context: Loads the persistent files as truncated excerpts to inject into session context.
Prompts
claude_sync_orchestration: Guidance playbook for executing synchronous tasks safely viaclaude_run_task. Includes parse-error / timeout / list_runs recovery recipes.claude_async_orchestration: Playbook for orchestrating background tasks viaclaude_start_task+claude_poll_task+claude_cancel_task. Includes backoff schedule (1s → 10s) and post-restart recovery viaclaude_list_runs.claude_model_selection_guidance: Lists all 4 model aliases (sonnet / fable / opus / haiku) with tier, cost, and multi-file-safety annotations. Source of truth:MODEL_REGISTRY.claude_security_and_workspace_rules: Summarizes sandbox limits and rules for safe and permissive environments.claude_persistence_protocol: Guides the orchestrator on maintaining the persistent memory files (load context, append session notes, update AGENTS.md with confirm gate).claude_timeout_help: Decision matrix + code snippet for(task_class, files_to_edit, model_alias) → (timeout_s, must_use_async). Matrix reflects the requested model, not always sonnet.claude_quickstart: First-call cheat-sheet for new orchestrators (workspace_path discipline, tool catalog, common gotchas + troubleshoot).claude_troubleshoot: Pattern-matches an error string and returns a canonical fix recipe (NOT_ALLOWED, NOT_LOGGED_IN, MODEL_NOT_ALLOWED, CLAUDE_NOT_FOUND, etc.).
Companion Agent: Femtobot
Recommendation: this server is the canonical
claude_*tool source forfemtobot, the CLI-first AI agent foundation in the percival.OS ecosystem.
Femtobot ships first-class support for the tools exposed here:
/mcpslash command —status,reload,tools claude-code-cli-mcp,restart claude-code-cli-mcpfor runtime inspection and recovery without restarting the agent.mcp-routerbuiltin skill — teaches the LLM when to delegate toclaude_run_taskvs. solving locally withread_file,apply_patch, etc.Capability tags — tool hints show
[long-running, safe-mode:confirm]so the model recognizes theconfirmgate before invokingclaude_run_task.Workspace auto-fill —
claude_run_taskcalls getworkspace_pathfilled in automatically from the active request context.System-prompt block —
## MCP Servers in this workspacelists this server and its tools so the model sees them at planning time.CLAUDE_MCP_PERSISTENCE_LOCATION=workspaceis auto-resolved by femtobot to<cwd_parent>/.open-cli-router/claude-code-cli-mcp/, so persistence files (AGENTS.md,MEMORY.md,PROJECTS.md) end up inside your project when configured that way.
See femtobot/docs/mcp.md
§8 "Femtobot-specific patterns" for the full integration reference, and
the CLI-router-project analysis
for the design rationale.
claude_self_test
Inspect every registered tool's input schema and report robustness. This is a metadata-only check — no tools are invoked, no subprocess is spawned, no quota is consumed. Safe to run in production or CI as a sanity probe.
Output: per-tool schema introspection (allow_extra_keys vs allow type), focused on accidental strictness regressions.
Persistent Memory
This MCP server features a file-based persistence layer stored by default under ~/.open-cli-router/claude-code/. The directory contains three editable markdown files:
AGENTS.md: The system prompt or agent persona instructions.PROJECTS.md: Summaries and structures of active projects.MEMORY.md: Chronological log of high-signal session takeaways and permanent learning.
When persistence is enabled, the server automatically loads these files and prepends their formatted excerpts to the prompt sent to the claude CLI, ensuring cross-session state persistence.
Storage location: global vs workspace
The persistence directory can live in two places, controlled by
CLAUDE_MCP_PERSISTENCE_LOCATION:
Mode | Location | Use case |
|
| User-level, persists across projects, survives |
|
| Project-level, can be committed (use |
<cwd_parent> is the parent of the server's CWD — for a typical setup,
the server's CWD is the server project directory (e.g.
/home/user/CLI-router-project/claude-code-cli-mcp), so the workspace
mode resolves to /home/user/CLI-router-project/.open-cli-router/claude-code/.
Escape hatch: CLAUDE_MCP_PERSISTENCE_BASE_DIR="$cwd_parent/.my-persistence" lets
you pick any custom subdirectory under the workspace root.
⚠️ When using
workspacemode, add.open-cli-router/to.gitignoreto avoid accidentally committing agent memory to source control.
Two-level configuration
Persistence is controlled by both server-level environment variables and runtime MCP tool calls:
Server level (set in the MCP client env block — see MCP Client Configuration):
Variable | Purpose | Default |
| Master switch for the persistence feature |
|
|
|
|
| Base directory; the namespace |
|
| Maximum size per file before writes are rejected |
|
| Create |
|
| Number of |
|
| Seed default markdown content when initializing |
|
| Fraction of |
|
Runtime level (called by the orchestrator via MCP tools):
Initialize once — call
claude_init_persistenceto create the directory and seed the three files.Load context — call
claude_load_persistence_contextat the start of each session to inject excerpts into the next prompt.Append session notes — after meaningful work, call
claude_append_persistenceonMEMORY.md.Update structured sections — when the user changes
AGENTS.mdorPROJECTS.md, callclaude_update_persistenceto persist. Note: updatingAGENTS.mdin safe mode requiresconfirm=true.
Without step 1, persistence is enabled but uninitialized — the server will not inject any context until the directory exists.
How to initialize the persistence directory
The persistence directory is created lazily — it does not exist by default. There are two equivalent ways to create it:
Option A — via MCP (recommended, normal flow):
Once both the MCP client configuration and the server are running, ask the orchestrator agent to call:
Please call claude_init_persistence to create the persistence directory.The tool seeds AGENTS.md, PROJECTS.md, MEMORY.md, and a .initialized marker under ~/.open-cli-router/claude-code/.
Option B — directly via Python (one-shot, useful for verification or first-time setup):
From the project root (claude-code-cli-mcp/):
uv run python -c "from claude_code_mcp.persistence import PersistenceStore; from pathlib import Path; PersistenceStore(base_dir=Path.home()/'.open-cli-router', max_file_bytes=524288, backup_on_write=False, seed_templates=True).init()"This call is idempotent — running it twice does not destroy existing data unless you pass force=True.
The seed templates are written in English so they can be edited by any language-aware agent later.
Quickstart
Prerequisites:
Python 3.11+
uvinstalledclaudeCLI installed (viacurl -fsSL https://claude.ai/install.sh | bash) and authenticated (via a Claude Pro/Team subscription stored at~/.claude.jsonor theANTHROPIC_API_KEYenvironment variable).
Sync dependencies:
uv syncLaunch the server using STDIO transport:
uv run python -m fastmcp.cli run src/claude_code_mcp/server.py --transport stdioMCP Client Configuration
The server is launched by an MCP client (Trae, Cursor, Windsurf, etc.) over STDIO. The recommended setup uses uvx to install the package from a local source path on demand — no global Python install required.
Trae / Cursor / Windsurf (uvx from local source)
Add to your MCP client configuration (~/.trae/mcp.json, .cursor/mcp.json, .windsurf/mcp.json, or the IDE's MCP settings panel):
{
"mcpServers": {
"claude-code-cli-mcp": {
"command": "uvx",
"args": [
"--refresh",
"--from",
"/path/to/claude-code-cli-mcp",
"fastmcp",
"run",
"src/claude_code_mcp/server.py"
],
"cwd": "/path/to/claude-code-cli-mcp",
"env": {
"CLAUDE_MCP_MODE": "safe",
"CLAUDE_MCP_ALLOWED_ROOTS": "[\"/path/to/your/projects\"]",
"CLAUDE_MCP_FORCE_SANDBOX_IN_SAFE_MODE": "true",
"CLAUDE_MCP_ALLOWED_MODELS": "[\"sonnet\", \"opus\"]",
"START_MCP_TIMEOUT_MS": "30000",
"RUN_MCP_TIMEOUT_MS": "600000"
}
}
}
}Tip:
--refreshforcesuvxto re-resolve the local source on every start. Drop it once you stop iterating on the server.Tip:
START_MCP_TIMEOUT_MSandRUN_MCP_TIMEOUT_MSare client-side timeouts consumed by the Trae IDE (not by this server).
Relevant environment variables
The most relevant variables for the env block are listed below. See Configuration for the full reference.
Variable | Purpose |
|
|
| JSON list of workspace roots the server is allowed to access |
|
|
| JSON list of permitted model aliases / full names (e.g. |
| Enables the persistent memory layer ( |
| Base directory for the persistence layer ( |
Persistence is a two-level configuration. The env vars above only enable the feature and pick the base directory. To actually create the files and start injecting context, the orchestrator must call
claude_init_persistenceonce at startup. See Persistent Memory for the full lifecycle.
Step-by-step Trae setup (Portuguese)
For a guided walkthrough in Portuguese, see USO_TRAE.md.
Running Tests
To install dev dependencies and execute the test suite:
uv sync --extra dev
uv run pytestUsing This Server in Trae
For step-by-step instructions in Portuguese on setting up and invoking this server inside the Trae IDE, see USO_TRAE.md.
Configuration
The server is configured using environment variables prefixed with CLAUDE_MCP_ via Pydantic Settings.
Variable | Description | Default |
| Server access mode ( |
|
| JSON list of allowed workspace roots. | Current working directory |
| Path or command to invoke the |
|
| Fallback absolute paths to search for the binary. |
|
| Pass |
|
| Enforce sandbox execution in safe mode. |
|
| Permission mode flag ( |
|
| Maximum allowed execution time for tasks in seconds. |
|
| Default wait time between polling iterations. |
|
| Maximum concurrent background executions allowed. |
|
| History size of completed tasks in the run store. |
|
| Maximum stdout bytes captured from the child process. |
|
| Maximum stderr bytes captured from the child process. |
|
| JSON set of permitted model names or aliases. |
|
| JSON list of allowed env keys to pass in permissive mode. |
|
| JSON list of allowed CLI arguments in permissive mode. |
|
| Enables the persistent markdown memory layer. |
|
| Base directory for the persistence layer. |
|
| Maximum file size for persistence files before rejecting writes. |
|
| Create a |
|
| Seed default markdown files if missing on init. |
|
| Optional Logfire token for application telemetry. |
|
Model Selection
The MCP server exposes two optional parameters on claude_run_task and claude_start_task for selecting the model on a per-request basis:
model: The primary model used for the run. Accepts a short alias ("sonnet","opus","haiku") or a full model name (e.g.,"claude-sonnet-4-6").fallback_model: An optional automatic fallback model used when the primary model is overloaded. Print-mode only in the CLI — since bothclaude_run_task(sync) andclaude_start_task(async) invoke the CLI via-p, this flag is safe to use in both modes.
Examples:
{
"workspace_path": "/abs/path/to/project",
"prompt": "Refactor the auth module",
"model": "sonnet",
"fallback_model": "haiku"
}{
"workspace_path": "/abs/path/to/project",
"prompt": "Plan a migration to event sourcing",
"model": "claude-sonnet-4-6"
}Both fields are validated against the CLAUDE_MCP_ALLOWED_MODELS allowlist. When set, a model outside the allowlist returns MODEL_NOT_ALLOWED; the same check applies to fallback_model. An empty allowlist disables validation and permits any model requested.
For deeper guidance on choosing models and aliases, see the claude_model_selection_guidance prompt.
Model Selection & Timeout Policy
As of sprint N+1 (commits 3a90258..1f07117), this MCP server supports 4 Claude models and a task-class-aware timeout policy. Both features are backward-compatible additions.
Supported models
Alias | Tier | Typical cost | Latency | Multi-file safe |
| standard | ~$0.50/run | ~8 min | yes |
| mid_tier | ~$0.30/run | ~12 min | yes |
| flagship | ~$1.50/run | ~25 min | yes |
| cheap | ~$0.02/run | ~1.5 min | no (>5 files = warning) |
The CLI strings live in Settings.claude_model_aliases and are
overridable via env vars (CLAUDE_MCP_CLAUDE_MODEL_ALIASES__SONNET,
etc). Default values are placeholders (claude-sonnet-5-...) — set
these to your installed claude --list-models output before
relying on a specific alias.
Timeout policy
Each task has a complexity class (TaskClass enum, 10 values:
trivial_edit, smoke_test, single_feature, docs_update,
test_suite, review, multi_file_refactor, architecture,
migration, long_running). The helper
claude_code_mcp.timeout_policy.compute_timeout(task_class, model, files_to_edit, max_budget_usd) returns a (timeout_s, must_use_async)
recommendation.
Sync ceiling: 600s (FastMCP wrapper hard cap). Async ceiling: 3600s (Pydantic validator upper bound).
Task class | Default timeout | Sync/Async |
| 120s | Sync |
| 180s | Sync |
| 240s | Sync |
| 300s | Sync |
| 360s | Sync |
| 600s | Sync |
| 900s | Async |
| 1500s | Async |
| 1800s | Async |
| 1500s | Async |
| 3600s | Async |
The compute_timeout helper bumps these up automatically based on
files_to_edit (≥20 files → ≥900s, ≥50 files → ≥1800s) and warns
when Haiku is used on >5 files.
Using the decision matrix
Orchestrators can call the MCP prompt prompt_timeout_help (name
claude_timeout_help) to get a structured recommendation. The matrix
in the response reflects the requested model (e.g. opus shows the
opus timeouts, not sonnet's), so you can compare apples to apples.
# In your orchestrator
from claude_code_mcp.server import prompt_timeout_help
guide = prompt_timeout_help(
task_class="multi_file_refactor",
files_to_edit=20,
model_alias="opus",
)
# Returns: timeout_s=900+, must_use_async=True, decision matrix
# (rows = task classes, columns = model-specific timeouts), and a
# pre-formatted python snippet using `claude_start_task`.Or directly use the helper:
from claude_code_mcp.models import MODEL_REGISTRY, TaskClass
from claude_code_mcp.timeout_policy import compute_timeout
profile = MODEL_REGISTRY["opus"]
rec = compute_timeout(TaskClass.MULTI_FILE_REFACTOR, profile, files_to_edit=20)
if rec.must_use_async:
run_id = claude_start_task(req={"prompt": "...", "timeout_s": rec.timeout_s})
# Poll with claude_poll_task(drain=true) or via start/poll loop
else:
result = claude_run_task(req={"prompt": "...", "timeout_s": rec.timeout_s})Feature flag
The new types are always available, but the policy helper is gated
behind CLAUDE_MCP_TIMEOUT_POLICY_ENABLED=false (default OFF) for
safe rollout. Set it to true in .env to enable automatic
timeout recommendations in your orchestrator's request layer.
Sync vs async decision (recap)
claude_run_task(sync, ≤600s wrapper cap) —trivial_edit,smoke_test,review,single_feature,docs_update,test_suite, smallmulti_file_refactor(≤20 files).claude_start_task+claude_poll_task(async, ≤3600s) — largemulti_file_refactor(>20 files),architecture,migration,long_running.
If a sync call returns parse_error (response is not valid JSON),
do not retry sync — the subprocess likely returned truncated /
non-JSON output due to a wrapper-level timeout. Switch to
claude_start_task (async) which buffers output incrementally and
survives longer walls.
Security
Safe Mode (Default)
In safe mode (CLAUDE_MCP_MODE=safe):
Sandbox execution is enforced (if
CLAUDE_MCP_FORCE_SANDBOX_IN_SAFE_MODEis enabled).Custom environment overrides are blocked.
Custom extra command-line arguments are blocked.
Bypassing permissions (
bypassPermissionsordontAskpermission modes) is rejected.
Permissive Mode
In permissive mode (CLAUDE_MCP_MODE=permissive):
Environment variable overrides are permitted only if they appear in the
CLAUDE_MCP_ALLOW_ENV_KEYSlist.Extra arguments are allowed only if they appear in
CLAUDE_MCP_ALLOW_EXTRA_ARGS.Skipping permissions (
bypassPermissionsor--dangerously-skip-permissions) requires"--dangerously-skip-permissions"to be explicitly listed inCLAUDE_MCP_ALLOW_EXTRA_ARGS.
Troubleshooting
CLAUDE_NOT_FOUND
The server cannot locate the claude executable. Make sure it is installed (e.g. via the official installer) and added to your PATH. Alternatively, set CLAUDE_MCP_CLAUDE_PATH to the absolute path of the binary.
NOT_ALLOWED: workspace_path is outside allowed roots
Your workspace path is outside of the configured roots. Include the target directory in the CLAUDE_MCP_ALLOWED_ROOTS JSON array, or launch the server from within the target folder.
⚠️
CLAUDE_MCP_ALLOWED_ROOTSand other server env vars are read at MCP server STARTUP. Editing.envafter the server is running has no effect — restart the MCP server (in your client's MCP panel) for changes to apply.
NOT_LOGGED_IN / result.text == "Not logged in · Please run /login"
The claude CLI cannot find its OAuth token. The most common cause is the --bare flag being passed to the subprocess — --bare bypasses ~/.claude/ entirely, so ~/.claude.json (which holds the token) is invisible. Verify this server's force_bare=False (the default). Alternative: run claude login interactively in your shell to seed ~/.claude.json, then restart this MCP server.
MODEL_NOT_ALLOWED
The requested model (or fallback_model) is not in Settings.allowed_models (configurable via CLAUDE_MCP_ALLOWED_MODELS). Empty allowlist disables validation.
PERSISTENCE_FILE_TOO_LARGE
A persistence file has reached the maximum allowed bytes (default 1 MiB). Clean up or truncate obsolete entries in the file (~/.open-cli-router/claude-code/MEMORY.md or PROJECTS.md) to allow new writes.
CONFIRM_REQUIRED
Modifying AGENTS.md (the system prompt) in safe mode requires setting the confirm parameter to true to ensure the override is intentional.
~/.open-cli-router/claude-code/ does not exist
The persistence directory is created lazily. The server will not create it on its own — you must initialize it once via claude_init_persistence (or the Python one-liner under Persistent Memory → How to initialize). Without this, the server is enabled but uninitialized and no context is injected into prompts.
Available Tools
12 toolsclaude_append_persistenceA
Append content to one of the persistence files.
Required: file (agents|projects|memory), content. Optional: section_header (str|None) — if provided, the append is placed under a heading; otherwise content is appended at the end of the file.
Safe-mode constraint: in Settings.mode == "safe", updating AGENTS.md
requires confirm=true. The same applies to update_persistence.
Do not store secrets, credentials, or full file dumps — keep entries small and high-signal.
Inputs: req. Returns: file, timestamp, appended_bytes, new_size_bytes
claude_cancel_taskA
Cancel a running task.
Two escalation levels: - force=false (default): sends SIGTERM (graceful). The subprocess has ~5s to clean up before the OS escalates. Try this first. - force=true: sends SIGKILL (immediate). Use only if the subprocess doesn't respond to SIGTERM within ~5s.
Returns: ClaudeCancelTaskResponse with canceled (bool) and status ("cancelled" if actively stopped, "already_done" if run finished naturally, "not_found" if run_id is unknown).
Inputs: req. Returns: status, canceled
claude_healthA
Health check for the Claude Code CLI binary.
Verifies the claude binary is on PATH, captures its --version output,
and reports auth status (whether ~/.claude.json has an OAuth token).
Use this as the first call in any orchestration session to validate the
environment.
Optional fields: - expected_version (str): if set, returns ok=false on version mismatch
Returns: - claude_path, claude_version, ok, auth_status, notes
Inputs: req. Returns: ok, notes, auth_status, claude_path, +1 more
claude_init_persistenceA
Initialize the persistence directory and seed the three markdown files.
Idempotent: re-running without force=true is a no-op if files already
exist. Creates the directory at the location resolved by
Settings.resolve_persistence_base_dir() and writes AGENTS.md,
PROJECTS.md, MEMORY.md (unless they already exist).
Optional fields: - force (bool): re-create files even if they exist - seed_templates (bool|None): whether to seed the default templates
Inputs: req. Returns: created, base_dir, seed_version, already_existed
claude_list_runsA
List recent runs (active + recently completed).
Returns ClaudeRunSummary entries ordered newest-first, with active
claude_start_task runs at the top followed by completed/cancelled/
timed-out runs from the in-memory store (bounded by Settings.max_runs).
Use this for recovery after orchestrator restart: active async runs
survive across MCP client restarts and can be polled/cancelled via
claude_poll_task and claude_cancel_task using the run_id from this
listing.
Inputs: req. Returns: runs
claude_load_persistence_contextA
Load the persistence files as context for the current session.
Returns head+tail excerpts of each file (head_ratio controlled by Settings.persistence_truncation_head_ratio). Use this at the start of each session to hydrate orchestrator memory before dispatching tasks.
Optional fields: - include (list[str]|None): subset of files to load (agents|projects|memory). None = all three. - max_chars_per_file (int): per-file char cap (default from settings).
Inputs: req. Returns: base_dir, initialized, total_chars, agents_excerpt, +3 more
claude_poll_taskA
Poll an asynchronous task.
Two polling modes: - drain=false (default): returns immediately with current state (new messages, stdout/stderr byte counts, elapsed time). Use for tight control loops with explicit backoff. - drain=true: blocks until status is no longer 'running' (fire-and-wait). Note: this is bounded by your MCP client's request timeout, not the async task's timeout_s. For long blocks, prefer async drain with orchestrator-level polling.
Returns: ClaudePollTaskResponse with status (running|done|error|timeout|cancelled), new_messages, stdout_len/stderr_len, elapsed_seconds, and (once terminal) the full result with total_cost_usd, model_usage, and changes.
Inputs: req. Returns: notes, result, run_id, status, +4 more
claude_read_persistenceA
Read one of the three persistence files (agents | projects | memory).
Optional fields: - file (str): which file to read (default: memory) - offset (int): start reading from line N (0-indexed) - limit (int|None): max lines to return (None = no limit)
Large files are automatically truncated at
Settings.persistence_max_file_bytes; the response includes a
truncated flag if this happens.
Inputs: req. Returns: file, content, truncated, size_bytes, +1 more
claude_run_taskA
Run a single Claude task synchronously (bounded by FastMCP's 600s wrapper cap).
Required: workspace_path, prompt. Common options: model (alias from Settings.claude_model_aliases), fallback_model, permission_mode, options.timeout_s (default 300, max 600), capture_changes.
Estimated cost depends on model and prompt size — check total_cost_usd
in the response. Typical ranges: haiku ~$0.02, sonnet ~$0.50, opus ~$1.50.
For tasks that may exceed 600s (architecture, migration, large refactors),
use claude_start_task (async) instead. For timeout routing, call the
claude_timeout_help prompt first.
Returns: ClaudeRunTaskResponse with result, stdout/stderr, exit_code, timed_out, total_cost_usd, model_usage, and (if capture_changes=true) a unified git diff of workspace changes.
Inputs: req. Returns: notes, result, run_id, status, +8 more
claude_self_testA
Inspect every registered tool's input schema and report robustness.
This is a metadata-only check — no tools are actually invoked.
Args shape:
The MCP client MUST pass arguments wrapped in a req object:
{"req": {"include": ["claude_health"], "only_show_tolerant": true}}
For backwards-compatibility, the server also accepts args={}.
Inputs: req. Returns: tools, summary, server_info, total_tools, +2 more
claude_start_taskA
Start a Claude Code CLI task asynchronously (up to 3600s).
Returns immediately with a run_id. The subprocess continues running in
the background; use claude_poll_task to monitor and claude_cancel_task
to stop. Use this for any task that may exceed 600s (architecture,
migration, large multi-file refactors, long-running data agents).
Required: workspace_path, prompt. Optional: model, fallback_model, permission_mode, options.timeout_s (default 300, max 3600 for async), capture_changes.
Concurrent run limit: bounded by Settings.max_concurrent_runs. New calls beyond that limit return MAX_CONCURRENT_RUNS_EXCEEDED.
Inputs: req. Returns: run_id, session_id, started_at
claude_update_persistenceA
Replace or append to a section in one of the persistence files.
Required: file, section_anchor, new_content. Optional: mode (replace|append) — replace the entire section vs append inside it (default replace).
Safe-mode constraint: in Settings.mode == "safe", updating AGENTS.md
requires confirm=true. Returns matched=true when the section_anchor
was found; matched=false when the anchor was not found and no edit
happened (so you can detect typos before silent appending).
Inputs: req. Returns: file, matched, new_size_bytes, section_anchor
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
The task lifecycle tools (run/start/poll/cancel/list) are clearly separated by sync vs async execution and state transitions, and the persistence tools have distinct read/append/update/load operations. The only mild ambiguity is between run_task and start_task, and between update_persistence and append_persistence, but the descriptions explicitly route usage.
All tools share a consistent claude_ prefix and snake_case style, with most following a verb_noun pattern like claude_run_task, claude_poll_task, and claude_read_persistence. claude_health is a noun-only outlier, and claude_load_persistence_context is less consistent with the shorter read/append/update names, but the overall pattern remains predictable.
Twelve tools is well-scoped for a server covering Claude Code CLI task execution and persistent memory files, with no redundant duplicates. Each tool addresses a distinct operational need within those two clear domains.
The surface covers the full task lifecycle: synchronous run, asynchronous start, poll, cancel, and list, plus health verification and self-test. Persistence is also complete with init, read, append, update, and load-context operations, leaving no obvious dead ends for the stated purpose.
Maintenance
Related MCP Connectors
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Connect ChatGPT and Claude to your Mac, Windows or Linux with secure MCP remote access.
Remote MCP server for supportsheep: run AI interviews and manage support content for your blog.
Remote MCP server for supportsheep: run AI interviews and manage support content for your blog.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA server implementation for the Model Context Protocol (MCP) that allows Claude AI to execute commands through a command-line interface, enabling direct system interactions from within Claude.-
- AlicenseAqualityBmaintenanceLocal MCP server that wraps the headless Claude Code CLI as MCP tools, providing stateless access to Claude's coding capabilities through prompt-based interactions. It enables users to execute Claude Code commands with various prompt formats and structured outputs directly from MCP clients.3MIT
- AlicenseAqualityDmaintenanceA Model Context Protocol (MCP) server that provides a bridge to Anthropic's Claude CLI. It allows MCP-compliant clients like Claude Desktop or Gemini to start new chat sessions or continue existing ones.2108 npmISC
- FlicenseNot gradedqualityDmaintenanceExposes headless Claude Code as a remote MCP server with a voice client, enabling hands-free task execution and session management via OpenAI's Realtime API.-