Skip to main content
Glama

Claude MCP Server Integration

by mokemoke0821
mcp-communicator.js5.26 kB
/** * MCP間連携ユーティリティ * 他のMCPサーバーとの連携機能を強化するための機能集 */ class MCPCommunicator { constructor() { // 他のMCPサーバーへの参照を保持(実際のMCP環境では自動的に解決される) this.mcpReferences = { 'powershell-commander': { available: true, lastChecked: new Date() }, 'web-research-commander': { available: true, lastChecked: new Date() }, 'claude-code-commander': { available: true, lastChecked: new Date() }, 'enhanced-file-commander': { available: true, lastChecked: new Date() } }; // 連携ワークフローの定義 this.integratedWorkflows = { 'research-analyze-synthesize': { description: 'Web検索から情報を収集し、Deep Thinkで分析して統合', steps: [ { service: 'web-research-commander', tool: 'search_web', inputMapping: { query: 'searchQuery', numResults: 5 } }, { service: 'deep-think-commander', tool: 'analyze', inputMapping: { theme: 'searchResults' } }, { service: 'deep-think-commander', tool: 'decompose', inputMapping: { theme: 'analysisResult' } } ] }, 'system-analyze-optimize': { description: 'システム情報を収集分析し、最適化案を生成', steps: [ { service: 'powershell-commander', tool: 'execute_powershell', inputMapping: { command: 'systemInfoCommand' } }, { service: 'deep-think-commander', tool: 'swotAnalysis', inputMapping: { topic: 'systemInfo' } }, { service: 'deep-think-commander', tool: 'strategicThinkingChain', inputMapping: { strategicTopic: 'optimizationContext' } } ] } }; } /** * 特定のMCPサービスの利用可能性をチェック * @param {string} serviceName - MCPサービス名 * @returns {boolean} 利用可能かどうか */ isServiceAvailable(serviceName) { if (!this.mcpReferences[serviceName]) { return false; } return this.mcpReferences[serviceName].available; } /** * すべての利用可能なMCPサービスをリスト * @returns {Array} 利用可能なサービスの配列 */ listAvailableServices() { return Object.keys(this.mcpReferences).filter(service => this.mcpReferences[service].available ); } /** * 利用可能なワークフローをリスト * @returns {Object} 利用可能なワークフロー */ listAvailableWorkflows() { return this.integratedWorkflows; } /** * 特定のワークフローの詳細を取得 * @param {string} workflowName - ワークフロー名 * @returns {Object} ワークフローの詳細 */ getWorkflowDetails(workflowName) { return this.integratedWorkflows[workflowName]; } /** * サービス間連携のメタデータを交換 * @param {string} targetService - 対象サービス名 * @returns {Object} 連携メタデータ */ exchangeMetadata(targetService) { // 実際のMCP環境では、サービス間で必要なメタデータを交換する return { service: 'deep-think-commander', capabilities: [ 'analytical-thinking', 'structured-reasoning', 'multi-stage-analysis' ], dataFormats: [ 'json', 'text' ], version: '3.0.0' }; } /** * 連携ワークフローを実行 * @param {string} workflowName - ワークフロー名 * @param {Object} inputs - 入力パラメータ * @returns {Object} ワークフロー実行結果 */ async executeWorkflow(workflowName, inputs) { // この関数は実際のMCP環境で実装される // このモックでは、ワークフローの構造を返す const workflow = this.integratedWorkflows[workflowName]; if (!workflow) { throw new Error(`ワークフロー "${workflowName}" が見つかりません。`); } // 実行計画を作成 const executionPlan = workflow.steps.map(step => { // 入力のマッピング const mappedInputs = {}; for (const [param, inputKey] of Object.entries(step.inputMapping)) { mappedInputs[param] = inputs[inputKey] || `{${inputKey}}`; } return { service: step.service, tool: step.tool, inputs: mappedInputs }; }); return { workflow: workflowName, description: workflow.description, executionPlan, mockResults: { status: 'success', message: 'これはモックの実行結果です。実際のMCP環境では、実際のツール実行結果が返されます。' } }; } } module.exports = MCPCommunicator;

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mokemoke0821/claude-mcp-integration'

If you have feedback or need assistance with the MCP directory API, please join our Discord server