UNPKG

@emmahyde/thinking-patterns

Version:

MCP server combining systematic thinking, mental models, debugging approaches, and stochastic algorithms for comprehensive cognitive pattern support

99 lines (98 loc) 4.25 kB
import { ScientificMethodServer } from '../servers/ScientificMethodServer.js'; import { MentalModelServer } from '../servers/MentalModelServer.js'; import { DebuggingApproachServer } from '../servers/DebuggingApproachServer.js'; import { SequentialThinkingServer } from '../servers/SequentialThinkingServer.js'; import { StochasticAlgorithmServer } from '../servers/StochasticAlgorithmServer.js'; import { DecisionFrameworkServer } from '../servers/DecisionFrameworkServer.js'; import { CollaborativeReasoningServer } from '../servers/CollaborativeReasoningServer.js'; import { MetacognitiveMonitoringServer } from '../servers/MetacognitiveMonitoringServer.js'; import { StructuredArgumentationServer } from '../servers/StructuredArgumentationServer.js'; import { VisualReasoningServer } from '../servers/VisualReasoningServer.js'; export class ServerRegistry { constructor() { this.servers = new Map(); this.initializeServers(); } initializeServers() { // Register original servers using standardized run method which returns MCPResponse this.servers.set('scientific_method', { process: (input) => new ScientificMethodServer().run(input) }); this.servers.set('mental_model', { process: (input) => new MentalModelServer().run(input) }); this.servers.set('debugging_approach', { process: (input) => new DebuggingApproachServer().run(input) }); this.servers.set('sequential_thinking', { process: (input) => new SequentialThinkingServer().run(input) }); this.servers.set('stochastic_algorithm', { process: (input) => new StochasticAlgorithmServer().run(input) }); // Register the additional imported servers using standardized run method this.servers.set('decision_framework', { process: (input) => new DecisionFrameworkServer().run(input) }); this.servers.set('collaborative_reasoning', { process: (input) => new CollaborativeReasoningServer().run(input) }); this.servers.set('metacognitive_monitoring', { process: (input) => new MetacognitiveMonitoringServer().run(input) }); this.servers.set('structured_argumentation', { process: (input) => new StructuredArgumentationServer().run(input) }); this.servers.set('visual_reasoning', { process: (input) => new VisualReasoningServer().run(input) }); } getServer(serverName) { return this.servers.get(serverName.toLowerCase()); } hasServer(serverName) { return this.servers.has(serverName.toLowerCase()); } getAvailableServers() { return Array.from(this.servers.keys()); } processRequest(serverName, input) { const server = this.getServer(serverName); if (!server) { return { content: [{ type: "text", text: `Error: Server '${serverName}' not found` }], isError: true }; } try { return server.process(input); } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred'; return { content: [{ type: "text", text: `Error processing request: ${errorMessage}` }], isError: true }; } } getServerStats() { return { totalServers: this.servers.size, availableServers: this.getAvailableServers(), serverTypes: { scientific: ['scientific_method'], cognitive: ['mental_model', 'sequential_thinking', 'metacognitive_monitoring'], technical: ['debugging_approach'], probabilistic: ['stochastic_algorithm'], reasoning: ['collaborative_reasoning', 'structured_argumentation', 'visual_reasoning'], decision: ['decision_framework'] } }; } registerCustomServer(name, server) { this.servers.set(name.toLowerCase(), server); } unregisterServer(name) { return this.servers.delete(name.toLowerCase()); } }