You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

29 lines
597 B

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: "weather-client",
version: "0.0.1",
},
{
capabilities: {
prompts: {},
resources: {},
tools: {},
},
}
);
try {
await client.connect(transport);
console.log("Connected successfully");
} catch (error) {
console.error("Failed to connect:", error);
}