Skip to main content
Glama

Backlog MCP Server

wrapServerWithToolRegistry.ts1.18 kB
import { McpServer, ToolCallback, } from '@modelcontextprotocol/sdk/server/mcp.js'; import { z } from 'zod'; // Extended type that has the MCP core, a set of registered tool names, and a registration function export interface BacklogMCPServer extends McpServer { __registeredToolNames?: Set<string>; registerOnce: ( name: string, description: string, schema: z.ZodRawShape, handler: ToolCallback<z.ZodRawShape> ) => void; } // This function takes an McpServer instance and extends it with a tool registration mechanism that prevents duplicate tool registrations. export function wrapServerWithToolRegistry( server: McpServer ): BacklogMCPServer { const s = server as BacklogMCPServer; if (!s.__registeredToolNames) { s.__registeredToolNames = new Set(); } s.registerOnce = ( name: string, description: string, schema: z.ZodRawShape, handler: ToolCallback<z.ZodRawShape> ) => { if (s.__registeredToolNames!.has(name)) { console.warn(`Skipping duplicate tool registration: ${name}`); return; } s.__registeredToolNames!.add(name); s.tool(name, description, schema, handler); }; return s; }

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/nulab/backlog-mcp-server'

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