feat(core): allow MCP Code Mode opt-out (#37681)

Co-authored-by: Dax Raad <d@ironbay.co>
This commit is contained in:
opencode-agent[bot] 2026-07-18 17:17:56 -04:00 committed by GitHub
commit fe9b051d1a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 57 additions and 9 deletions

View file

@ -655,6 +655,7 @@ describe("Config", () => {
command: ["node", "./mcp/server.js"],
environment: { API_KEY: "secret" },
disabled: false,
codemode: false,
timeout: { catalog: 10000 },
},
remote: {
@ -663,6 +664,7 @@ describe("Config", () => {
headers: { Authorization: "Bearer token" },
oauth: { client_id: "client", scope: "read write", callback_port: 19876 },
disabled: true,
codemode: false,
timeout: { startup: 15000 },
},
},
@ -740,6 +742,7 @@ describe("Config", () => {
command: ["node", "./mcp/server.js"],
environment: { API_KEY: "secret" },
disabled: false,
codemode: false,
timeout: { catalog: 10000 },
},
remote: {
@ -748,6 +751,7 @@ describe("Config", () => {
headers: { Authorization: "Bearer token" },
oauth: { client_id: "client", scope: "read write", callback_port: 19876 },
disabled: true,
codemode: false,
timeout: { startup: 15000 },
},
},

View file

@ -232,6 +232,13 @@ const mcp = Layer.mock(MCP.Service, {
required: ["ok"],
},
}),
new MCP.Tool({
server: MCP.ServerName.make("direct"),
name: "lookup",
codemode: false,
description: "Lookup",
inputSchema: { type: "object", properties: {} },
}),
]),
callTool: (input) =>
Effect.sync(() => {
@ -766,6 +773,18 @@ it.effect("advertises MCP output schemas to Code Mode", () =>
}),
)
it.effect("advertises MCP tools directly when Code Mode is disabled for the server", () =>
Effect.gen(function* () {
const registry = yield* ToolRegistry.Service
yield* waitForTool(registry, "direct_lookup")
const definitions = yield* toolDefinitions(registry)
const execute = definitions.find((tool) => tool.name === "execute")
expect(definitions.some((tool) => tool.name === "direct_lookup")).toBe(true)
expect(execute?.description).not.toContain("tools.direct.lookup")
}),
)
it.effect("waits for permission before calling an MCP tool", () =>
Effect.gen(function* () {
calls = 0