UNPKG

dataforseo-mcp-server

Version:

CLI and MCP server for DataForSEO API — browse documentation and make authenticated API requests

26 lines • 1.02 kB
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { z } from "zod"; import { getPackageName, getPackageVersion } from "../core/version.js"; import { McpServerInstructions } from "./instructions.js"; import { buildToolsRecord } from "./tool-definition.js"; export function initMcpServer(tools) { const server = new McpServer({ name: getPackageName(), version: getPackageVersion(), }, { capabilities: { logging: {} }, instructions: McpServerInstructions.TEXT, }); const toolDefinitions = buildToolsRecord(tools); for (const [toolName, tool] of Object.entries(toolDefinitions)) { const schema = z.object(tool.params); server.registerTool(toolName, { title: tool.title, description: tool.description, inputSchema: schema.shape, annotations: tool.annotations, }, (args, extra) => tool.handler(args, extra)); } return server; } //# sourceMappingURL=init-mcp-server.js.map