Skip to main content
Glama
xihuai18

claude-code-mcp

by xihuai18

claude_code

Destructive

Start a background coding session with Claude Code that returns a session ID for asynchronous polling. Use it to run autonomous tasks, handle permission requests, and track progress via subsequent checks.

Instructions

Start a background Claude Code run and return sessionId immediately. No final result is returned here. Main loop: call claude_code_check(action='poll'), store nextCursor, and keep polling until status becomes idle, error, or cancelled. If actions[] contains permission requests, answer them with claude_code_check(action='respond_permission'). respond_user_input is not supported. Adjust polling cadence to progress: poll faster while new events/actions are arriving, and slower when the session is quietly thinking. Long-running work is normal: Claude Code can keep working for 10+ minutes, especially with high/max effort, so wait for polling to settle before assuming it is stuck. If you want to continue after a run pauses or finishes, use claude_code_reply with the same sessionId instead of starting a new claude_code session. For runtime-authoritative tool names, call claude_code_check with pollOptions.includeTools=true.

Internal tools (runtime list when includeTools=true):

[agent]

  • Task: Spawn subagent (must be in allowedTools)

  • TaskOutput: Get subagent output

  • TaskStop: Cancel subagent

  • TeamDelete: Delete team (may need shutdown_approved first)

  • TodoWrite: Task/todo checklist

[execute]

  • Bash: Run shell commands

[file_read]

  • Glob: Find files by glob pattern

  • Grep: Search file contents (regex)

  • Read: Read file contents (large files: use offset/limit or Grep)

[file_write]

  • Edit: Targeted edits (replace_all is substring-based)

  • NotebookEdit: Edit Jupyter notebook cells (Windows paths normalized)

  • Write: Create or overwrite files

[interaction]

  • AskUserQuestion: Ask user a question

[mcp]

  • SubscribeMcpResource: Subscribe to an MCP resource stream

  • SubscribePolling: Subscribe to periodic polling

  • UnsubscribeMcpResource: Unsubscribe from an MCP resource stream

  • UnsubscribePolling: Unsubscribe from periodic polling

[network]

  • WebFetch: Fetch web page or API content

  • WebSearch: Web search

Permission control: allowedTools pre-approves tools but is not a strict allowlist unless strictAllowedTools=true; disallowedTools always denies; other tools may require approval.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNoWorking dir. Default: server cwd
modelNoDefault: SDK
effortNoEffort string: 'low' | 'medium' | 'high' | 'max'. Default: SDK
promptYesPrompt for a new background run. The final result arrives later via claude_code_check, not this call. Store nextCursor from polls and reuse sessionId with claude_code_reply if you want to continue later.
advancedNoDefault: none
maxTurnsNoDefault: SDK
thinkingNoThinking config object, not a string. Use {type:'adaptive'} | {type:'enabled', budgetTokens?:N} | {type:'disabled'}. Default: SDK
allowedToolsNoPre-approved tool names. Default: []. This is not a strict allowlist unless strictAllowedTools=true.
systemPromptNoSystem prompt config: string, {type:'preset',preset:'claude_code'}, or {type:'preset',preset:'claude_code',append:'...'}. Default: SDK
disallowedToolsNoAlways-denied tool names. Default: []
strictAllowedToolsNoDefault: false. When true, tools outside allowedTools are denied.
permissionRequestTimeoutMsNoServer permission wait timeout in ms; not forwarded to SDK Options. Default: 60000, clamped to 300000

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorNo
statusYes
sessionIdYes
resumeTokenNo
pollIntervalNo
compatWarningsNo
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the annotations (destructiveHint=true, openWorldHint=true), the description adds critical behavioral context: the tool starts a background process, explains the long-running nature (10+ minutes), details the polling loop, permission handling, and internal tool behavior. It also clarifies that allowedTools is not a strict allowlist unless strictAllowedTools is true, providing transparency on permission control.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized for the complexity, front-loading the core purpose and polling loop. It then covers permissions, continuation, and internal tool lists in a structured manner. While long, every section adds value; could be slightly more concise but earns a 4 for effective structure.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (asynchronous polling, permissions, internal tools) and the presence of a detailed schema and output schema, the description is complete. It covers the main loop, permission handling, session management, runtime tool discovery, and permission control nuances, leaving no significant gaps for an agent to use the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds minimal parameter insight beyond the schema: it reiterates that prompt starts a run and mentions storing nextCursor from polls, but does not elaborate on other parameters. The description focuses on the workflow rather than individual parameter details, which is acceptable given the schema's thoroughness.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool starts a background Claude Code run and returns a sessionId immediately, with no final result returned here. It distinguishes itself from sibling tools (claude_code_check, claude_code_reply, claude_code_session) by explaining when to use each and that claude_code_reply should be used for continuation instead of starting a new session.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool: to start a run. It details the main polling loop using claude_code_check, handling permission requests with respond_permission, adjusting polling cadence based on progress, and waiting for long-running work. It also tells when to use claude_code_reply instead of starting a new session.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/xihuai18/claude-code-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server