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:
+8
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user