Skip to main content
Glama

MCP Toolkit

by zxfgds
index.ts1.99 kB
import { Server } from '@modelcontextprotocol/sdk/server/index.js'; import { Config } from '../config/config.js'; import { ToolDefinition, ToolResponse } from './types.js'; // 导入工具实现 import { createCommandTools } from './command/index.js'; import { createLoggerTools } from './logger/index.js'; import { stackTraceTools } from './stack-trace/index.js'; import { createDatabaseTools } from './database/index.js'; import { createGithubTools } from './github/index.js'; import { createSearchTools } from './search/index.js'; import { createWebpageTools } from './webpage/index.js'; import { createEverythingTools } from './everything/index.js'; import { createNetworkTools } from './network/index.js'; import { createFilesystemTools } from './filesystem/index.js'; // 注册工具函数 export function registerTools( server: Server, config: Config ): ToolDefinition[] { try { // 合并所有工具定义 const tools: ToolDefinition[] = [ ...createCommandTools(config), ...createLoggerTools(config), ...stackTraceTools, ...createDatabaseTools(config), ...createGithubTools(config), ...createSearchTools(config), ...createWebpageTools(config), ...createEverythingTools(config), ...createNetworkTools(config), ...createFilesystemTools(config), ]; // 确保每个工具都有正确的格式 return tools.map(tool => ({ name: tool.name, description: tool.description || '', inputSchema: { type: 'object', properties: tool.inputSchema.properties, required: tool.inputSchema.required || [] }, // 直接返回原始handler的结果,让server.ts处理格式转换 handler: async (args: any) => { try { // 执行工具处理器 const result = await tool.handler(args); return result; } catch (error) { throw error; } } })); } catch (error) { throw error; } }

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/zxfgds/mcp-toolkit'

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