fix(mcp): handle missing Tavily API key gracefully

Previously, when websearch was configured with Tavily provider and the
TAVILY_API_KEY environment variable was not set, the entire plugin would
fail to load with no visible error to the user.

Changes:
1. createWebsearchConfig now returns undefined when Tavily key is missing
2. Added warning log: '[websearch] Tavily API key not found, skipping websearch MCP'
3. createBuiltinMcps now skips undefined configs instead of adding them
4. Added tests for both missing and present Tavily API key scenarios

Fixes #2996
This commit is contained in:
YeonGyu-Kim
2026-04-02 13:32:44 +09:00
parent 51d9685571
commit a695730891
3 changed files with 43 additions and 150 deletions
+4 -1
View File
@@ -17,7 +17,10 @@ export function createBuiltinMcps(disabledMcps: string[] = [], config?: OhMyOpen
const mcps: Record<string, RemoteMcpConfig> = {}
if (!disabledMcps.includes("websearch")) {
mcps.websearch = createWebsearchConfig(config?.websearch)
const websearchConfig = createWebsearchConfig(config?.websearch)
if (websearchConfig) {
mcps.websearch = websearchConfig
}
}
if (!disabledMcps.includes("context7")) {