Skip to main content

Type Alias: McpRouter

McpRouter = Router & object

Defined in: index.ts:472

The router createMcpRouter returns: a Koa router, plus the two operations on the 2026-07-28 streams it serves.

Type Declaration​

close​

close: () => Promise<void>

Tells every open subscriptions/listen stream that the tool, prompt and resource lists may have changed, then ends every open 2026-07-28 exchange. Call it on shutdown, before server.close(): an open stream never finishes on its own, so a graceful close would otherwise wait out the whole grace period, and the notification is what tells a client that does not re-list on reconnect that the next process may serve a different surface.

Returns​

Promise<void>

notify​

notify: ServerNotifier

Publishes the list_changed notifications (and resources/updated) to every open subscriptions/listen stream that opted in. Call notify.toolsChanged() after registering or removing a tool at runtime. A no-op without createMcpServer, or with no stream open.