/** * Factory for the `revealui-docs` MCP server — first-party dependency * intelligence. * * This is the RevealUI-native answer to external "library docs" MCP servers * (e.g. context7): instead of routing queries to a third-party service, it * serves curated docs for the fleet's own `@revealui/*` packages straight * from the monorepo — README + package.json metadata + public export * subpaths. Source is ground truth, and it covers first-party packages an * external indexer cannot see at all. * * ## Phase 1 (this file) * * First-party `@revealui/*` packages only. Tools: * - `docs_list_libraries` — enumerate every first-party package. * - `docs_resolve_library` — normalize a name ("router", "@revealui/router") * to its canonical id. * - `docs_get_library` — return curated docs for a package. * * Resource: * - `revealui-docs://catalog` — the same list as `docs_list_libraries`. * * npm / third-party packages are out of scope for P1. `opensrc` already * fetches real dependency source on demand; a later phase wires it in behind * the same two tools so the ergonomics stay uniform. * * ## License * * **Not** Pro-gated. It surfaces only source-visible package metadata + * READMEs (the `@revealui/*` packages are MIT or source-visible FSL) and is a * developer tool for building on RevealUI — same rationale as the contracts * server. Revisit only if it ever serves runtime/customer data. */ import { Server } from '@modelcontextprotocol/sdk/server/index.js'; /** A first-party package discovered in the monorepo. */ export interface PackageEntry { /** Canonical package name, e.g. `@revealui/router`. */ name: string; /** Scope-stripped id, e.g. `router`. */ shortId: string; /** Absolute path to the package directory. */ dir: string; version: string; description: string; license?: string; homepage?: string; /** Public export subpaths from package.json `exports`, e.g. `['.', './server']`. */ exports: string[]; } /** Curated docs for a single package. */ export interface LibraryDoc { name: string; shortId: string; version: string; description: string; license?: string; homepage?: string; exports: string[]; /** README.md contents, or null when the package has none. */ readme: string | null; } export interface ResolveResult { resolved: boolean; /** Canonical id when resolved. */ id?: string; query: string; /** Guidance when unresolved (e.g. third-party packages). */ hint?: string; /** Near matches (substring) when unresolved. */ candidates?: string[]; } /** * Enumerate first-party packages under `/packages/*`. Only entries * whose package.json `name` is in the `@revealui/` scope (or the bare * `revealui` meta-package) are included. Returns a map keyed by canonical * package name. Never throws — unreadable entries are skipped. */ export declare function enumeratePackages(root: string): Map; /** Resolve a library name to a canonical first-party id. */ export declare function resolveLibrary(packages: Map, input: string): ResolveResult; /** Read curated docs for a resolved package id (canonical name or short id). */ export declare function getLibraryDoc(packages: Map, id: string): LibraryDoc | null; interface LibrarySummary { name: string; shortId: string; version: string; description: string; exports: string[]; } /** Summaries of every first-party package, sorted by name. */ export declare function listLibraries(packages: Map): LibrarySummary[]; export interface CreateDocsServerOptions { /** Monorepo root containing `packages/`. The launcher resolves this. */ root: string; /** Override the advertised server name (useful for tests). */ serverName?: string; } /** * Create a fresh `revealui-docs` MCP Server. The package list is enumerated * once at creation (cheap, name+metadata only); README contents are read * lazily per `docs_get_library` call. */ export declare function createDocsServer(options: CreateDocsServerOptions): Server; export {}; //# sourceMappingURL=docs.d.ts.map