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:
+4
-1
@@ -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")) {
|
||||
|
||||
Reference in New Issue
Block a user