@leo000001/claude-code-mcp 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1797,7 +1797,7 @@ function executeClaudeCodeSession(input, sessionManager) {
1797
1797
  }
1798
1798
 
1799
1799
  // src/server.ts
1800
- var SERVER_VERSION = true ? "2.0.0" : "0.0.0-dev";
1800
+ var SERVER_VERSION = true ? "2.0.1" : "0.0.0-dev";
1801
1801
  function createServer(serverCwd) {
1802
1802
  const sessionManager = new SessionManager();
1803
1803
  const toolCache = new ToolDiscoveryCache();
@@ -1821,7 +1821,7 @@ function createServer(serverCwd) {
1821
1821
  z.object({
1822
1822
  type: z.literal("preset"),
1823
1823
  preset: z.literal("claude_code"),
1824
- append: z.string().optional().describe("Additional instructions to append to the preset")
1824
+ append: z.string().optional().describe("Appended to preset prompt")
1825
1825
  })
1826
1826
  ]);
1827
1827
  const toolsConfigSchema = z.union([
@@ -1835,66 +1835,50 @@ function createServer(serverCwd) {
1835
1835
  z.object({ type: z.literal("adaptive") }),
1836
1836
  z.object({
1837
1837
  type: z.literal("enabled"),
1838
- budgetTokens: z.number().int().positive().describe("Token budget for thinking")
1838
+ budgetTokens: z.number().int().positive()
1839
1839
  }),
1840
1840
  z.object({ type: z.literal("disabled") })
1841
1841
  ]);
1842
1842
  const outputFormatSchema = z.object({
1843
1843
  type: z.literal("json_schema"),
1844
- schema: z.record(z.string(), z.unknown()).describe("JSON Schema for structured output")
1844
+ schema: z.record(z.string(), z.unknown())
1845
1845
  });
1846
1846
  const advancedOptionsSchema = z.object({
1847
- tools: toolsConfigSchema.optional().describe(
1848
- "Define the base tool set visible to the agent. Default: omitted (SDK/Claude Code default). Pass an array of tool names, or {type: 'preset', preset: 'claude_code'} for the default set."
1849
- ),
1850
- persistSession: z.boolean().optional().describe("Persist session history to disk (~/.claude/projects). Default: true."),
1851
- sessionInitTimeoutMs: z.number().int().positive().optional().describe("How long to wait (in ms) for the agent process to initialize. Default: 10000."),
1852
- agents: z.record(z.string(), agentDefinitionSchema).optional().describe(
1853
- "Define custom sub-agents the main agent can delegate tasks to. Each key is the agent name."
1854
- ),
1855
- agent: z.string().optional().describe("Name of a custom agent (defined in 'agents') to use as the primary agent."),
1856
- maxBudgetUsd: z.number().positive().optional().describe("Maximum budget in USD for this session."),
1857
- effort: z.enum(EFFORT_LEVELS).optional().describe("Effort level: 'low' | 'medium' | 'high' | 'max'."),
1858
- betas: z.array(z.string()).optional().describe("Beta features to enable."),
1859
- additionalDirectories: z.array(z.string()).optional().describe("Additional directories the agent can access beyond cwd."),
1860
- outputFormat: outputFormatSchema.optional().describe("Structured output format with JSON Schema."),
1861
- thinking: thinkingSchema.optional().describe("Thinking mode: 'adaptive' | 'enabled' (with budget) | 'disabled'."),
1862
- pathToClaudeCodeExecutable: z.string().optional().describe("Path to the Claude Code executable. Default: SDK-bundled."),
1863
- mcpServers: z.record(z.string(), z.record(z.string(), z.unknown())).optional().describe("MCP server configurations (key: server name, value: server config)."),
1864
- sandbox: z.record(z.string(), z.unknown()).optional().describe("Sandbox configuration for isolating shell command execution."),
1865
- fallbackModel: z.string().optional().describe("Fallback model if the primary model fails or is unavailable."),
1866
- enableFileCheckpointing: z.boolean().optional().describe("Enable file checkpointing to track file changes. Default: false."),
1867
- includePartialMessages: z.boolean().optional().describe("Include intermediate messages as events in claude_code_check. Default: false."),
1868
- strictMcpConfig: z.boolean().optional().describe("Enforce strict validation of MCP server configurations. Default: false."),
1869
- settingSources: z.array(z.enum(["user", "project", "local"])).optional().describe(
1870
- "Which local config files to load. Default: ['user', 'project', 'local']. Pass [] to disable all."
1871
- ),
1872
- debug: z.boolean().optional().describe("Enable debug mode. Default: false."),
1873
- debugFile: z.string().optional().describe("Write debug logs to a file path (implicitly enables debug mode)."),
1874
- env: z.record(z.string(), z.string().optional()).optional().describe("Environment variables to merge with process.env.")
1875
- }).optional().describe(
1876
- "Low-frequency SDK options. All fields are optional with sensible defaults. Most callers can omit this entirely."
1877
- );
1847
+ tools: toolsConfigSchema.optional().describe("Visible tool set. Default: SDK"),
1848
+ persistSession: z.boolean().optional().describe("Default: true"),
1849
+ sessionInitTimeoutMs: z.number().int().positive().optional().describe("Default: 10000"),
1850
+ agents: z.record(z.string(), agentDefinitionSchema).optional().describe("Sub-agent definitions. Default: none"),
1851
+ agent: z.string().optional().describe("Primary agent name (from 'agents'). Default: none"),
1852
+ maxBudgetUsd: z.number().positive().optional().describe("Default: none"),
1853
+ effort: z.enum(EFFORT_LEVELS).optional().describe("Default: SDK"),
1854
+ betas: z.array(z.string()).optional().describe("Default: none"),
1855
+ additionalDirectories: z.array(z.string()).optional().describe("Default: none"),
1856
+ outputFormat: outputFormatSchema.optional().describe("Default: none (plain text)"),
1857
+ thinking: thinkingSchema.optional().describe("Default: SDK"),
1858
+ pathToClaudeCodeExecutable: z.string().optional().describe("Default: SDK-bundled"),
1859
+ mcpServers: z.record(z.string(), z.record(z.string(), z.unknown())).optional().describe("Default: none"),
1860
+ sandbox: z.record(z.string(), z.unknown()).optional().describe("Default: none"),
1861
+ fallbackModel: z.string().optional().describe("Default: none"),
1862
+ enableFileCheckpointing: z.boolean().optional().describe("Default: false"),
1863
+ includePartialMessages: z.boolean().optional().describe("Stream events to claude_code_check. Default: false"),
1864
+ strictMcpConfig: z.boolean().optional().describe("Default: false"),
1865
+ settingSources: z.array(z.enum(["user", "project", "local"])).optional().describe("Default: ['user','project','local']. [] = isolation mode"),
1866
+ debug: z.boolean().optional().describe("Default: false"),
1867
+ debugFile: z.string().optional().describe("Enables debug. Default: none"),
1868
+ env: z.record(z.string(), z.string().optional()).optional().describe("Merged with process.env. Default: none")
1869
+ }).optional().describe("Low-frequency SDK options (all optional)");
1878
1870
  server.tool(
1879
1871
  "claude_code",
1880
1872
  buildInternalToolsDescription(toolCache.getTools()),
1881
1873
  {
1882
- prompt: z.string().describe("The task or question for Claude Code"),
1883
- cwd: z.string().optional().describe("Working directory. Default: server cwd."),
1884
- allowedTools: z.array(z.string()).optional().describe(
1885
- "Tools the agent can use without asking for permission. Default: [] (no auto-approvals). Example: ['Bash', 'Read', 'Write', 'Edit']. Tools not listed here or in disallowedTools will trigger a permission request via claude_code_check."
1886
- ),
1887
- disallowedTools: z.array(z.string()).optional().describe(
1888
- "Tools the agent is forbidden from using. Default: [] (none). Takes priority over allowedTools."
1889
- ),
1890
- maxTurns: z.number().int().positive().optional().describe("Maximum number of reasoning steps the agent can take."),
1891
- model: z.string().optional().describe("Model to use, e.g. 'claude-sonnet-4-5-20250929'."),
1892
- systemPrompt: systemPromptSchema.optional().describe(
1893
- "Override the agent's system prompt. Pass a string for full replacement, or use {type: 'preset', preset: 'claude_code', append: '...'} to extend the default."
1894
- ),
1895
- permissionRequestTimeoutMs: z.number().int().positive().optional().describe(
1896
- "How long to wait (in ms) for a permission decision via claude_code_check before auto-denying. Default: 60000."
1897
- ),
1874
+ prompt: z.string().describe("Task or question"),
1875
+ cwd: z.string().optional().describe("Working directory. Default: server cwd"),
1876
+ allowedTools: z.array(z.string()).optional().describe("Auto-approved tools, e.g. ['Bash','Read','Write','Edit']. Default: []"),
1877
+ disallowedTools: z.array(z.string()).optional().describe("Forbidden tools (priority over allowedTools). Default: []"),
1878
+ maxTurns: z.number().int().positive().optional().describe("Default: SDK"),
1879
+ model: z.string().optional().describe("e.g. 'opus'. Default: SDK"),
1880
+ systemPrompt: systemPromptSchema.optional().describe("Default: SDK"),
1881
+ permissionRequestTimeoutMs: z.number().int().positive().optional().describe("Auto-deny timeout (ms). Default: 60000"),
1898
1882
  advanced: advancedOptionsSchema
1899
1883
  },
1900
1884
  async (args, extra) => {
@@ -1946,49 +1930,43 @@ Defaults:
1946
1930
 
1947
1931
  Disk resume: If the server restarted and the session is no longer in memory, set CLAUDE_CODE_MCP_ALLOW_DISK_RESUME=1 to let the agent resume from its on-disk transcript. Pass diskResumeConfig with resumeToken and session parameters.`,
1948
1932
  {
1949
- sessionId: z.string().describe("The session ID to continue (from a previous claude_code call)"),
1950
- prompt: z.string().describe("Follow-up prompt or instruction"),
1951
- forkSession: z.boolean().optional().describe(
1952
- "Branch this session into a new copy that diverges from the current point. The original session remains unchanged. Default: false."
1953
- ),
1954
- sessionInitTimeoutMs: z.number().int().positive().optional().describe("How long to wait (in ms) for a forked session to initialize. Default: 10000."),
1955
- permissionRequestTimeoutMs: z.number().int().positive().optional().describe(
1956
- "How long to wait (in ms) for a permission decision via claude_code_check before auto-denying. Default: 60000."
1957
- ),
1933
+ sessionId: z.string().describe("Session ID from claude_code"),
1934
+ prompt: z.string().describe("Follow-up message"),
1935
+ forkSession: z.boolean().optional().describe("Branch into new session copy. Default: false"),
1936
+ sessionInitTimeoutMs: z.number().int().positive().optional().describe("Fork init timeout (ms). Default: 10000"),
1937
+ permissionRequestTimeoutMs: z.number().int().positive().optional().describe("Auto-deny timeout (ms). Default: 60000"),
1958
1938
  diskResumeConfig: z.object({
1959
- resumeToken: z.string().optional().describe(
1960
- "Resume token returned by claude_code / claude_code_reply. Required for disk resume."
1961
- ),
1962
- cwd: z.string().optional().describe("Working directory. Required for disk resume."),
1963
- allowedTools: z.array(z.string()).optional().describe("Tools the agent can use without permission."),
1964
- disallowedTools: z.array(z.string()).optional().describe("Tools the agent is forbidden from using."),
1965
- tools: toolsConfigSchema.optional().describe("Which tools the agent can see."),
1966
- persistSession: z.boolean().optional().describe("Persist session history to disk. Default: true."),
1967
- maxTurns: z.number().int().positive().optional().describe("Maximum reasoning steps."),
1968
- model: z.string().optional().describe("Model to use."),
1969
- systemPrompt: systemPromptSchema.optional().describe("Override the agent's system prompt."),
1970
- agents: z.record(z.string(), agentDefinitionSchema).optional().describe("Define custom sub-agents."),
1971
- agent: z.string().optional().describe("Name of a custom agent to use as primary."),
1972
- maxBudgetUsd: z.number().positive().optional().describe("Maximum budget in USD."),
1973
- effort: z.enum(EFFORT_LEVELS).optional().describe("Effort level."),
1974
- betas: z.array(z.string()).optional().describe("Beta features to enable."),
1975
- additionalDirectories: z.array(z.string()).optional().describe("Additional accessible directories."),
1976
- outputFormat: outputFormatSchema.optional().describe("Structured output format."),
1977
- thinking: thinkingSchema.optional().describe("Thinking mode configuration."),
1978
- resumeSessionAt: z.string().optional().describe("Resume only up to a specific message UUID."),
1979
- pathToClaudeCodeExecutable: z.string().optional().describe("Path to the Claude Code executable."),
1980
- mcpServers: z.record(z.string(), z.record(z.string(), z.unknown())).optional().describe("MCP server configurations."),
1981
- sandbox: z.record(z.string(), z.unknown()).optional().describe("Sandbox configuration."),
1982
- fallbackModel: z.string().optional().describe("Fallback model."),
1983
- enableFileCheckpointing: z.boolean().optional().describe("Enable file checkpointing. Default: false."),
1984
- includePartialMessages: z.boolean().optional().describe("Include intermediate messages as events. Default: false."),
1985
- strictMcpConfig: z.boolean().optional().describe("Enforce strict MCP validation. Default: false."),
1986
- settingSources: z.array(z.enum(["user", "project", "local"])).optional().describe("Which local config files to load."),
1987
- debug: z.boolean().optional().describe("Enable debug mode. Default: false."),
1988
- debugFile: z.string().optional().describe("Write debug logs to a file path."),
1989
- env: z.record(z.string(), z.string().optional()).optional().describe("Environment variables to merge with process.env.")
1939
+ resumeToken: z.string().optional().describe("Required"),
1940
+ cwd: z.string().optional().describe("Required"),
1941
+ allowedTools: z.array(z.string()).optional().describe("Default: []"),
1942
+ disallowedTools: z.array(z.string()).optional().describe("Default: []"),
1943
+ tools: toolsConfigSchema.optional().describe("Default: SDK"),
1944
+ persistSession: z.boolean().optional().describe("Default: true"),
1945
+ maxTurns: z.number().int().positive().optional().describe("Default: SDK"),
1946
+ model: z.string().optional().describe("Default: SDK"),
1947
+ systemPrompt: systemPromptSchema.optional().describe("Default: SDK"),
1948
+ agents: z.record(z.string(), agentDefinitionSchema).optional().describe("Default: none"),
1949
+ agent: z.string().optional().describe("Default: none"),
1950
+ maxBudgetUsd: z.number().positive().optional().describe("Default: none"),
1951
+ effort: z.enum(EFFORT_LEVELS).optional().describe("Default: SDK"),
1952
+ betas: z.array(z.string()).optional().describe("Default: none"),
1953
+ additionalDirectories: z.array(z.string()).optional().describe("Default: none"),
1954
+ outputFormat: outputFormatSchema.optional().describe("Default: none"),
1955
+ thinking: thinkingSchema.optional().describe("Default: SDK"),
1956
+ resumeSessionAt: z.string().optional().describe("Resume to specific message UUID. Default: none"),
1957
+ pathToClaudeCodeExecutable: z.string().optional().describe("Default: SDK-bundled"),
1958
+ mcpServers: z.record(z.string(), z.record(z.string(), z.unknown())).optional().describe("Default: none"),
1959
+ sandbox: z.record(z.string(), z.unknown()).optional().describe("Default: none"),
1960
+ fallbackModel: z.string().optional().describe("Default: none"),
1961
+ enableFileCheckpointing: z.boolean().optional().describe("Default: false"),
1962
+ includePartialMessages: z.boolean().optional().describe("Stream events to claude_code_check. Default: false"),
1963
+ strictMcpConfig: z.boolean().optional().describe("Default: false"),
1964
+ settingSources: z.array(z.enum(["user", "project", "local"])).optional().describe("Default: ['user','project','local']. [] = isolation mode"),
1965
+ debug: z.boolean().optional().describe("Default: false"),
1966
+ debugFile: z.string().optional().describe("Enables debug. Default: none"),
1967
+ env: z.record(z.string(), z.string().optional()).optional().describe("Default: none")
1990
1968
  }).optional().describe(
1991
- "Disk resume fallback configuration. Only needed when CLAUDE_CODE_MCP_ALLOW_DISK_RESUME=1 and the in-memory session is missing. Contains resumeToken + all session config overrides."
1969
+ "Disk resume config (needs CLAUDE_CODE_MCP_ALLOW_DISK_RESUME=1). Requires resumeToken + cwd."
1992
1970
  )
1993
1971
  },
1994
1972
  async (args, extra) => {
@@ -2026,11 +2004,9 @@ Disk resume: If the server restarted and the session is no longer in memory, set
2026
2004
  - action="get": Get full details for one session (pass sessionId). Add includeSensitive=true to also see cwd, systemPrompt, agents, and additionalDirectories.
2027
2005
  - action="cancel": Stop a running session immediately (pass sessionId).`,
2028
2006
  {
2029
- action: z.enum(SESSION_ACTIONS).describe("Action to perform: 'list', 'get', or 'cancel'"),
2030
- sessionId: z.string().optional().describe("Session ID (required for 'get' and 'cancel')"),
2031
- includeSensitive: z.boolean().optional().describe(
2032
- "When true, includes sensitive fields (cwd, systemPrompt, agents, additionalDirectories) in the response. Default: false."
2033
- )
2007
+ action: z.enum(SESSION_ACTIONS),
2008
+ sessionId: z.string().optional().describe("Required for 'get' and 'cancel'"),
2009
+ includeSensitive: z.boolean().optional().describe("Include cwd/systemPrompt/agents/additionalDirectories. Default: false")
2034
2010
  },
2035
2011
  async (args) => {
2036
2012
  const result = executeClaudeCodeSession(args, sessionManager);
@@ -2066,58 +2042,30 @@ action="respond_permission" \u2014 Approve or deny a pending permission request.
2066
2042
  Approving resumes agent execution. Denying (with optional interrupt=true) can halt the entire session.
2067
2043
  The response also includes the latest poll state (events, status, etc.), so a separate poll call is not needed.`,
2068
2044
  {
2069
- action: z.enum(CHECK_ACTIONS).describe('Action to perform: "poll" or "respond_permission"'),
2070
- sessionId: z.string().describe("Session ID to check"),
2071
- cursor: z.number().int().nonnegative().optional().describe(
2072
- "Event cursor for incremental polling. Pass nextCursor from the previous poll response."
2073
- ),
2074
- responseMode: z.enum(CHECK_RESPONSE_MODES).optional().describe("Response shaping preset. 'minimal' reduces payload size. Default: 'minimal'."),
2075
- maxEvents: z.number().int().positive().optional().describe(
2076
- "Max number of events to return per poll (pagination via nextCursor). Default: 200 in minimal mode."
2077
- ),
2078
- requestId: z.string().optional().describe(
2079
- "The permission request ID to respond to (from the actions array). Required for respond_permission."
2080
- ),
2081
- decision: z.enum(["allow", "deny"]).optional().describe(
2082
- "Whether to approve or reject the permission request. Required for respond_permission."
2083
- ),
2084
- denyMessage: z.string().optional().describe(
2085
- "Reason for denying, shown to the agent. Only used with decision='deny'. Default: 'Permission denied by caller'."
2086
- ),
2087
- interrupt: z.boolean().optional().describe(
2088
- "When true with decision='deny', stops the entire agent session. Default: false."
2089
- ),
2045
+ action: z.enum(CHECK_ACTIONS),
2046
+ sessionId: z.string().describe("Target session ID"),
2047
+ cursor: z.number().int().nonnegative().optional().describe("Event offset for incremental poll. Default: 0"),
2048
+ responseMode: z.enum(CHECK_RESPONSE_MODES).optional().describe("Default: 'minimal'"),
2049
+ maxEvents: z.number().int().positive().optional().describe("Events per poll. Default: 200 (minimal)"),
2050
+ requestId: z.string().optional().describe("Permission request ID (from actions[])"),
2051
+ decision: z.enum(["allow", "deny"]).optional().describe("For respond_permission"),
2052
+ denyMessage: z.string().optional().describe("Reason shown to agent on deny. Default: 'Permission denied by caller'"),
2053
+ interrupt: z.boolean().optional().describe("Stop session on deny. Default: false"),
2090
2054
  pollOptions: z.object({
2091
- includeTools: z.boolean().optional().describe("Include availableTools array from session init. Default: false."),
2092
- includeEvents: z.boolean().optional().describe(
2093
- "When false, omits the events array (nextCursor still advances). Default: true."
2094
- ),
2095
- includeActions: z.boolean().optional().describe("When false, omits actions[] even if waiting_permission. Default: true."),
2096
- includeResult: z.boolean().optional().describe("When false, omits the top-level result when idle/error. Default: true."),
2097
- includeUsage: z.boolean().optional().describe("Include AgentResult.usage. Default: true in full mode, false in minimal."),
2098
- includeModelUsage: z.boolean().optional().describe(
2099
- "Include AgentResult.modelUsage. Default: true in full mode, false in minimal."
2100
- ),
2101
- includeStructuredOutput: z.boolean().optional().describe(
2102
- "Include AgentResult.structuredOutput. Default: true in full mode, false in minimal."
2103
- ),
2104
- includeTerminalEvents: z.boolean().optional().describe(
2105
- "Include terminal result/error events in events stream. Default: true in full, false in minimal."
2106
- ),
2107
- includeProgressEvents: z.boolean().optional().describe(
2108
- "Include progress events (tool_progress, auth_status). Default: true in full, false in minimal."
2109
- )
2110
- }).optional().describe(
2111
- "Fine-grained poll control. Overrides responseMode defaults for individual fields. Most callers can omit this."
2112
- ),
2055
+ includeTools: z.boolean().optional().describe("Default: false"),
2056
+ includeEvents: z.boolean().optional().describe("Default: true"),
2057
+ includeActions: z.boolean().optional().describe("Default: true"),
2058
+ includeResult: z.boolean().optional().describe("Default: true"),
2059
+ includeUsage: z.boolean().optional().describe("Default: full=true, minimal=false"),
2060
+ includeModelUsage: z.boolean().optional().describe("Default: full=true, minimal=false"),
2061
+ includeStructuredOutput: z.boolean().optional().describe("Default: full=true, minimal=false"),
2062
+ includeTerminalEvents: z.boolean().optional().describe("Default: full=true, minimal=false"),
2063
+ includeProgressEvents: z.boolean().optional().describe("Default: full=true, minimal=false")
2064
+ }).optional().describe("Override responseMode defaults"),
2113
2065
  permissionOptions: z.object({
2114
- updatedInput: z.record(z.string(), z.unknown()).optional().describe(
2115
- "Modified tool input to use instead of the original. Only with decision='allow'."
2116
- ),
2117
- updatedPermissions: z.array(z.record(z.string(), z.unknown())).optional().describe("Permission rule updates to apply. Only with decision='allow'.")
2118
- }).optional().describe(
2119
- "Advanced permission response options. Only used with respond_permission + decision='allow'."
2120
- )
2066
+ updatedInput: z.record(z.string(), z.unknown()).optional().describe("Replace tool input on allow. Default: none"),
2067
+ updatedPermissions: z.array(z.record(z.string(), z.unknown())).optional().describe("Update permission rules on allow. Default: none")
2068
+ }).optional().describe("Allow-only: modify tool input or update rules")
2121
2069
  },
2122
2070
  async (args) => {
2123
2071
  const result = executeClaudeCodeCheck(args, sessionManager, toolCache);