From 5490e56a3f8b46216b98ebb3ad7bc1be66cb108e Mon Sep 17 00:00:00 2001 From: Justin Spahr-Summers Date: Wed, 27 Nov 2024 10:36:31 -0600 Subject: [PATCH 1/2] Declare capabilities in README examples --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 8a427b8..2ca2282 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,8 @@ const transport = new StdioClientTransport({ const client = new Client({ name: "example-client", version: "1.0.0", +}, { + capabilities: {} }); await client.connect(transport); @@ -63,6 +65,10 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio"; const server = new Server({ name: "example-server", version: "1.0.0", +}, { + capabilities: { + resources: {} + } }); server.setRequestHandler(ListResourcesRequestSchema, async () => { From c6cb7d343d60c196d796af6457c5c3ee3339f44c Mon Sep 17 00:00:00 2001 From: Justin Spahr-Summers Date: Wed, 27 Nov 2024 10:37:04 -0600 Subject: [PATCH 2/2] Fix imports --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2ca2282..76c45ab 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,8 @@ npm install @modelcontextprotocol/sdk ### Creating a Client ```typescript -import { Client } from "@modelcontextprotocol/sdk/client"; -import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio"; +import { Client } from "@modelcontextprotocol/sdk/client/index.js"; +import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"; const transport = new StdioClientTransport({ command: "path/to/server", @@ -59,8 +59,8 @@ const resourceContent = await client.request( ### Creating a Server ```typescript -import { Server } from "@modelcontextprotocol/sdk/server"; -import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio"; +import { Server } from "@modelcontextprotocol/sdk/server/index.js"; +import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; const server = new Server({ name: "example-server",