/** * The MCP `resources/*` surface, in one place (GLU-07). * * There are THREE stdio loops in this package — `bin/cli.js`'s fast path (what * a client spawning a bare `monomind mcp start` actually runs), `bin/mcp-server.js`, * and `MCPServerManager.startStdioServer` — and all three advertise a * `resources` capability. Only one of them implemented `resources/list`, and * none of them knew about captures. Putting the handling here and delegating * from all three is the difference between "the brain is browsable" and "the * brain is browsable if you happen to have started the server the right way". * * What is served: * * monograph://repo/… the code-graph exports (unchanged, moved here) * capture:// a capture library index: facets + newest pages * capture:/// one captured page — see `capture-resources.ts` * * NOT served: `resources/subscribe`. The capability is advertised by all three * stdio loops, but none of them has a channel for server-initiated * notifications, so a subscription would be accepted and then never fire. The * HTTP/WebSocket server in `@monoes/mcp` does implement subscribe/notify for * real; the stdio paths now advertise `subscribe: false` rather than promise * something they cannot do. * * @module v1/cli/mcp-tools/resource-router */ import { type ListCaptureResourcesOptions } from './capture-resources.js'; export interface ResourceDescriptor { uri: string; name: string; description: string; mimeType: string; } export interface JsonRpcError { code: number; message: string; } export type ResourceResponse = { result: unknown; } | { error: JsonRpcError; } | null; /** The code-graph resources, unchanged from when they lived in mcp-server.ts. */ export declare const MONOGRAPH_RESOURCES: ResourceDescriptor[]; export interface ListResourcesParams extends Record { cursor?: string; /** Non-standard, honoured when a caller sets it: captures per page. */ pageSize?: number; /** Non-standard: the library filters from `library.ts`, so a client that * can pass them does not have to page through the whole brain. */ filter?: ListCaptureResourcesOptions; } /** * `resources/list`. * * The fixed resources (the code graph, one library index per scope) are the * head of the FIRST page only; `cursor` pages through captures alone, so a * client walking to the end never sees a static entry twice. */ export declare function listResources(params?: ListResourcesParams): Promise<{ resources: ResourceDescriptor[]; nextCursor?: string; total: number; }>; export declare function listResourceTemplates(): { resourceTemplates: Array<{ uriTemplate: string; name: string; description: string; mimeType: string; }>; }; export declare function readResource(uri: string): Promise<{ contents: Array<{ uri: string; mimeType: string; text: string; }>; }>; /** * Answer a `resources/*` method, or return null when it is not one — the * caller then falls through to its own switch. Never throws: a failed read * comes back as a JSON-RPC error object. */ export declare function handleResourceMethod(method: string, params?: Record): Promise; //# sourceMappingURL=resource-router.d.ts.map