feat: add GET /mcp health check endpoint (#490)

Return a friendly JSON response when users curl GET /mcp instead of
an opaque 503. Narrows the catch-all .all() to .post() since the MCP
Streamable HTTP transport only needs POST for stateless servers.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nikhil
2026-03-12 13:45:26 -07:00
committed by GitHub
parent 39ddabf3a7
commit bde80fedd6

View File

@@ -25,7 +25,16 @@ interface McpRouteDeps {
}
export function createMcpRoutes(deps: McpRouteDeps) {
return new Hono<Env>().all('/', async (c) => {
const app = new Hono<Env>()
app.get('/', (c) =>
c.json({
status: 'ok',
message: 'MCP server is running. Use POST to interact.',
}),
)
app.post('/', async (c) => {
const scopeId = c.req.header('X-BrowserOS-Scope-Id') || 'ephemeral'
metrics.log('mcp.request', { scopeId })
@@ -56,4 +65,6 @@ export function createMcpRoutes(deps: McpRouteDeps) {
)
}
})
return app
}