chore(mcp): declare client capabilities (#32222)

This commit is contained in:
Aiden Cline 2026-06-13 15:29:38 -05:00 committed by GitHub
parent 7143bf8ff0
commit 11fd6f8255
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,7 +3,7 @@ import { LayerNode } from "@opencode-ai/core/effect/layer-node"
import { type Tool } from "ai"
import { ConfigV1 } from "@opencode-ai/core/v1/config/config"
import { serviceUse } from "@opencode-ai/core/effect/service-use"
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { Client, type ClientOptions } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js"
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"
@ -35,6 +35,18 @@ import { CrossSpawnSpawner } from "@opencode-ai/core/cross-spawn-spawner"
import { McpCatalog } from "./catalog"
const DEFAULT_TIMEOUT = 30_000
const CLIENT_OPTIONS = {
capabilities: {
// https://github.com/anomalyco/opencode/issues/11948
// sampling: {},
// https://github.com/anomalyco/opencode/issues/23066
// elicitation: {},
// https://github.com/anomalyco/opencode/issues/2308
// roots: {},
// https://github.com/anomalyco/opencode/issues/28567
// tasks: {},
},
} satisfies ClientOptions
export const Resource = Schema.Struct({
name: Schema.String,
@ -186,7 +198,7 @@ export const layer = Layer.effect(
(t) =>
Effect.tryPromise({
try: () => {
const client = new Client({ name: "opencode", version: InstallationVersion })
const client = new Client({ name: "opencode", version: InstallationVersion }, CLIENT_OPTIONS)
return withTimeout(client.connect(t), timeout).then(() => client)
},
catch: (e) => (e instanceof Error ? e : new Error(String(e))),
@ -768,7 +780,7 @@ export const layer = Layer.effect(
return yield* Effect.tryPromise({
try: () => {
const client = new Client({ name: "opencode", version: InstallationVersion })
const client = new Client({ name: "opencode", version: InstallationVersion }, CLIENT_OPTIONS)
return client
.connect(transport)
.then(() => ({ authorizationUrl: "", oauthState, client }) satisfies AuthResult)