@lucascouts/claude-agent-acp-plus 0.39.2 → 0.40.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.
@@ -0,0 +1,30 @@
1
+ import type { Options } from "@anthropic-ai/claude-agent-sdk";
2
+ /** How an option reaches the Claude CLI: in a flag, or over stdin in the SDK's initialize request. */
3
+ export type CliDelivery = NonNullable<Options["mcpServersDelivery"]>;
4
+ /**
5
+ * The SDK options that say how a session's MCP servers and its `settings` reach the Claude CLI.
6
+ * Ported from upstream claude-agent-acp #1647 and #1669 (`src/claude-cli.ts` `cliDelivery()`).
7
+ *
8
+ * Why: with the SDK default (`'argv'`) the client's MCP servers travel in one `--mcp-config` flag
9
+ * and the settings in `--settings`, so every stdio server's `env` and every remote server's
10
+ * `headers` (API keys, bearer tokens) sit on the CLI's command line, where any other user of the
11
+ * machine can read them in `/proc/<pid>/cmdline` (SDK 0.3.326 `sdk.d.ts`, `mcpServersDelivery`).
12
+ *
13
+ * - `'initialize'` for the CLI bundled with the SDK (the one plus spawns unless
14
+ * `CLAUDE_CODE_EXECUTABLE` is set): over stdin, in the SDK's initialize request.
15
+ * - `'argv'` for a CLI that `CLAUDE_CODE_EXECUTABLE` names: its version is unknown, and a CLI too
16
+ * old to read them over stdin fails the session at startup (CLI 2.1.323: "too old to read MCP
17
+ * servers from the initialize request", "unknown option '--initialize-fields=settings'").
18
+ * - `settings` stay `'argv'` when the client's `extraArgs` carry `settings` (the CLI refuses both
19
+ * at once: "--initialize-fields=settings cannot be used with --settings") or `sdk-url` (such a
20
+ * session cannot read the request at launch, and the SDK keeps its MCP servers in the flag too).
21
+ *
22
+ * The SDK reads `settingsDelivery` (0.3.328) without declaring it in `sdk.d.ts`, so nothing fails
23
+ * to compile if a later SDK drops it. Spread before the client's own options, so a client's
24
+ * explicit `mcpServersDelivery`/`settingsDelivery` wins.
25
+ */
26
+ export declare function cliDelivery(clientExtraArgs: Options["extraArgs"], env?: Record<string, string | undefined>): {
27
+ mcpServersDelivery: CliDelivery;
28
+ settingsDelivery: CliDelivery;
29
+ };
30
+ //# sourceMappingURL=cli-delivery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-delivery.d.ts","sourceRoot":"","sources":["../src/cli-delivery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAE9D,sGAAsG;AACtG,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,WAAW,CACzB,eAAe,EAAE,OAAO,CAAC,WAAW,CAAC,EACrC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GACpD;IAAE,kBAAkB,EAAE,WAAW,CAAC;IAAC,gBAAgB,EAAE,WAAW,CAAA;CAAE,CAMpE"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The SDK options that say how a session's MCP servers and its `settings` reach the Claude CLI.
3
+ * Ported from upstream claude-agent-acp #1647 and #1669 (`src/claude-cli.ts` `cliDelivery()`).
4
+ *
5
+ * Why: with the SDK default (`'argv'`) the client's MCP servers travel in one `--mcp-config` flag
6
+ * and the settings in `--settings`, so every stdio server's `env` and every remote server's
7
+ * `headers` (API keys, bearer tokens) sit on the CLI's command line, where any other user of the
8
+ * machine can read them in `/proc/<pid>/cmdline` (SDK 0.3.326 `sdk.d.ts`, `mcpServersDelivery`).
9
+ *
10
+ * - `'initialize'` for the CLI bundled with the SDK (the one plus spawns unless
11
+ * `CLAUDE_CODE_EXECUTABLE` is set): over stdin, in the SDK's initialize request.
12
+ * - `'argv'` for a CLI that `CLAUDE_CODE_EXECUTABLE` names: its version is unknown, and a CLI too
13
+ * old to read them over stdin fails the session at startup (CLI 2.1.323: "too old to read MCP
14
+ * servers from the initialize request", "unknown option '--initialize-fields=settings'").
15
+ * - `settings` stay `'argv'` when the client's `extraArgs` carry `settings` (the CLI refuses both
16
+ * at once: "--initialize-fields=settings cannot be used with --settings") or `sdk-url` (such a
17
+ * session cannot read the request at launch, and the SDK keeps its MCP servers in the flag too).
18
+ *
19
+ * The SDK reads `settingsDelivery` (0.3.328) without declaring it in `sdk.d.ts`, so nothing fails
20
+ * to compile if a later SDK drops it. Spread before the client's own options, so a client's
21
+ * explicit `mcpServersDelivery`/`settingsDelivery` wins.
22
+ */
23
+ export function cliDelivery(clientExtraArgs, env = process.env) {
24
+ const delivery = env.CLAUDE_CODE_EXECUTABLE ? "argv" : "initialize";
25
+ const settingsInFlag = Object.keys(clientExtraArgs ?? {}).some((name) => name === "settings" || name === "sdk-url" || name.startsWith("sdk-url="));
26
+ return { mcpServersDelivery: delivery, settingsDelivery: settingsInFlag ? "argv" : delivery };
27
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The MCP servers a client declares in `session/new` (and load, resume, fork),
3
+ * mapped onto the Claude SDK's `mcpServers` option.
4
+ *
5
+ * Before §6.69 an entry Plus could not map vanished without a trace: an `acp`
6
+ * entry from a client that speaks MCP-over-ACP looked, from the client's side,
7
+ * like a server the agent had accepted. Every entry that does not reach the SDK
8
+ * is now returned with the reason, for the caller to log; this module only maps.
9
+ */
10
+ import type { NewSessionRequest } from "@agentclientprotocol/sdk/unstable";
11
+ import type { McpServerConfig } from "@anthropic-ai/claude-agent-sdk";
12
+ import { type McpOverAcpRequest } from "./mcp-over-acp.js";
13
+ import type { Logger } from "./acp-agent.js";
14
+ export type ClientMcpServerDrop = {
15
+ name: string;
16
+ /** The entry's `type`, or `stdio` for a typeless entry. */
17
+ transport: string;
18
+ reason:
19
+ /** `type: "acp"`, but this connection cannot carry `mcp/message`. */
20
+ "no-acp-bridge"
21
+ /** A transport Plus does not know. */
22
+ | "unsupported-transport"
23
+ /** The name is taken by a server Plus registers itself. */
24
+ | "reserved-name";
25
+ };
26
+ export type ClientMcpServersDeps = {
27
+ sessionId: string;
28
+ /** Present when the connection can send `mcp/message` to the client. */
29
+ requestMcp?: McpOverAcpRequest;
30
+ /** Names Plus registers itself; a client entry cannot replace one. */
31
+ reservedNames: ReadonlySet<string>;
32
+ logger: Logger;
33
+ };
34
+ export declare function mapClientMcpServers(servers: NewSessionRequest["mcpServers"] | undefined, deps: ClientMcpServersDeps): {
35
+ servers: Record<string, McpServerConfig>;
36
+ dropped: ClientMcpServerDrop[];
37
+ };
38
+ /** One `key=value` line per dropped entry. Never the command, arguments,
39
+ * environment, URL or headers: any of them can carry a credential (§6.64 found
40
+ * an API key in an extension's argv). */
41
+ export declare function logDroppedClientMcpServers(logger: Logger, sessionId: string, dropped: readonly ClientMcpServerDrop[]): void;
42
+ //# sourceMappingURL=client-mcp-servers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-mcp-servers.d.ts","sourceRoot":"","sources":["../src/client-mcp-servers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAsB,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM;IACJ,qEAAqE;IACnE,eAAe;IACjB,sCAAsC;OACpC,uBAAuB;IACzB,2DAA2D;OACzD,eAAe,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,sEAAsE;IACtE,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,iBAAiB,CAAC,YAAY,CAAC,GAAG,SAAS,EACpD,IAAI,EAAE,oBAAoB,GACzB;IAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAAC,OAAO,EAAE,mBAAmB,EAAE,CAAA;CAAE,CAiD9E;AAED;;0CAE0C;AAC1C,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,SAAS,mBAAmB,EAAE,GACtC,IAAI,CAMN"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * The MCP servers a client declares in `session/new` (and load, resume, fork),
3
+ * mapped onto the Claude SDK's `mcpServers` option.
4
+ *
5
+ * Before §6.69 an entry Plus could not map vanished without a trace: an `acp`
6
+ * entry from a client that speaks MCP-over-ACP looked, from the client's side,
7
+ * like a server the agent had accepted. Every entry that does not reach the SDK
8
+ * is now returned with the reason, for the caller to log; this module only maps.
9
+ */
10
+ import { acpMcpServerConfig } from "./mcp-over-acp.js";
11
+ export function mapClientMcpServers(servers, deps) {
12
+ const mapped = {};
13
+ const dropped = [];
14
+ if (!Array.isArray(servers))
15
+ return { servers: mapped, dropped };
16
+ for (const server of servers) {
17
+ // Read through `unknown`: the point is to cope with entries the schema in
18
+ // this build does not describe.
19
+ const entry = server;
20
+ const name = typeof entry.name === "string" ? entry.name : String(entry.name);
21
+ const type = "type" in entry ? String(entry.type) : undefined;
22
+ const transport = type ?? "stdio";
23
+ if (deps.reservedNames.has(name)) {
24
+ dropped.push({ name, transport, reason: "reserved-name" });
25
+ continue;
26
+ }
27
+ if ("type" in server && (server.type === "http" || server.type === "sse")) {
28
+ mapped[name] = {
29
+ type: server.type,
30
+ url: server.url,
31
+ headers: server.headers
32
+ ? Object.fromEntries(server.headers.map((e) => [e.name, e.value]))
33
+ : undefined,
34
+ };
35
+ }
36
+ else if (!("type" in server)) {
37
+ // Stdio: the ACP schema gives it no `type` field.
38
+ mapped[name] = {
39
+ type: "stdio",
40
+ command: server.command,
41
+ args: server.args,
42
+ env: server.env ? Object.fromEntries(server.env.map((e) => [e.name, e.value])) : undefined,
43
+ };
44
+ }
45
+ else if (server.type === "acp") {
46
+ if (!deps.requestMcp) {
47
+ dropped.push({ name, transport, reason: "no-acp-bridge" });
48
+ continue;
49
+ }
50
+ mapped[name] = acpMcpServerConfig({
51
+ name,
52
+ serverId: server.serverId,
53
+ sessionId: deps.sessionId,
54
+ request: deps.requestMcp,
55
+ logger: deps.logger,
56
+ });
57
+ }
58
+ else {
59
+ dropped.push({ name, transport, reason: "unsupported-transport" });
60
+ }
61
+ }
62
+ return { servers: mapped, dropped };
63
+ }
64
+ /** One `key=value` line per dropped entry. Never the command, arguments,
65
+ * environment, URL or headers: any of them can carry a credential (§6.64 found
66
+ * an API key in an extension's argv). */
67
+ export function logDroppedClientMcpServers(logger, sessionId, dropped) {
68
+ for (const drop of dropped) {
69
+ logger.log(`[mcp/servers] event=dropped level=warn sessionId=${sessionId} server=${JSON.stringify(drop.name)} transport=${JSON.stringify(drop.transport)} reason=${drop.reason}`);
70
+ }
71
+ }
@@ -137,4 +137,11 @@ export declare function refusalFallbackToCreateRequest(prompt: RefusalFallbackPr
137
137
  * switch the user didn't ask for.
138
138
  */
139
139
  export declare function refusalFallbackResultFromResponse(response: CreateElicitationResponse): string;
140
+ /**
141
+ * Whether `toolUseID` is the id of a question Claude Code asks on its own (its `confirmWithUser`),
142
+ * such as whether to download a connector's file (upstream #1644). It asks through `canUseTool` as
143
+ * AskUserQuestion under a `confirm_<uuid>` id and reads the answer from the callback's result: no
144
+ * tool_use and no tool_result of the stream carry that id, so nothing else ends its tool call.
145
+ */
146
+ export declare function isConfirmQuestion(toolUseID: string): boolean;
140
147
  //# sourceMappingURL=elicitation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"elicitation.d.ts","sourceRoot":"","sources":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,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,qBAAqB,GAAG,IAAI,CAW9B;AAYD;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,qBAAqB,EAC7B,SAAS,EAAE,MAAM,GAChB,wBAAwB,CA+B1B;AAED;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAAC,QAAQ,EAAE,yBAAyB,GAAG,MAAM,CAG7F;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE5D"}
@@ -351,3 +351,12 @@ export function refusalFallbackResultFromResponse(response) {
351
351
  const choice = acceptedElicitationContent(response)[REFUSAL_FALLBACK_CHOICE_KEY];
352
352
  return choice === RETRY_FALLBACK_RESULT ? RETRY_FALLBACK_RESULT : KEEP_REFUSAL_RESULT;
353
353
  }
354
+ /**
355
+ * Whether `toolUseID` is the id of a question Claude Code asks on its own (its `confirmWithUser`),
356
+ * such as whether to download a connector's file (upstream #1644). It asks through `canUseTool` as
357
+ * AskUserQuestion under a `confirm_<uuid>` id and reads the answer from the callback's result: no
358
+ * tool_use and no tool_result of the stream carry that id, so nothing else ends its tool call.
359
+ */
360
+ export function isConfirmQuestion(toolUseID) {
361
+ return toolUseID.startsWith("confirm_");
362
+ }
@@ -0,0 +1,83 @@
1
+ /**
2
+ * MCP-over-ACP, agent side (§6.69 step 3 / §6.13's plus half).
3
+ *
4
+ * A client such as Zeo can declare an MCP server with `type: "acp"` in
5
+ * `session/new`: the server keeps running inside the client, and the agent
6
+ * reaches it by sending `mcp/message` requests back over the ACP connection it
7
+ * already has. No second process, no API key in an agent's argv, and it works
8
+ * for a jailed agent that cannot see the client's files or sockets.
9
+ *
10
+ * The Claude CLI cannot speak that binding itself, so each declared server is
11
+ * handed to the Claude SDK as an in-process `sdk` server whose `instance` is the
12
+ * proxy below. The CLI speaks ordinary, stateful MCP to it over the SDK's
13
+ * in-process transport; the proxy translates to the binding, which is MCP
14
+ * 2026-07-28 and stateless (ACP SDK 2.6.0 `mcp/core.d.ts`; Rust ACP 5.4.0
15
+ * `mcp_server/active_session.rs` rejects `initialize`):
16
+ *
17
+ * - `initialize` is answered here, from one `server/discover` sent to the client.
18
+ * Discovery is what the stateless revision has instead of a handshake.
19
+ * - `ping` is answered here; `notifications/initialized` is absorbed.
20
+ * - every other request is forwarded verbatim through `McpOverAcpCaller`, which
21
+ * adds the per-request protocol `_meta` the binding requires. It is a generic
22
+ * pass-through on purpose: `tools/*`, `resources/*`, `prompts/*` and
23
+ * `completion/complete` need no per-method code, and a method added to MCP later
24
+ * reaches the server without a change here.
25
+ * - `notifications/cancelled` aborts the forwarded request; the request-scoped
26
+ * notifications the server sends back (progress) are relayed to the CLI.
27
+ *
28
+ * Not in this version: change notifications (`list_changed`, resource updates).
29
+ * Over the binding a notification belongs to an active request, so a server
30
+ * that adds tools mid-session is only seen by the next session. The
31
+ * capabilities the proxy reports therefore withhold `listChanged` and
32
+ * `subscribe`, so the CLI does not wait for events that cannot arrive.
33
+ */
34
+ import type { McpOutcome, McpRequestOptions } from "@agentclientprotocol/sdk/unstable";
35
+ import type { McpSdkServerConfigWithInstance } from "@anthropic-ai/claude-agent-sdk";
36
+ import type { Logger } from "./acp-agent.js";
37
+ /** Sends one MCP request to a server the client declared over ACP; resolves with
38
+ * the inner MCP outcome and rejects on an outer ACP/binding failure. */
39
+ export type McpOverAcpRequest = (serverId: string, method: string, params: Record<string, unknown> | undefined, options: Pick<McpRequestOptions, "signal" | "onNotification">) => Promise<McpOutcome>;
40
+ /** The subset of the MCP SDK's `Transport` that the Claude SDK hands to an
41
+ * `sdk` server's `instance.connect` (sdk.mjs `connectSdkMcpServer`). Typed here
42
+ * so Plus does not import `@modelcontextprotocol/sdk`, which it only has as a
43
+ * dependency of the Claude SDK. */
44
+ type InProcessTransport = {
45
+ start(): Promise<void>;
46
+ send(message: JsonRpcMessage): Promise<void>;
47
+ close(): Promise<void>;
48
+ onmessage?: (message: JsonRpcMessage) => void;
49
+ onclose?: () => void;
50
+ onerror?: (error: Error) => void;
51
+ };
52
+ type JsonRpcId = string | number;
53
+ type JsonRpcMessage = {
54
+ jsonrpc: "2.0";
55
+ id?: JsonRpcId;
56
+ method?: string;
57
+ params?: Record<string, unknown>;
58
+ result?: unknown;
59
+ error?: {
60
+ code: number;
61
+ message: string;
62
+ data?: unknown;
63
+ };
64
+ };
65
+ export type AcpMcpProxyOptions = {
66
+ /** The name the client declared; it is also the SDK server's name. */
67
+ name: string;
68
+ serverId: string;
69
+ sessionId: string;
70
+ request: McpOverAcpRequest;
71
+ logger: Logger;
72
+ };
73
+ /** Builds the SDK server config for one ACP-declared MCP server. */
74
+ export declare function acpMcpServerConfig(options: AcpMcpProxyOptions): McpSdkServerConfigWithInstance;
75
+ /** The proxy object. `connect` may be called more than once — a query that is
76
+ * recreated mid-session (model or thinking swap) reuses the same options — and
77
+ * each transport gets its own in-flight table. Discovery is shared. */
78
+ export declare function createAcpMcpProxy(options: AcpMcpProxyOptions): {
79
+ connect(transport: InProcessTransport): Promise<void>;
80
+ close(): Promise<void>;
81
+ };
82
+ export {};
83
+ //# sourceMappingURL=mcp-over-acp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-over-acp.d.ts","sourceRoot":"","sources":["../src/mcp-over-acp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAEV,UAAU,EACV,iBAAiB,EAClB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AACrF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C;yEACyE;AACzE,MAAM,MAAM,iBAAiB,GAAG,CAC9B,QAAQ,EAAE,MAAM,EAChB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AWF,oEAAoE;AACpE,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,GAAG,8BAA8B,CAS9F;AAED;;wEAEwE;AACxE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB;uBAgDhC,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;aA0F5C,OAAO,CAAC,IAAI,CAAC;EAE/B"}
@@ -0,0 +1,208 @@
1
+ /**
2
+ * MCP-over-ACP, agent side (§6.69 step 3 / §6.13's plus half).
3
+ *
4
+ * A client such as Zeo can declare an MCP server with `type: "acp"` in
5
+ * `session/new`: the server keeps running inside the client, and the agent
6
+ * reaches it by sending `mcp/message` requests back over the ACP connection it
7
+ * already has. No second process, no API key in an agent's argv, and it works
8
+ * for a jailed agent that cannot see the client's files or sockets.
9
+ *
10
+ * The Claude CLI cannot speak that binding itself, so each declared server is
11
+ * handed to the Claude SDK as an in-process `sdk` server whose `instance` is the
12
+ * proxy below. The CLI speaks ordinary, stateful MCP to it over the SDK's
13
+ * in-process transport; the proxy translates to the binding, which is MCP
14
+ * 2026-07-28 and stateless (ACP SDK 2.6.0 `mcp/core.d.ts`; Rust ACP 5.4.0
15
+ * `mcp_server/active_session.rs` rejects `initialize`):
16
+ *
17
+ * - `initialize` is answered here, from one `server/discover` sent to the client.
18
+ * Discovery is what the stateless revision has instead of a handshake.
19
+ * - `ping` is answered here; `notifications/initialized` is absorbed.
20
+ * - every other request is forwarded verbatim through `McpOverAcpCaller`, which
21
+ * adds the per-request protocol `_meta` the binding requires. It is a generic
22
+ * pass-through on purpose: `tools/*`, `resources/*`, `prompts/*` and
23
+ * `completion/complete` need no per-method code, and a method added to MCP later
24
+ * reaches the server without a change here.
25
+ * - `notifications/cancelled` aborts the forwarded request; the request-scoped
26
+ * notifications the server sends back (progress) are relayed to the CLI.
27
+ *
28
+ * Not in this version: change notifications (`list_changed`, resource updates).
29
+ * Over the binding a notification belongs to an active request, so a server
30
+ * that adds tools mid-session is only seen by the next session. The
31
+ * capabilities the proxy reports therefore withhold `listChanged` and
32
+ * `subscribe`, so the CLI does not wait for events that cannot arrive.
33
+ */
34
+ /** The fallback when the CLI names no revision (it always does today). */
35
+ const FALLBACK_PROTOCOL_VERSION = "2025-11-25";
36
+ /** JSON-RPC internal error, for an outer failure with no usable code. */
37
+ const INTERNAL_ERROR = -32603;
38
+ /** Builds the SDK server config for one ACP-declared MCP server. */
39
+ export function acpMcpServerConfig(options) {
40
+ return {
41
+ type: "sdk",
42
+ name: options.name,
43
+ // The Claude SDK only ever calls `instance.connect(transport)` on an sdk
44
+ // server (sdk.mjs `connectSdkMcpServer`); the MCP SDK's `McpServer` class
45
+ // is the declared type, not a requirement.
46
+ instance: createAcpMcpProxy(options),
47
+ };
48
+ }
49
+ /** The proxy object. `connect` may be called more than once — a query that is
50
+ * recreated mid-session (model or thinking swap) reuses the same options — and
51
+ * each transport gets its own in-flight table. Discovery is shared. */
52
+ export function createAcpMcpProxy(options) {
53
+ const { name, serverId, sessionId, request, logger } = options;
54
+ let discovery;
55
+ const log = (event, fields) => logger.log(`[mcp/acp] event=${event} sessionId=${sessionId} server=${JSON.stringify(name)} serverId=${JSON.stringify(serverId)} ${fields}`);
56
+ /** An inner MCP error (a server that does not implement `server/discover`)
57
+ * falls back to a tools-only description. An outer failure (no
58
+ * registration, a broken binding) fails `initialize`, so the CLI marks the
59
+ * server failed and the session gets its "failed to start" notice instead
60
+ * of a server that answers nothing. */
61
+ function discover() {
62
+ discovery ??= request(serverId, "server/discover", {}, {}).then((outcome) => {
63
+ if ("result" in outcome && isObject(outcome.result)) {
64
+ const result = outcome.result;
65
+ return {
66
+ capabilities: withoutChangeNotifications(isObject(result.capabilities) ? result.capabilities : {}),
67
+ serverInfo: isObject(result.serverInfo) ? result.serverInfo : { name, version: "0" },
68
+ ...(typeof result.instructions === "string" && { instructions: result.instructions }),
69
+ };
70
+ }
71
+ const code = "error" in outcome ? outcome.error.code : "none";
72
+ log("discover-failed", `code=${code}`);
73
+ return fallbackDiscovery(name);
74
+ }, (error) => {
75
+ const code = errorCode(error);
76
+ log("discover-failed", `code=${code} outer=true`);
77
+ // Forget the failure so the next `initialize` (a reconnect) asks again.
78
+ discovery = undefined;
79
+ return {
80
+ failure: {
81
+ code: typeof code === "number" ? code : INTERNAL_ERROR,
82
+ message: `MCP server "${name}" over ACP: ${errorMessage(error)}`,
83
+ },
84
+ };
85
+ });
86
+ return discovery;
87
+ }
88
+ return {
89
+ async connect(transport) {
90
+ const inFlight = new Map();
91
+ const reply = (message) => transport.send({ jsonrpc: "2.0", ...message }).catch((error) => {
92
+ // The CLI closed the transport while a reply was pending: nothing to
93
+ // answer any more, and nothing the caller can do about it.
94
+ log("reply-dropped", `reason=${JSON.stringify(String(error))}`);
95
+ });
96
+ const forward = async (id, method, params) => {
97
+ const controller = new AbortController();
98
+ inFlight.set(id, controller);
99
+ const started = Date.now();
100
+ try {
101
+ const outcome = await request(serverId, method, params, {
102
+ signal: controller.signal,
103
+ onNotification: (notification) => void reply({
104
+ method: notification.method,
105
+ ...(notification.params ? { params: notification.params } : {}),
106
+ }),
107
+ });
108
+ const ms = Date.now() - started;
109
+ if ("result" in outcome) {
110
+ log("request", `method=${method} outcome=result ms=${ms}`);
111
+ await reply({ id, result: outcome.result ?? {} });
112
+ }
113
+ else {
114
+ log("request", `method=${method} outcome=error code=${outcome.error.code} ms=${ms}`);
115
+ await reply({ id, error: outcome.error });
116
+ }
117
+ }
118
+ catch (error) {
119
+ const code = errorCode(error);
120
+ log("request", `method=${method} outcome=failed code=${code} cancelled=${controller.signal.aborted} ms=${Date.now() - started}`);
121
+ await reply({
122
+ id,
123
+ error: {
124
+ code: typeof code === "number" ? code : INTERNAL_ERROR,
125
+ message: `MCP server "${name}" over ACP: ${errorMessage(error)}`,
126
+ },
127
+ });
128
+ }
129
+ finally {
130
+ inFlight.delete(id);
131
+ }
132
+ };
133
+ transport.onmessage = (message) => {
134
+ const { id, method } = message;
135
+ if (method === undefined)
136
+ return; // a response: the proxy never asks the CLI anything
137
+ if (id === undefined) {
138
+ if (method === "notifications/cancelled") {
139
+ const target = message.params?.requestId;
140
+ if (typeof target === "string" || typeof target === "number") {
141
+ inFlight.get(target)?.abort();
142
+ }
143
+ }
144
+ // `notifications/initialized` and anything else client-to-server: the
145
+ // binding is stateless, so there is no session to tell.
146
+ return;
147
+ }
148
+ if (method === "initialize") {
149
+ const requested = message.params?.protocolVersion;
150
+ void discover().then((server) => "failure" in server
151
+ ? reply({ id, error: server.failure })
152
+ : reply({
153
+ id,
154
+ result: {
155
+ protocolVersion: typeof requested === "string" ? requested : FALLBACK_PROTOCOL_VERSION,
156
+ ...server,
157
+ },
158
+ }));
159
+ return;
160
+ }
161
+ if (method === "ping") {
162
+ void reply({ id, result: {} });
163
+ return;
164
+ }
165
+ void forward(id, method, message.params);
166
+ };
167
+ transport.onclose = () => {
168
+ for (const controller of inFlight.values())
169
+ controller.abort();
170
+ inFlight.clear();
171
+ };
172
+ await transport.start();
173
+ },
174
+ async close() { },
175
+ };
176
+ }
177
+ function fallbackDiscovery(name) {
178
+ // Without discovery nothing is known; tools are the one capability every
179
+ // server the client proxies is expected to have, and an unsupported method
180
+ // comes back as an ordinary MCP error.
181
+ return { capabilities: { tools: {} }, serverInfo: { name, version: "0" } };
182
+ }
183
+ /** Drops `listChanged` and `subscribe`: see the module comment. */
184
+ function withoutChangeNotifications(capabilities) {
185
+ const out = {};
186
+ for (const [key, value] of Object.entries(capabilities)) {
187
+ if (isObject(value)) {
188
+ const rest = { ...value };
189
+ delete rest.listChanged;
190
+ delete rest.subscribe;
191
+ out[key] = rest;
192
+ }
193
+ else {
194
+ out[key] = value;
195
+ }
196
+ }
197
+ return out;
198
+ }
199
+ function isObject(value) {
200
+ return typeof value === "object" && value !== null && !Array.isArray(value);
201
+ }
202
+ function errorCode(error) {
203
+ const code = error?.code;
204
+ return typeof code === "number" ? code : "none";
205
+ }
206
+ function errorMessage(error) {
207
+ return error instanceof Error ? error.message : String(error);
208
+ }
@@ -0,0 +1,9 @@
1
+ import type { NewSessionRequest } from "@agentclientprotocol/sdk/unstable";
2
+ import type { SessionNotice } from "./session-notices.js";
3
+ /** The names of a session's client MCP servers: its ACP servers and `_meta.claudeCode.options.mcpServers`. */
4
+ export declare function clientMcpServerNames(params: NewSessionRequest): string[];
5
+ /** The same request with no client MCP servers, the `_meta` options' ones included. */
6
+ export declare function withoutClientMcpServers(params: NewSessionRequest): NewSessionRequest;
7
+ /** One notice for every server the session started without. */
8
+ export declare function refusedMcpServersNotice(names: readonly string[]): SessionNotice;
9
+ //# sourceMappingURL=refused-mcp-servers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refused-mcp-servers.d.ts","sourceRoot":"","sources":["../src/refused-mcp-servers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAe1D,8GAA8G;AAC9G,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,EAAE,CAQxE;AAED,uFAAuF;AACvF,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB,CAWpF;AAED,+DAA+D;AAC/D,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,aAAa,CAc/E"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Helpers for a session that Claude Code refused to start with its client MCP servers
3
+ * (`sideload_flags_disabled`, SDK 0.3.331; upstream claude-agent-acp #1708).
4
+ */
5
+ /** What the user is told of the servers a managed `disableSideloadFlags` keeps out (upstream's text). */
6
+ const NOT_FROM_AN_APPROVED_SOURCE = "Your organization's managed settings (disableSideloadFlags) let Claude Code use MCP servers only from sources that your administrator approved.";
7
+ /** The names of a session's client MCP servers: its ACP servers and `_meta.claudeCode.options.mcpServers`. */
8
+ export function clientMcpServerNames(params) {
9
+ const meta = params._meta;
10
+ return [
11
+ ...new Set([
12
+ ...(params.mcpServers ?? []).map((server) => server.name),
13
+ ...Object.keys(meta?.claudeCode?.options?.mcpServers ?? {}),
14
+ ]),
15
+ ];
16
+ }
17
+ /** The same request with no client MCP servers, the `_meta` options' ones included. */
18
+ export function withoutClientMcpServers(params) {
19
+ const meta = params._meta;
20
+ const options = meta?.claudeCode?.options;
21
+ if (!meta || !options?.mcpServers)
22
+ return { ...params, mcpServers: [] };
23
+ const { mcpServers: _dropped, ...rest } = options;
24
+ void _dropped;
25
+ return {
26
+ ...params,
27
+ mcpServers: [],
28
+ _meta: { ...meta, claudeCode: { ...meta.claudeCode, options: rest } },
29
+ };
30
+ }
31
+ /** One notice for every server the session started without. */
32
+ export function refusedMcpServersNotice(names) {
33
+ const quoted = names.map((name) => `"${name}"`);
34
+ if (quoted.length === 1) {
35
+ return {
36
+ severity: "warning",
37
+ title: `MCP server ${quoted[0]} failed to start`,
38
+ description: `Its tools are unavailable in this session. ${NOT_FROM_AN_APPROVED_SOURCE}`,
39
+ };
40
+ }
41
+ return {
42
+ severity: "warning",
43
+ title: `${quoted.length} MCP servers failed to start`,
44
+ description: `The tools of ${quoted.slice(0, -1).join(", ")} and ${quoted.at(-1)} are unavailable in this session. ${NOT_FROM_AN_APPROVED_SOURCE}`,
45
+ };
46
+ }
@@ -13,4 +13,6 @@ export declare const STARTUP_FAILURE_RESULTS_ENV: {
13
13
  * `Invalid proxy URL in HTTPS_PROXY: … Fix or unset HTTPS_PROXY and restart
14
14
  * Claude Code.`; `data.startupFailureReason` carries the reason. */
15
15
  export declare function startupFailureError(error: unknown): RequestError | undefined;
16
+ /** The reason {@link startupFailureError} put into `error`, if it made `error` (upstream #1708). */
17
+ export declare function startupFailureReasonOf(error: unknown): string | undefined;
16
18
  //# sourceMappingURL=startup-failure.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"startup-failure.d.ts","sourceRoot":"","sources":["../src/startup-failure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAGjE;;;;oDAIoD;AACpD,eAAO,MAAM,2BAA2B;;CAA+C,CAAC;AAYxF;;;;qEAIqE;AACrE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,CAgB5E"}
1
+ {"version":3,"file":"startup-failure.d.ts","sourceRoot":"","sources":["../src/startup-failure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAGjE;;;;oDAIoD;AACpD,eAAO,MAAM,2BAA2B;;CAA+C,CAAC;AAYxF;;;;qEAIqE;AACrE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,CAgB5E;AAED,oGAAoG;AACpG,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAKzE"}
@@ -36,3 +36,11 @@ export function startupFailureError(error) {
36
36
  }
37
37
  return RequestError.internalError(data, message);
38
38
  }
39
+ /** The reason {@link startupFailureError} put into `error`, if it made `error` (upstream #1708). */
40
+ export function startupFailureReasonOf(error) {
41
+ if (!(error instanceof RequestError))
42
+ return undefined;
43
+ const reason = error.data
44
+ ?.startupFailureReason;
45
+ return typeof reason === "string" ? reason : undefined;
46
+ }
package/dist/tools.d.ts CHANGED
@@ -44,6 +44,15 @@ export declare function shellDescription(input: unknown): string | undefined;
44
44
  * present. (Upstream #1271.) */
45
45
  export declare function grepPath(input: unknown): string | undefined;
46
46
  export declare function toolInfoFromToolUse(toolUse: any, supportsTerminalOutput?: boolean, cwd?: string): ToolInfo;
47
+ /**
48
+ * Splits `mcp__<server>__<tool>` the way Claude Code does (upstream #1674): the server is the
49
+ * segment up to the next `__`, the tool is the whole rest, so a `__` inside the tool survives.
50
+ * An incomplete name is not an MCP name.
51
+ */
52
+ export declare function mcpToolName(name: string): {
53
+ server: string;
54
+ tool: string;
55
+ } | undefined;
47
56
  export declare function toolUpdateFromToolResult(toolResult: ToolResultBlockParam | BetaToolResultBlockParam | BetaWebSearchToolResultBlockParam | BetaWebFetchToolResultBlockParam | WebSearchToolResultBlockParam | BetaCodeExecutionToolResultBlockParam | BetaBashCodeExecutionToolResultBlockParam | BetaTextEditorCodeExecutionToolResultBlockParam | BetaRequestMCPToolResultBlockParam | BetaToolSearchToolResultBlockParam, toolUse: any | undefined, supportsTerminalOutput?: boolean, toolUseResult?: unknown): ToolUpdate;
48
57
  export type ClaudePlanEntry = {
49
58
  content: string;
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACT,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAaL,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,gBAAgB,EAKjB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAGL,oBAAoB,EAEpB,6BAA6B,EAE9B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,yCAAyC,EAGzC,qCAAqC,EAGrC,kCAAkC,EAGlC,+CAA+C,EAI/C,wBAAwB,EACxB,kCAAkC,EAIlC,gCAAgC,EAEhC,iCAAiC,EAClC,MAAM,sCAAsC,CAAC;AA2B9C,UAAU,QAAQ;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAChC;AAED,UAAU,UAAU;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,KAAK,CAAC,EAAE;QACN,aAAa,CA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