Skip to main content
Glama
index.ts1.55 kB
#!/usr/bin/env node /** * Entry point for the Cognitive MCP Server * Configurable as MCP server with: npx thoughtmcp@latest */ import { CognitiveMCPServer } from "./server/CognitiveMCPServer.js"; // Export the main components for library usage export * from "./cognitive/index.js"; export { CognitiveMCPServer } from "./server/CognitiveMCPServer.js"; export * from "./types/index.js"; export * from "./utils/index.js"; async function main(): Promise<void> { try { const server = new CognitiveMCPServer(); await server.initialize(); // Keep the process running process.stdin.resume(); } catch (error) { console.error("Failed to start Cognitive MCP Server:", error); process.exit(1); } } // Only run main if this file is executed directly (not imported) // Check multiple conditions to handle different execution contexts (direct, npx, etc.) const isMainModule = import.meta.url === `file://${process.argv[1]}` || (process.argv[1]?.endsWith("index.js") ?? false) || (process.argv[1]?.includes("thoughtmcp") ?? false); if (isMainModule) { // Handle unhandled promise rejections process.on("unhandledRejection", (reason, promise) => { console.error("Unhandled Rejection at:", promise, "reason:", reason); process.exit(1); }); // Handle uncaught exceptions process.on("uncaughtException", (error) => { console.error("Uncaught Exception:", error); process.exit(1); }); main().catch((error) => { console.error("Main function error:", error); process.exit(1); }); }

Latest Blog Posts

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/keyurgolani/ThoughtMcp'

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