2026-02-02 03:36:48 +08:00
|
|
|
import { createWebsearchConfig } from "./websearch"
|
2025-12-05 02:23:34 +09:00
|
|
|
import { context7 } from "./context7"
|
2025-12-13 19:13:40 +09:00
|
|
|
import { grep_app } from "./grep-app"
|
2026-02-02 03:36:48 +08:00
|
|
|
import type { OhMyOpenCodeConfig } from "../config/schema"
|
2025-12-05 02:15:39 +09:00
|
|
|
|
2025-12-05 03:58:21 +09:00
|
|
|
export { McpNameSchema, type McpName } from "./types"
|
2025-12-05 02:23:34 +09:00
|
|
|
|
2026-01-06 14:12:22 -07:00
|
|
|
type RemoteMcpConfig = {
|
|
|
|
|
type: "remote"
|
|
|
|
|
url: string
|
|
|
|
|
enabled: boolean
|
|
|
|
|
headers?: Record<string, string>
|
2026-01-17 16:36:23 +05:30
|
|
|
oauth?: false
|
2026-01-06 14:12:22 -07:00
|
|
|
}
|
|
|
|
|
|
2026-02-02 03:36:48 +08:00
|
|
|
export function createBuiltinMcps(disabledMcps: string[] = [], config?: OhMyOpenCodeConfig) {
|
2026-02-02 03:55:50 +08:00
|
|
|
const mcps: Record<string, RemoteMcpConfig> = {}
|
|
|
|
|
|
|
|
|
|
if (!disabledMcps.includes("websearch")) {
|
|
|
|
|
mcps.websearch = createWebsearchConfig(config?.websearch)
|
2026-02-02 03:36:48 +08:00
|
|
|
}
|
2025-12-05 02:23:34 +09:00
|
|
|
|
2026-02-02 03:55:50 +08:00
|
|
|
if (!disabledMcps.includes("context7")) {
|
|
|
|
|
mcps.context7 = context7
|
|
|
|
|
}
|
2025-12-05 02:23:34 +09:00
|
|
|
|
2026-02-02 03:55:50 +08:00
|
|
|
if (!disabledMcps.includes("grep_app")) {
|
|
|
|
|
mcps.grep_app = grep_app
|
2025-12-05 02:23:34 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return mcps
|
2025-12-05 02:15:39 +09:00
|
|
|
}
|