UNPKG

mcp-adr-analysis-server

Version:

MCP server for analyzing Architectural Decision Records and project architecture

69 lines 2.66 kB
/** * Server Context Resource - Current server state and capabilities * URI Pattern: adr://server/context */ import { URLSearchParams } from 'url'; import { ResourceGenerationResult } from './index.js'; import type { KnowledgeGraphManager } from '../utils/knowledge-graph-manager.js'; import type { MemoryEntityManager } from '../utils/memory-entity-manager.js'; import type { ConversationMemoryManager } from '../utils/conversation-memory-manager.js'; export interface ServerContextData { context: string; timestamp: string; projectPath: string; includeDetailed: boolean; maxRecentItems: number; } /** * Generate server context resource showing current state, memory, and capabilities. * * Returns a comprehensive markdown-formatted context that includes: * - Server configuration and status * - Validated deployment patterns * - MCP resources catalog * - Memory and knowledge graph status * - Recent deployment activity * - Usage recommendations * * **URI Pattern:** `adr://server/context` * * **Query Parameters:** * - `includeDetailed`: Include detailed information (default: true) * - `maxRecentItems`: Maximum number of recent items to show (default: 5) * - `projectPath`: Override project root path (default: process.cwd()) * * @param params - URL path parameters (none for this resource) * @param searchParams - URL query parameters for customization * * @returns Promise resolving to resource generation result containing: * - data: Server context data with markdown content * - contentType: "application/json" * - lastModified: ISO timestamp of generation * - cacheKey: Unique identifier "server-context" * - ttl: Cache duration (60 seconds / 1 minute) * - etag: Entity tag for cache validation * * @throws {McpAdrError} When context generation fails * * @example * ```typescript * // Get server context with defaults * const context = await generateServerContextResource( * {}, * new URLSearchParams() * ); * * console.log(context.data.context); // Markdown-formatted context * * // Get abbreviated context * const brief = await generateServerContextResource( * {}, * new URLSearchParams('includeDetailed=false&maxRecentItems=3') * ); * ``` * * @since v2.2.0 * @see {@link ServerContextGenerator} for context generation logic */ export declare function generateServerContextResource(_params: Record<string, string>, searchParams: URLSearchParams, kgManager?: KnowledgeGraphManager, memoryManager?: MemoryEntityManager, conversationManager?: ConversationMemoryManager): Promise<ResourceGenerationResult>; //# sourceMappingURL=server-context-resource.d.ts.map