Skip to main content
Glama
client.js763 B
import { Client } from "@modelcontextprotocol/sdk/client/index.js"; import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"; const client = new Client({ name: "test-client", version: "1.0.0" }); /** * @type {StdioClientTransport} * StdioClientTransport an instance for client to communicate with child process via stdio. * The child process is `mcp-add-server` executed by `npx`. */ const transport = new StdioClientTransport({ command: "npx", args: ["@zhefang/mcp-add-server"] }); try { await client.connect(transport); const result = await client.callTool({ name: "add", arguments: { a: 10, b: 5 } }); console.log("计算结果:", result); } catch (error) { console.error("发生错误:", error); }

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/zhangzhefang-github/mcp-add-server'

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