@@ -3,7 +3,7 @@ import { LayerNode } from "@opencode-ai/core/effect/layer-node" |
3 | 3 | import { type Tool } from "ai" |
4 | 4 | import { ConfigV1 } from "@opencode-ai/core/v1/config/config" |
5 | 5 | import { serviceUse } from "@opencode-ai/core/effect/service-use" |
6 | | -import { Client } from "@modelcontextprotocol/sdk/client/index.js" |
| 6 | +import { Client, type ClientOptions } from "@modelcontextprotocol/sdk/client/index.js" |
7 | 7 | import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js" |
8 | 8 | import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js" |
9 | 9 | import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js" |
@@ -35,6 +35,18 @@ import { CrossSpawnSpawner } from "@opencode-ai/core/cross-spawn-spawner" |
35 | 35 | import { McpCatalog } from "./catalog" |
36 | 36 |
|
37 | 37 | const DEFAULT_TIMEOUT = 30_000 |
| 38 | +const CLIENT_OPTIONS = { |
| 39 | + capabilities: { |
| 40 | + // https://github.com/anomalyco/opencode/issues/11948 |
| 41 | + // sampling: {}, |
| 42 | + // https://github.com/anomalyco/opencode/issues/23066 |
| 43 | + // elicitation: {}, |
| 44 | + // https://github.com/anomalyco/opencode/issues/2308 |
| 45 | + // roots: {}, |
| 46 | + // https://github.com/anomalyco/opencode/issues/28567 |
| 47 | + // tasks: {}, |
| 48 | + }, |
| 49 | +} satisfies ClientOptions |
38 | 50 |
|
39 | 51 | export const Resource = Schema.Struct({ |
40 | 52 | name: Schema.String, |
@@ -186,7 +198,7 @@ export const layer = Layer.effect( |
186 | 198 | (t) => |
187 | 199 | Effect.tryPromise({ |
188 | 200 | try: () => { |
189 | | - const client = new Client({ name: "opencode", version: InstallationVersion }) |
| 201 | + const client = new Client({ name: "opencode", version: InstallationVersion }, CLIENT_OPTIONS) |
190 | 202 | return withTimeout(client.connect(t), timeout).then(() => client) |
191 | 203 | }, |
192 | 204 | catch: (e) => (e instanceof Error ? e : new Error(String(e))), |
@@ -768,7 +780,7 @@ export const layer = Layer.effect( |
768 | 780 |
|
769 | 781 | return yield* Effect.tryPromise({ |
770 | 782 | try: () => { |
771 | | - const client = new Client({ name: "opencode", version: InstallationVersion }) |
| 783 | + const client = new Client({ name: "opencode", version: InstallationVersion }, CLIENT_OPTIONS) |
772 | 784 | return client |
773 | 785 | .connect(transport) |
774 | 786 | .then(() => ({ authorizationUrl: "", oauthState, client }) satisfies AuthResult) |
|