UNPKG

mcp-adr-analysis-server

Version:

MCP server for analyzing Architectural Decision Records and project architecture

129 lines 4.09 kB
/** * AI Configuration for OpenRouter.ai Integration and CE-MCP * * This module handles configuration for AI execution capabilities, * supporting both legacy OpenRouter execution and the new CE-MCP * (Code Execution with MCP) paradigm. * * @see ADR-014: CE-MCP Architecture */ /** * Execution mode for AI operations * * - 'full': Execute prompts via OpenRouter (legacy) * - 'prompt-only': Return prompts without execution (legacy) * - 'ce-mcp': Return orchestration directives for host LLM (recommended) * - 'hybrid': Support both CE-MCP and OpenRouter fallback */ export type ExecutionMode = 'full' | 'prompt-only' | 'ce-mcp' | 'hybrid'; export interface AIConfig { /** OpenRouter API key for authentication */ apiKey: string; /** Base URL for OpenRouter API */ baseURL: string; /** Default AI model to use for prompt execution */ defaultModel: string; /** Execution mode */ executionMode: ExecutionMode; /** Site URL for OpenRouter rankings (optional) */ siteUrl?: string; /** Site name for OpenRouter rankings (optional) */ siteName?: string; /** Request timeout in milliseconds */ timeout: number; /** Maximum retries for failed requests */ maxRetries: number; /** Temperature for AI responses (0-1) */ temperature: number; /** Maximum tokens for AI responses */ maxTokens: number; /** Enable response caching */ cacheEnabled: boolean; /** Cache TTL in seconds */ cacheTTL: number; /** CE-MCP specific configuration */ cemcp?: CEMCPSettings; } /** * CE-MCP specific settings */ export interface CEMCPSettings { /** Enable sandbox execution */ sandboxEnabled: boolean; /** Sandbox execution timeout in ms */ sandboxTimeout: number; /** Sandbox memory limit in bytes */ sandboxMemoryLimit: number; /** Maximum file system operations */ sandboxFsLimit: number; /** Allow network access in sandbox */ sandboxNetworkAllowed: boolean; /** Enable lazy prompt loading */ lazyPromptLoading: boolean; /** Use OpenRouter as fallback when CE-MCP fails */ openRouterFallback: boolean; } export interface ModelConfig { /** Model identifier for OpenRouter */ id: string; /** Human-readable model name */ name: string; /** Model provider (openai, anthropic, etc.) */ provider: string; /** Cost per 1K tokens (input) */ inputCost: number; /** Cost per 1K tokens (output) */ outputCost: number; /** Maximum context length */ contextLength: number; /** Recommended use cases */ useCases: string[]; } /** * Available AI models for different use cases */ export declare const AVAILABLE_MODELS: Record<string, ModelConfig>; /** * Default CE-MCP settings */ export declare const DEFAULT_CEMCP_SETTINGS: CEMCPSettings; /** * Default AI configuration */ export declare const DEFAULT_AI_CONFIG: Omit<AIConfig, 'siteUrl' | 'siteName'> & { siteUrl: string; siteName: string; }; /** * Load AI configuration from environment variables */ export declare function loadAIConfig(): AIConfig; /** * Validate AI configuration */ export declare function validateAIConfig(config: AIConfig): void; /** * Get model configuration by ID */ export declare function getModelConfig(modelId: string): ModelConfig | undefined; /** * Check if AI execution is enabled (legacy OpenRouter mode) */ export declare function isAIExecutionEnabled(config: AIConfig): boolean; /** * Check if CE-MCP mode is enabled */ export declare function isCEMCPEnabled(config: AIConfig): boolean; /** * Check if OpenRouter fallback is available */ export declare function isOpenRouterFallbackAvailable(config: AIConfig): boolean; /** * Get the effective execution mode based on configuration and available resources */ export declare function getEffectiveExecutionMode(config: AIConfig): ExecutionMode; /** * Get recommended model for a specific use case */ export declare function getRecommendedModel(useCase: string, costSensitive?: boolean): string; //# sourceMappingURL=ai-config.d.ts.map