import { Server } from '@modelcontextprotocol/sdk/server/index.js'; import { ContentService, CmsConfig } from '@webhouse/cms'; declare const ADMIN_TOOLS: readonly [{ readonly name: "get_site_summary"; readonly description: string; readonly inputSchema: { readonly type: "object"; readonly properties: {}; readonly required: string[]; }; }, { readonly name: "list_collection"; readonly description: string; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly collection: { readonly type: "string"; readonly description: "Collection name, e.g. 'posts', 'products'"; }; readonly limit: { readonly type: "number"; readonly description: "Max results. Default 20, max 100."; }; readonly offset: { readonly type: "number"; readonly description: "Pagination offset. Default 0."; }; readonly sort: { readonly type: "string"; readonly enum: readonly ["date_desc", "date_asc", "title_asc"]; readonly description: "Sort order. Default: date_desc."; }; }; readonly required: string[]; }; }, { readonly name: "search_content"; readonly description: string; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly query: { readonly type: "string"; readonly description: "Search query."; }; readonly collection: { readonly type: "string"; readonly description: "Optional: limit search to this collection."; }; readonly limit: { readonly type: "number"; readonly description: "Max results. Default 10, max 50."; }; }; readonly required: string[]; }; }, { readonly name: "get_page"; readonly description: string; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly slug: { readonly type: "string"; readonly description: "Document slug, e.g. 'getting-started'."; }; readonly collection: { readonly type: "string"; readonly description: "Optional: collection to scope the lookup."; }; }; readonly required: string[]; }; }, { readonly name: "get_schema"; readonly description: "Returns the field schema for a collection, describing all available fields and their types."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly collection: { readonly type: "string"; readonly description: "Collection name."; }; }; readonly required: string[]; }; }, { readonly name: "export_all"; readonly description: string; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly include_body: { readonly type: "boolean"; readonly description: "Include full body (true) or metadata only (false). Default: true."; }; }; readonly required: string[]; }; }, { readonly name: "create_document"; readonly description: string; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly collection: { readonly type: "string"; }; readonly fields: { readonly type: "object"; readonly description: "Document fields matching the collection schema."; }; readonly status: { readonly type: "string"; readonly enum: readonly ["draft", "published"]; readonly description: "Initial status. Default: draft."; }; }; readonly required: string[]; }; }, { readonly name: "update_document"; readonly description: string; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly collection: { readonly type: "string"; }; readonly slug: { readonly type: "string"; }; readonly fields: { readonly type: "object"; readonly description: "Fields to update."; }; }; readonly required: string[]; }; }, { readonly name: "publish_document"; readonly description: "Sets a document status to 'published'. Optionally triggers an immediate build."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly collection: { readonly type: "string"; }; readonly slug: { readonly type: "string"; }; readonly auto_build: { readonly type: "boolean"; readonly description: "Trigger site build after publishing. Default: false."; }; }; readonly required: string[]; }; }, { readonly name: "unpublish_document"; readonly description: "Sets a document back to draft status."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly collection: { readonly type: "string"; }; readonly slug: { readonly type: "string"; }; }; readonly required: string[]; }; }, { readonly name: "trash_document"; readonly description: "Move a document to trash. The document can be restored later."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly collection: { readonly type: "string"; }; readonly slug: { readonly type: "string"; }; }; readonly required: string[]; }; }, { readonly name: "clone_document"; readonly description: "Create a copy of a document. The clone is created as a draft with '-copy' suffix."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly collection: { readonly type: "string"; }; readonly slug: { readonly type: "string"; }; }; readonly required: string[]; }; }, { readonly name: "restore_from_trash"; readonly description: "Restore a trashed document back to draft status."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly collection: { readonly type: "string"; }; readonly slug: { readonly type: "string"; }; }; readonly required: string[]; }; }, { readonly name: "empty_trash"; readonly description: "Permanently delete all trashed items. Cannot be undone."; readonly inputSchema: { readonly type: "object"; readonly properties: {}; readonly required: string[]; }; }, { readonly name: "generate_with_ai"; readonly description: "Generates content for a new document using AI. Provide intent and collection. Returns a draft."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly collection: { readonly type: "string"; }; readonly intent: { readonly type: "string"; readonly description: "Natural language description of what to create."; }; readonly status: { readonly type: "string"; readonly enum: readonly ["draft", "published"]; readonly description: "Default: draft."; }; }; readonly required: string[]; }; }, { readonly name: "rewrite_field"; readonly description: "Rewrites a field with AI. Use for: shorten, expand, change tone, translate. Respects AI Lock."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly collection: { readonly type: "string"; }; readonly slug: { readonly type: "string"; }; readonly field: { readonly type: "string"; }; readonly instruction: { readonly type: "string"; readonly description: "E.g. 'Translate to Danish', 'Make 30% shorter'."; }; }; readonly required: string[]; }; }, { readonly name: "generate_content"; readonly description: "Generate AI content for a specific field on a document."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly collection: { readonly type: "string"; }; readonly slug: { readonly type: "string"; }; readonly field: { readonly type: "string"; readonly description: "Field name to generate for."; }; readonly prompt: { readonly type: "string"; readonly description: "Instructions for what to generate."; }; }; readonly required: string[]; }; }, { readonly name: "generate_interactive"; readonly description: "Generate a self-contained HTML interactive (calculator, quiz, widget, etc.)."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly title: { readonly type: "string"; readonly description: "Name for the interactive."; }; readonly description: { readonly type: "string"; readonly description: "What it should do and look like."; }; }; readonly required: string[]; }; }, { readonly name: "translate_document"; readonly description: "Translate a document to another language. Creates a linked translation."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly collection: { readonly type: "string"; }; readonly slug: { readonly type: "string"; }; readonly targetLocale: { readonly type: "string"; readonly description: "Target locale (e.g. 'en', 'da', 'de')."; }; readonly publish: { readonly type: "boolean"; readonly description: "Publish immediately. Default: false."; }; }; readonly required: string[]; }; }, { readonly name: "translate_site"; readonly description: "Translate ALL untranslated documents to a target language."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly targetLocale: { readonly type: "string"; }; readonly publish: { readonly type: "boolean"; readonly description: "Default: false."; }; }; readonly required: string[]; }; }, { readonly name: "trigger_build"; readonly description: "Triggers a static site build. Returns build status."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly mode: { readonly type: "string"; readonly enum: readonly ["full", "incremental"]; readonly description: "Default: incremental."; }; }; readonly required: string[]; }; }, { readonly name: "trigger_deploy"; readonly description: "Deploy the site to the configured provider (GitHub Pages, Fly.io, Vercel, etc.)."; readonly inputSchema: { readonly type: "object"; readonly properties: {}; readonly required: string[]; }; }, { readonly name: "list_deploy_history"; readonly description: "Show recent deployment history."; readonly inputSchema: { readonly type: "object"; readonly properties: {}; readonly required: string[]; }; }, { readonly name: "bulk_publish"; readonly description: "Publish all drafts in a collection (or all collections if omitted)."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly collection: { readonly type: "string"; readonly description: "Optional: target collection."; }; }; readonly required: string[]; }; }, { readonly name: "bulk_update"; readonly description: "Update a field across multiple documents. Supports 'append' mode for arrays (tags)."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly collection: { readonly type: "string"; }; readonly field: { readonly type: "string"; }; readonly value: { readonly description: "New value."; }; readonly mode: { readonly type: "string"; readonly description: "'set' (default) or 'append' for arrays."; }; readonly filter: { readonly type: "object"; readonly properties: { readonly status: { readonly type: "string"; }; readonly slugs: { readonly type: "array"; readonly items: { readonly type: "string"; }; }; }; }; }; readonly required: string[]; }; }, { readonly name: "schedule_publish"; readonly description: "Schedule a document for future publishing/unpublishing. ISO 8601 dates."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly collection: { readonly type: "string"; }; readonly slug: { readonly type: "string"; }; readonly publishAt: { readonly type: "string"; readonly description: "ISO datetime to publish."; }; readonly unpublishAt: { readonly type: "string"; readonly description: "ISO datetime to unpublish."; }; }; readonly required: string[]; }; }, { readonly name: "list_scheduled"; readonly description: "List all content scheduled for future publishing/unpublishing."; readonly inputSchema: { readonly type: "object"; readonly properties: {}; readonly required: string[]; }; }, { readonly name: "list_drafts"; readonly description: "Lists all unpublished draft documents across all (or one) collection."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly collection: { readonly type: "string"; readonly description: "Optional: filter by collection."; }; }; readonly required: string[]; }; }, { readonly name: "get_version_history"; readonly description: "Returns revision history for a document."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly collection: { readonly type: "string"; }; readonly slug: { readonly type: "string"; }; readonly limit: { readonly type: "number"; readonly description: "Default 10."; }; }; readonly required: string[]; }; }, { readonly name: "get_site_config"; readonly description: "Get site configuration: name, adapter, deploy settings, locales."; readonly inputSchema: { readonly type: "object"; readonly properties: {}; readonly required: string[]; }; }, { readonly name: "update_site_settings"; readonly description: "Update site settings. Sensitive fields (API keys) cannot be changed."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly settings: { readonly type: "object"; readonly description: "Key-value pairs to update."; }; }; readonly required: string[]; }; }, { readonly name: "content_stats"; readonly description: "Content statistics: word counts, document counts, published/draft breakdown."; readonly inputSchema: { readonly type: "object"; readonly properties: {}; readonly required: string[]; }; }, { readonly name: "list_media"; readonly description: "List all media files with AI analysis, tags, EXIF data."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly type: { readonly type: "string"; readonly description: "'image', 'video', 'audio', 'document', 'all'."; }; readonly limit: { readonly type: "number"; readonly description: "Default: 50."; }; }; readonly required: string[]; }; }, { readonly name: "search_media"; readonly description: "Search media by AI captions, tags, or filename."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly query: { readonly type: "string"; }; readonly type: { readonly type: "string"; readonly description: "Default: 'image'."; }; readonly limit: { readonly type: "number"; readonly description: "Default: 10."; }; }; readonly required: string[]; }; }, { readonly name: "list_trash"; readonly description: "List all trashed documents and media."; readonly inputSchema: { readonly type: "object"; readonly properties: {}; readonly required: string[]; }; }, { readonly name: "list_agents"; readonly description: "List configured AI agents with name, role, target collections, status."; readonly inputSchema: { readonly type: "object"; readonly properties: {}; readonly required: string[]; }; }, { readonly name: "create_agent"; readonly description: "Create a new AI agent with name, role, and system prompt."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly name: { readonly type: "string"; }; readonly role: { readonly type: "string"; readonly description: "copywriter, seo, translator, refresher, or custom."; }; readonly systemPrompt: { readonly type: "string"; }; readonly targetCollections: { readonly type: "array"; readonly items: { readonly type: "string"; }; }; }; readonly required: string[]; }; }, { readonly name: "run_agent"; readonly description: "Run an AI agent to generate content into the curation queue."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly agentId: { readonly type: "string"; }; readonly prompt: { readonly type: "string"; }; readonly collection: { readonly type: "string"; readonly description: "Override target collection."; }; }; readonly required: string[]; }; }, { readonly name: "list_curation_queue"; readonly description: "List items in the AI curation queue awaiting review."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly status: { readonly type: "string"; readonly description: "ready, in_review, approved, rejected, published."; }; }; readonly required: string[]; }; }, { readonly name: "approve_queue_item"; readonly description: "Approve a curation queue item for publishing."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly id: { readonly type: "string"; }; readonly asDraft: { readonly type: "boolean"; readonly description: "Approve as draft. Default: false."; }; }; readonly required: string[]; }; }, { readonly name: "reject_queue_item"; readonly description: "Reject a curation queue item with feedback."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly id: { readonly type: "string"; }; readonly feedback: { readonly type: "string"; }; }; readonly required: string[]; }; }, { readonly name: "list_revisions"; readonly description: "List revision history for a document."; readonly inputSchema: { readonly type: "object"; readonly properties: { readonly collection: { readonly type: "string"; }; readonly slug: { readonly type: "string"; }; }; readonly required: string[]; }; }, { readonly name: "run_link_check"; readonly description: "Check all links across the site for broken URLs."; readonly inputSchema: { readonly type: "object"; readonly properties: {}; readonly required: string[]; }; }, { readonly name: "create_backup"; readonly description: "Create a backup of the site's content."; readonly inputSchema: { readonly type: "object"; readonly properties: {}; readonly required: string[]; }; }]; type AdminToolName = (typeof ADMIN_TOOLS)[number]["name"]; declare const TOOL_SCOPES: Record; interface ApiKeyConfig { key: string; label: string; scopes: string[]; } declare function validateApiKey(authHeader: string | null | undefined, keys: ApiKeyConfig[]): { authenticated: true; label: string; scopes: string[]; } | { authenticated: false; error: string; }; declare function hasScope(userScopes: string[], required: string[]): boolean; interface AuditEntry { timestamp: string; tool: string; actor: string; result: "success" | "error"; documentRef?: string; error?: string; } declare function initAuditLog(dataDir: string): void; declare function writeAudit(entry: AuditEntry): void; interface AiGenerator { generate(intent: string, collectionName: string): Promise<{ fields: Record; slug: string; }>; rewriteField(collection: string, slug: string, field: string, instruction: string, currentValue: string): Promise; generateContent(collection: string, slug: string, field: string, prompt: string): Promise; generateInteractive(title: string, description: string): Promise; } /** Service callbacks injected by the host (Next.js app router) for admin-only operations */ interface AdminServices { readSiteConfig(): Promise; writeSiteConfig(patch: Record): Promise; listMedia(type: string, limit: number): Promise; searchMedia(query: string, type: string, limit: number): Promise; listAgents(): Promise; createAgent(opts: Record): Promise; runAgent(agentId: string, prompt: string, collection?: string): Promise; listCurationQueue(status?: string): Promise<{ items: any[]; stats: Record; }>; approveQueueItem(id: string, asDraft: boolean): Promise; rejectQueueItem(id: string, feedback: string): Promise; triggerDeploy(): Promise; listDeploys(): Promise; listRevisions(collection: string, slug: string): Promise; readLinkCheckResult(): Promise; createBackup(): Promise; translateDocument(collection: string, slug: string, targetLocale: string, publish: boolean): Promise; translateSite(targetLocale: string, publish: boolean): Promise; listTrashedMedia(): Promise>; deleteTrashedMedia(): Promise; } interface AdminServerOptions { content: ContentService; config: CmsConfig; scopes: string[]; actor: string; ai?: AiGenerator; services?: AdminServices; onBuild?: (mode: "full" | "incremental") => Promise<{ ok: boolean; message: string; }>; } declare function createAdminMcpServer(opts: AdminServerOptions): Server; export { ADMIN_TOOLS, type AdminServerOptions, type AdminServices, type AdminToolName, type AiGenerator, type ApiKeyConfig, type AuditEntry, TOOL_SCOPES, createAdminMcpServer, hasScope, initAuditLog, validateApiKey, writeAudit };