import { Client } from "@modelcontextprotocol/sdk/client/index.js"; import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"; const transport = new StdioClientTransport({ command: "node", args: ["./server.js"], cwd: process.cwd(), }); const client = new Client( { name: "example-client", version: "1.0.0", }, { capabilities: { prompts: {}, resources: {}, tools: {}, }, } ); try { await client.connect(transport); console.log("Connected successfully"); // const prompts = await client.listPrompts(); // console.log(prompts); // const prompt = await client.getPrompt({ // name: "echo", // arguments: { // message: "aaac", // }, // }); // console.log(prompt); // Call a tool // const result = await client.callTool({ // name: "echo", // arguments: { // message: "value", // }, // }); // console.log(result); // const resources = await client.listResources(); // console.log(resources); // Read a resource // const resource = await client.readResource({ // uri: "echo://asa", // }); // console.log(resource); } catch (error) { console.error("Failed to connect:", error); }