/** * Factory for the `revealui-content` MCP server. * * Dual-mode template (Stage 1 PR-1.2 of the MCP v1 plan): this module owns * the Server construction + request-handler wiring, decoupled from any * transport. The stdio launcher at `./revealui-content.ts` and a future HTTP * launcher both consume `createRevealuiContentServer()` to ensure a single * source of truth for the tool surface. * * Tools exposed: * revealui_list_sites — list all sites in the RevealUI instance * revealui_list_content — list content entries for a site/collection * revealui_get_content — fetch a single content entry by ID * revealui_list_users — list users (admin only) * revealui_site_stats — per-site user + content counts * * Resources (Stage 4.1 + 4.2): every CollectionConfig with `mcpResource !== * false` is surfaced as an MCP resource under `revealui-content:/// * `. The factory resolves the effective set via three tiers: * * 1. Injected `collectionsProvider` — in-process consumers (admin, agent * runtime) pass a function that reads directly from the admin registry. * 2. HTTP introspection — fetches `${REVEALUI_API_URL}/api/mcp/collections` * with the configured API key. Used by out-of-process consumers that * can reach a running admin. * 3. Curated fallback — `posts`, `pages`, `products`, `media` with * well-known title fields. Used when neither 1 nor 2 is available * (airgapped dev, admin offline, credentials missing). * * Credentials are supplied by the hypervisor (or HTTP launcher wrapper) * via `setCredentials()`. Falls back to `REVEALUI_API_URL` + * `REVEALUI_API_KEY` env vars when no override is set. */ import { Server } from '@modelcontextprotocol/sdk/server/index.js'; import { z } from 'zod/v4'; /** * Set credential overrides for this server. Called by the hypervisor with * resolved tenant credentials (or by an HTTP launcher before handing the * server to the handler). * * Credentials set here are process-global (module-level state). Multi-tenant * HTTP deployments that need per-session credentials should either: * (a) instantiate the server inside `createServer` per call, passing the * credentials into closure scope, OR * (b) use the hypervisor's tenant-scoped credential resolver. */ export declare function setCredentials(creds: Record): void; export declare const ListSitesArgsSchema: z.ZodObject<{ limit: z.ZodOptional; page: z.ZodOptional; }, z.core.$strict>; export declare const ListContentArgsSchema: z.ZodObject<{ site_id: z.ZodOptional; collection: z.ZodString; limit: z.ZodOptional; page: z.ZodOptional; status: z.ZodOptional; }, z.core.$strict>; export declare const GetContentArgsSchema: z.ZodObject<{ collection: z.ZodString; id: z.ZodString; }, z.core.$strict>; export declare const ListUsersArgsSchema: z.ZodObject<{ site_id: z.ZodOptional; limit: z.ZodOptional; page: z.ZodOptional; }, z.core.$strict>; export declare const SiteStatsArgsSchema: z.ZodObject<{ site_id: z.ZodOptional; }, z.core.$strict>; /** * MCP-facing summary of a content collection. Wire-compatible with the shape * returned by `GET /api/mcp/collections` on the admin app. */ export interface CollectionMcpSummary { /** Collection slug. */ slug: string; /** Human-readable singular label (e.g. `Post`). */ label: string; /** Human-readable plural label, when known. */ labelPlural?: string; /** * Resolved MCP-resource flag. Only collections with `mcpResource: true` * are surfaced as resources. */ mcpResource: boolean; } /** * Injection point for in-process consumers. Returning `null` signals the * factory to try the next tier (HTTP, then curated). */ export type CollectionsProvider = () => Promise; export interface CreateRevealuiContentServerOptions { /** * Optional provider used to resolve the list of collections exposed as * MCP resources. When provided, skips HTTP introspection. In-process * admin or agent-runtime consumers wire this to read the registry * directly; out-of-process subprocess consumers leave it unset. */ collectionsProvider?: CollectionsProvider; } /** * Create a fresh `revealui-content` MCP Server instance. Safe to call * multiple times — each call returns an independent Server with its own * request handlers registered. Dual-mode launchers (stdio, Streamable HTTP) * consume this factory; the factory itself is transport-agnostic. */ export declare function createRevealuiContentServer(options?: CreateRevealuiContentServerOptions): Server; //# sourceMappingURL=revealui-content.d.ts.map