拖拽文件到这里或点击选择
正在加载...
// 导入 FastMCP 和 Zod import { FastMCP } from "fastmcp"; import { z } from "zod"; const server = new FastMCP({ name: "我的服务器", version: "1.0.0", }); // 添加工具 server.addTool({ name: "add", description: "计算两个数字的和", //使用 Zod 定义参数 parameters: z.object({ a: z.number().describe("第一个数字"), b: z.number().describe("第二个数字") }), execute: async ({ a, b }) => { const result = a + b; return String(result); }, }); server.start({ transportType: "stdio" });
必需内容: ✓ import { FastMCP } from "fastmcp" ✓ new FastMCP(...) ✓ addTool() 方法