Skip to main content
Glama
client.js1.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const index_js_1 = require("@modelcontextprotocol/sdk/client/index.js"); const stdio_js_1 = require("@modelcontextprotocol/sdk/client/stdio.js"); async function main() { const toolName = process.argv[2]; const toolArgs = process.argv[3] ? JSON.parse(process.argv[3]) : {}; if (!toolName) { console.error("Usage: node client.js <tool_name> <json_args>"); process.exit(1); } const transport = new stdio_js_1.StdioClientTransport({ command: "node", args: ["./build/index.js"], }); const client = new index_js_1.Client({ name: "cli-client", version: "1.0.0" }, { capabilities: {} }); await client.connect(transport); try { const result = await client.callTool({ name: toolName, arguments: toolArgs, }); // @ts-ignore console.log(result.content[0].text); } catch (error) { console.error("Error:", error); } finally { await client.close(); } } main();

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/Racimy/Allocin-MCP'

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