import { type Diagnostic, type MediaPurposePolicy, type SchemaManifest, type SiteIcon } from "@aotter/mantle-spec"; import type { HandlerContext } from "../../domain/model/HandlerContext.js"; import type { AuditSink } from "../../domain/port/AuditSink.js"; import { ArchiveUseCase, CreateDraftUseCase, DeleteEntryUseCase, GetEntryUseCase, RequestPublishUseCase, UnpublishUseCase, UpdateDraftUseCase } from "../../usecase/content/index.js"; import { CommitMediaUploadUseCase, CreateMediaUploadUseCase } from "../../usecase/media/index.js"; import { ExecuteViewUseCase } from "../../usecase/view/index.js"; import type { RuntimeCallableCapability } from "../../domain/service/CallableCapabilityProjector.js"; import { type McpToolSurface } from "./McpToolCatalog.js"; export declare const MCP_PROTOCOL_VERSION = "2025-11-25"; export interface McpServerInfo { readonly name: string; readonly title?: string; readonly description?: string; readonly websiteUrl?: string; readonly icons?: readonly SiteIcon[]; } /** JSON-RPC dispatcher for the MCP transport. Env-agnostic; the * adapter resolves the caller's identity and hands `dispatch` the same * normalized `HandlerContext` used by HTTP transports. */ /** * The use-case bag the dispatcher needs. Adapter constructs this once * per isolate from the runtime's pre-built use cases (the runtime's * assembly root assembles these alongside everything else). */ export interface McpUseCases { readonly getEntry: GetEntryUseCase; readonly createDraft: CreateDraftUseCase; readonly updateDraft: UpdateDraftUseCase; readonly requestPublish: RequestPublishUseCase; readonly unpublish: UnpublishUseCase; readonly archive: ArchiveUseCase; readonly deleteEntry: DeleteEntryUseCase; readonly executeView?: Pick; /** Optional. Trigger-backed callable capabilities route through the * runtime's shared Trigger invocation chokepoint. */ readonly invokeTrigger?: { execute(request: { readonly trigger: string; readonly input: unknown; readonly ctx: HandlerContext; readonly pathPrefix?: string; }): Promise<{ readonly ok: true; readonly data: unknown; } | { readonly ok: false; readonly diagnostic: Diagnostic; }>; }; /** Optional. When set, `create_media_upload` and * `commit_media_upload` appear in the catalog and route here. * `purposes` is the declared taxonomy (#272 shape — name + * required mimes + maxBytes per mime); the catalog inlines the * policy summary into the create tool's description. */ readonly media?: { readonly createUpload: CreateMediaUploadUseCase; readonly commitUpload: CommitMediaUploadUseCase; readonly purposes: readonly MediaPurposePolicy[]; }; } export declare class McpJsonRpcDispatcher { private readonly useCases; private readonly schemas; private readonly options; private readonly catalog; private readonly catalogWireJson; private readonly catalogToolNames; private readonly auditOperationId; /** segment → original `Schema.metadata.name`. Built once at * construction; the per-collection routing path looks up the * segment from the tool name and recovers the canonical * collection name. */ private readonly schemaBySegment; private readonly readOnlyCollections; private readonly capabilityByToolName; constructor(useCases: McpUseCases, schemas: ReadonlyArray, options?: { readonly surface?: McpToolSurface; readonly capabilities?: readonly RuntimeCallableCapability[]; readonly serverInfo?: McpServerInfo; /** Optional tools/call audit trail. See `AuditSink`. */ readonly audit?: AuditSink; }); dispatch(req: Request, ctx: HandlerContext): Promise; private handleToolCall; /** The single audit write point. Off the response path: the sink's promise * goes to the platform's `waitUntil` when present, and a failing sink is * logged rather than turned into a tool error. */ private recordAudit; private dispatchToolByName; private assertStaffRole; private assertEntryMutable; } //# sourceMappingURL=McpJsonRpcDispatcher.d.ts.map