fix(mcp): resolve local mcp runtimes

Resolve built-in local MCP runtime executables before handing command arrays to OpenCode so lsp and ast_grep do not depend on a bare node or bun lookup in the host PATH.

Keep source, dist, bootstrap, workspace-safety, and disabled_mcps behavior covered by focused tests and real OpenCode MCP status QA.

Plan: plans/fix-built-in-mcp-runtime-executables.md
This commit is contained in:
YeonGyu-Kim
2026-05-20 23:32:48 +09:00
parent 37be0d5691
commit eea27d6f7e
8 changed files with 299 additions and 31 deletions
+8 -2
View File
@@ -3,6 +3,7 @@ import { context7 } from "./context7"
import { grep_app } from "./grep-app"
import { createAstGrepMcpConfig } from "./ast-grep"
import { createLspMcpConfig, type LocalMcpConfig } from "./lsp"
import type { RuntimeExecutableResolver } from "./runtime-executable"
import type { OhMyOpenCodeConfig } from "../config/schema"
export { McpNameSchema, type McpName } from "./types"
@@ -19,6 +20,7 @@ type BuiltinMcpConfig = RemoteMcpConfig | LocalMcpConfig
type BuiltinMcpOptions = {
readonly cwd?: string
readonly resolveExecutable?: RuntimeExecutableResolver
}
export function createBuiltinMcps(disabledMcps: string[] = [], config?: OhMyOpenCodeConfig, options: BuiltinMcpOptions = {}) {
@@ -40,11 +42,15 @@ export function createBuiltinMcps(disabledMcps: string[] = [], config?: OhMyOpen
}
if (!disabledMcps.includes("lsp")) {
mcps.lsp = createLspMcpConfig()
mcps.lsp = createLspMcpConfig({ resolveExecutable: options.resolveExecutable })
}
if (!disabledMcps.includes("ast_grep")) {
mcps.ast_grep = createAstGrepMcpConfig({ cwd: options.cwd, disabledTools: config?.disabled_tools })
mcps.ast_grep = createAstGrepMcpConfig({
cwd: options.cwd,
disabledTools: config?.disabled_tools,
resolveExecutable: options.resolveExecutable,
})
}
return mcps