@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/CHANGELOG.md +1 -0
- package/README.md +110 -110
- package/dist/index.js +95 -147
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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.
|
|
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("
|
|
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()
|
|
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())
|
|
1844
|
+
schema: z.record(z.string(), z.unknown())
|
|
1845
1845
|
});
|
|
1846
1846
|
const advancedOptionsSchema = z.object({
|
|
1847
|
-
tools: toolsConfigSchema.optional().describe(
|
|
1848
|
-
|
|
1849
|
-
),
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
),
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
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("
|
|
1883
|
-
cwd: z.string().optional().describe("Working directory. Default: server cwd
|
|
1884
|
-
allowedTools: z.array(z.string()).optional().describe(
|
|
1885
|
-
|
|
1886
|
-
),
|
|
1887
|
-
|
|
1888
|
-
|
|
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("
|
|
1950
|
-
prompt: z.string().describe("Follow-up
|
|
1951
|
-
forkSession: z.boolean().optional().describe(
|
|
1952
|
-
|
|
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
|
-
|
|
1961
|
-
),
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
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
|
|
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)
|
|
2030
|
-
sessionId: z.string().optional().describe("
|
|
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)
|
|
2070
|
-
sessionId: z.string().describe("
|
|
2071
|
-
cursor: z.number().int().nonnegative().optional().describe(
|
|
2072
|
-
|
|
2073
|
-
),
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
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("
|
|
2092
|
-
includeEvents: z.boolean().optional().describe(
|
|
2093
|
-
|
|
2094
|
-
),
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
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
|
-
|
|
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);
|