mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-22 06:42:19 +03:00
`bin/cli/commands/mcp.mjs::runMcpRestartCommand` POSTs to /api/mcp/restart, but that route never existed under src/app/api/mcp/ — every `omniroute mcp restart` call 404d. There was also no CLI/env path to flip the mcpEnabled setting on: it was dashboard-only (/dashboard/mcp -> PATCH /api/settings), stranding headless/portable installs (Windows portable Node, no browser session) with no way to reach the MCP server's 110 tools. Adds the missing route (auth-gated via requireManagementAuth, 409 when disabled, 501 for stdio since HTTP/SSE sessions are the only in-process handle shutdownMcpHttp() can tear down) plus `omniroute mcp enable [--transport stdio|sse|streamable-http]` / `mcp disable`, which PATCH /api/settings the same way the dashboard toggle does. `mcp status` now hints at `mcp enable` when it reports the server stopped because it is disabled. Regression tests: tests/unit/mcp-restart-route-13012.test.ts (route behavior across disabled/stdio/http-family states + LOCAL_ONLY classification) and tests/unit/cli-mcp-enable-disable-13012.test.ts (PATCH body shape).