Skip to content

Commit 11fd6f8

Browse files
authored
chore(mcp): declare client capabilities (#32222)
1 parent 7143bf8 commit 11fd6f8

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

packages/opencode/src/mcp/index.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { LayerNode } from "@opencode-ai/core/effect/layer-node"
33
import { type Tool } from "ai"
44
import { ConfigV1 } from "@opencode-ai/core/v1/config/config"
55
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"
77
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
88
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js"
99
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"
@@ -35,6 +35,18 @@ import { CrossSpawnSpawner } from "@opencode-ai/core/cross-spawn-spawner"
3535
import { McpCatalog } from "./catalog"
3636

3737
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
3850

3951
export const Resource = Schema.Struct({
4052
name: Schema.String,
@@ -186,7 +198,7 @@ export const layer = Layer.effect(
186198
(t) =>
187199
Effect.tryPromise({
188200
try: () => {
189-
const client = new Client({ name: "opencode", version: InstallationVersion })
201+
const client = new Client({ name: "opencode", version: InstallationVersion }, CLIENT_OPTIONS)
190202
return withTimeout(client.connect(t), timeout).then(() => client)
191203
},
192204
catch: (e) => (e instanceof Error ? e : new Error(String(e))),
@@ -768,7 +780,7 @@ export const layer = Layer.effect(
768780

769781
return yield* Effect.tryPromise({
770782
try: () => {
771-
const client = new Client({ name: "opencode", version: InstallationVersion })
783+
const client = new Client({ name: "opencode", version: InstallationVersion }, CLIENT_OPTIONS)
772784
return client
773785
.connect(transport)
774786
.then(() => ({ authorizationUrl: "", oauthState, client }) satisfies AuthResult)

0 commit comments

Comments
 (0)