This commit is contained in:
Dax Raad 2025-10-14 00:56:56 -04:00
parent b8a2a9e7f8
commit 77ec0bda4c
2 changed files with 13 additions and 1 deletions

View file

@ -5,6 +5,13 @@
"weather": {
"type": "local",
"command": ["bun", "x", "@h1deya/mcp-server-weather"]
},
"context7": {
"type": "remote",
"url": "https://mcp.context7.com/mcp",
"headers": {
"CONTEXT7_API_KEY": "{env:CONTEXT7_API_KEY}"
}
}
}
}

View file

@ -83,15 +83,17 @@ export namespace MCP {
]
let lastError: Error | undefined
for (const { name, transport } of transports) {
await experimental_createMCPClient({
const result = await experimental_createMCPClient({
name: "opencode",
transport,
})
.then((client) => {
log.info("connected", { key, transport: name })
clients[key] = client
status[key] = {
status: "connected",
}
return true
})
.catch((error) => {
lastError = error instanceof Error ? error : new Error(String(error))
@ -105,7 +107,9 @@ export namespace MCP {
status: "failed",
error: lastError.message,
}
return false
})
if (result) break
}
}
@ -145,6 +149,7 @@ export namespace MCP {
}
for (const [key, client] of Object.entries(clients)) {
log.info("checking tools", { key })
const result = await withTimeout(client.tools(), 5000).catch(() => {})
if (!result) {
client.close()