Skip to content

Commit

Permalink
Merge pull request #75 from modelcontextprotocol/jspahrsummers-patch-1
Browse files Browse the repository at this point in the history
Declare capabilities, fix imports in README examples
  • Loading branch information
jspahrsummers authored Nov 27, 2024
2 parents 105b310 + c6cb7d3 commit 5bfa616
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -32,6 +32,8 @@ const transport = new StdioClientTransport({
const client = new Client({
name: "example-client",
version: "1.0.0",
}, {
capabilities: {}
});

await client.connect(transport);
Expand All @@ -57,12 +59,16 @@ 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",
version: "1.0.0",
}, {
capabilities: {
resources: {}
}
});

server.setRequestHandler(ListResourcesRequestSchema, async () => {
Expand Down

0 comments on commit 5bfa616

Please sign in to comment.