Skip to main content
Glama

OpenSubtitles MCP Server

Official
simple-index.js4.38 kB
import { Server } from "@modelcontextprotocol/sdk/server/index.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; const SERVER_VERSION = "v2.1.0-debug-fixed"; console.error("=".repeat(60)); console.error(`SIMPLE-${SERVER_VERSION}: Starting simple MCP server`); console.error(`SIMPLE-${SERVER_VERSION}: Process args:`, process.argv); console.error(`SIMPLE-${SERVER_VERSION}: Working directory:`, process.cwd()); console.error(`SIMPLE-${SERVER_VERSION}: Node version:`, process.version); console.error(`SIMPLE-${SERVER_VERSION}: Timestamp:`, new Date().toISOString()); console.error("=".repeat(60)); async function main() { console.error("SIMPLE: Entered main function"); try { console.error("SIMPLE: Creating server"); const server = new Server({ name: "opensubtitles-mcp-server", version: "1.0.0", }, { capabilities: { tools: {}, }, }); console.error("SIMPLE: Setting up handlers"); // Simple tools list server.setRequestHandler(ListToolsRequestSchema, async () => { console.error("SIMPLE: ListTools called"); return { tools: [ { name: "test_tool", description: "A simple test tool", inputSchema: { type: "object", properties: { message: { type: "string", description: "A test message" } }, required: ["message"] } } ] }; }); // Simple tool handler server.setRequestHandler(CallToolRequestSchema, async (request) => { console.error("SIMPLE: CallTool called with:", request.params.name); return { content: [ { type: "text", text: "Simple MCP server is working!" } ] }; }); console.error("SIMPLE: Connecting transport"); const transport = new StdioServerTransport(); await server.connect(transport); console.error("SIMPLE: Connected successfully"); // Keep the process alive with multiple approaches console.error("SIMPLE: Setting up keep-alive mechanisms"); // Method 1: Signal handlers process.on('SIGINT', () => { console.error("SIMPLE: Received SIGINT, shutting down gracefully"); process.exit(0); }); process.on('SIGTERM', () => { console.error("SIMPLE: Received SIGTERM, shutting down gracefully"); process.exit(0); }); // Method 2: Prevent event loop from exiting const keepAlive = setInterval(() => { // Do nothing, just keep event loop alive }, 60000); // Every minute // Method 3: Explicitly keep process running process.on('beforeExit', (code) => { console.error("SIMPLE: Process about to exit with code:", code); console.error("SIMPLE: Keeping process alive"); }); console.error("SIMPLE: Keep-alive mechanisms set up"); } catch (error) { console.error("SIMPLE: Error in main function:", error); throw error; } } console.error("=".repeat(60)); console.error(`SIMPLE-${SERVER_VERSION}: Checking entry point condition...`); console.error(`SIMPLE-${SERVER_VERSION}: import.meta.url:`, import.meta.url); console.error(`SIMPLE-${SERVER_VERSION}: process.argv[1]:`, process.argv[1]); console.error(`SIMPLE-${SERVER_VERSION}: file:// + process.argv[1]:`, `file://${process.argv[1]}`); // Always call main - don't rely on ES module entry point check console.error(`SIMPLE-${SERVER_VERSION}: Starting main function regardless of entry point check`); console.error("=".repeat(60)); main().catch((error) => { console.error("SIMPLE: Error:", error); process.exit(1); }); //# sourceMappingURL=simple-index.js.map

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/opensubtitles/mcp.opensubtitles.com'

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