mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-21 09:44:21 +01:00
core: improve MCP reliability and add status monitoring
- Added 5-second timeout to MCP client verification to prevent hanging connections - New GET /mcp endpoint to monitor server connection status - Automatically removes unresponsive MCP clients during initialization
This commit is contained in:
@@ -31,6 +31,7 @@ import { SessionRevert } from "../session/revert"
|
||||
import { lazy } from "../util/lazy"
|
||||
import { Todo } from "../session/todo"
|
||||
import { InstanceBootstrap } from "../project/bootstrap"
|
||||
import { MCP } from "../mcp"
|
||||
|
||||
const ERRORS = {
|
||||
400: {
|
||||
@@ -1183,6 +1184,26 @@ export namespace Server {
|
||||
return c.json(modes)
|
||||
},
|
||||
)
|
||||
.get(
|
||||
"/mcp",
|
||||
describeRoute({
|
||||
description: "Get MCP server status",
|
||||
operationId: "mcp.status",
|
||||
responses: {
|
||||
200: {
|
||||
description: "MCP server status",
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: resolver(z.any()),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
async (c) => {
|
||||
return c.json(await MCP.status())
|
||||
},
|
||||
)
|
||||
.post(
|
||||
"/tui/append-prompt",
|
||||
describeRoute({
|
||||
|
||||
Reference in New Issue
Block a user