UNPKG

@trendmoon/mcp-server

Version:

TrendMoon MCP Server - Library and Standalone Server for Cryptocurrency and Social Data

28 lines β€’ 1.29 kB
import { TrendmoonMcpServer } from '../lib/index.js'; import { StdioTransport } from './stdio/StdioTransport.js'; import { HttpTransport } from './http/HttpTransport.js'; export async function startStandaloneServer(config) { console.error("πŸš€ Starting TrendMoon MCP Server..."); const trendmoonServer = new TrendmoonMcpServer(config.server); const mcpServer = trendmoonServer.getMcpServer(); if (config.transport === 'stdio') { console.error("πŸ“‘ Using STDIO transport..."); const transport = new StdioTransport(); await mcpServer.connect(transport); console.error("βœ… MCP Server connected via STDIO"); } else if (config.transport === 'http') { console.error("🌐 Using HTTP + SSE transport..."); const transport = new HttpTransport(config.http); // Connecter le serveur MCP au transport HTTP transport.setMcpServer(mcpServer); // DΓ©marrer le serveur HTTP await transport.start(); console.error("βœ… HTTP transport started and ready for SSE connections"); console.error("🎯 Connect to /sse endpoint to establish MCP session"); } else { throw new Error(`❌ Unsupported transport: ${config.transport}`); } } //# sourceMappingURL=server.js.map