tryaii-mcp-server
Version:
TryAII MCP Server - 15+ AI models with comparison, cost tracking, and collective intelligence
43 lines • 1.5 kB
TypeScript
import { SessionManager } from '../services/sessionManager.js';
import { UserApiKeyService } from '../services/userApiKeyService.js';
import { MCPRequest, MCPResponse } from '../types/mcp.js';
export declare class McpProtocolHandler {
private sessionManager;
private userApiKeyService;
private connectionSessions;
constructor(sessionManager: SessionManager, userApiKeyService: UserApiKeyService);
handleRequest(connectionId: string, request: MCPRequest): Promise<MCPResponse | null>;
private handleInitialize;
/**
* Multi-source API key extraction
*/
private extractApiKey;
/**
* Extract API key from request headers (if available)
*/
private extractFromHeaders;
private handleToolsList;
private handleToolCall;
/**
* Calculate estimated cost for a tool before execution
*/
private calculateToolCost;
/**
* Extract actual cost from result content
* 🚀 ENHANCED: Fixed to properly extract costs from the session data structure
*/
private extractActualCostFromResult;
/**
* Get conservative fallback cost to prevent overcharging
*/
private getConservativeFallbackCost;
/**
* Check if user has permission to use a specific tool
*/
private checkToolPermission;
private handleResourcesList;
private handlePromptsList;
removeConnection(connectionId: string): void;
getConnectionCount(): number;
}
//# sourceMappingURL=McpProtocolHandler.d.ts.map