Skip to main content
Glama
server.ts855 B
import type { McpServerOptions } from './types' import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js' import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js' export function createServer(options: McpServerOptions): McpServer { const { name, version } = options const server = new McpServer( { name, version, }, ) return server } export async function startServer( server: McpServer, ): Promise<void> { const transport = new StdioServerTransport() try { await server.connect(transport) } catch (err) { console.error('Error starting server:', err) } } export async function stopServer(server: McpServer) { try { await server.close() } catch (error) { console.error(`Error occured during server stop:`, error) } finally { process.exit(0) } }

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/instructa/mcp-youtube-music'

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