Skip to main content
Glama
index.ts1.24 kB
#!/usr/bin/env node import { Server } from "@modelcontextprotocol/sdk/server/index.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js"; import { bandTools, handleToolCall } from "./tools.js"; const server = new Server( { name: "band-mcp-server", version: "1.0.2", }, { capabilities: { tools: {}, }, } ); server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: bandTools, }; }); server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; return await handleToolCall(name, args); }); /** * Start the MCP server using stdio transport. Exported so CLI can import and control when to start. */ export async function startServerWithStdIO(): Promise<void> { await server.connect(new StdioServerTransport()); } // If this file is run directly (node src/index.ts), start the server immediately. if (process.argv[1] && process.argv[1].endsWith("index.ts")) { startServerWithStdIO().catch((error) => { console.error("Server 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/kanghouchao/band-mcp-server'

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