/** * Shared types for the MCP & AI page (mcp-ai-spec Workstream D). * Mirrors the payloads of includes/class-mcp-admin-rest.php. */ export type McpAccessMode = 'private' | 'public_content' | 'public_read'; export type McpTokenScope = 'read' | 'write'; export interface McpSettings { enabled: boolean; access_mode: McpAccessMode; bridge_abilities: boolean; /** On-plugin OAuth 2.1 authorization server (private ChatGPT/strict-client connections). */ oauth_enabled: boolean; } export interface McpOAuthStatus { enabled: boolean; authorize_url: string; metadata_url: string; connections_count: number; } export interface McpConnection { id: string; client_name: string; client_id: string; scope: McpTokenScope; created_at: number; last_used: number; expired: boolean; } export interface McpToolAnnotations { title?: string; readOnlyHint?: boolean; destructiveHint?: boolean; idempotentHint?: boolean; openWorldHint?: boolean; } export interface McpToolSchemaProperty { type?: string; description?: string; } export interface McpToolInputSchema { type?: string; properties?: Record; required?: string[]; } export interface McpToolInfo { name: string; title: string; description: string; scope: McpTokenScope; plan: string; public_eligible: 'content' | 'read' | false; annotations: McpToolAnnotations; input_schema: McpToolInputSchema | null; } export interface McpStatus { settings: McpSettings; endpoint: string; pretty_permalinks: boolean; protocol_versions: string[]; plugin_version: string; tools: McpToolInfo[]; tool_counts: { total: number; read: number; write: number; public_content: number; public_read: number; }; tokens_count: number; has_legacy_token: boolean; abilities: { available: boolean; wp_version: string; count: number; }; adapter: { detected: boolean; endpoint: string | null; }; oauth: McpOAuthStatus; } export interface McpTokenInfo { id: string; label: string; prefix: string; scope: McpTokenScope; created_at: number; created_by: number; last_used: number; revoked: boolean; } /** Returned ONCE by the create endpoint — the secret is never retrievable again. */ export interface McpCreatedToken { id: string; secret: string; prefix: string; label: string; scope: McpTokenScope; created_at: number; } export interface McpActivityEntry { ts: number; auth: string; tool: string; ok: boolean; ms: number; } export interface McpSelfTestStep { id: string; label: string; ok: boolean; message: string; } export interface McpSelfTestResult { ok: boolean; steps: McpSelfTestStep[]; }