Skip to content

Commit

Permalink
Merge pull request #51 from modelcontextprotocol/justin/test-version-…
Browse files Browse the repository at this point in the history
…negotiation

Improve and test version negotiation
  • Loading branch information
jspahrsummers authored Nov 12, 2024
2 parents 268aac8 + 6aab7ee commit 02c5021
Show file tree
Hide file tree
Showing 9 changed files with 1,294 additions and 105 deletions.
46 changes: 34 additions & 12 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,17 @@ import { StdioServerTransport } from "./server/stdio.js";
import { ListResourcesResultSchema } from "./types.js";

async function runClient(url_or_command: string, args: string[]) {
const client = new Client({
name: "mcp-typescript test client",
version: "0.1.0",
});
const client = new Client(
{
name: "mcp-typescript test client",
version: "0.1.0",
},
{
capabilities: {
sampling: {},
},
},
);

let clientTransport;

Expand Down Expand Up @@ -63,10 +70,15 @@ async function runServer(port: number | null) {
console.log("Got new SSE connection");

const transport = new SSEServerTransport("/message", res);
const server = new Server({
name: "mcp-typescript test server",
version: "0.1.0",
});
const server = new Server(
{
name: "mcp-typescript test server",
version: "0.1.0",
},
{
capabilities: {},
},
);

servers.push(server);

Expand Down Expand Up @@ -97,10 +109,20 @@ async function runServer(port: number | null) {
console.log(`Server running on http://localhost:${port}/sse`);
});
} else {
const server = new Server({
name: "mcp-typescript test server",
version: "0.1.0",
});
const server = new Server(
{
name: "mcp-typescript test server",
version: "0.1.0",
},
{
capabilities: {
prompts: {},
resources: {},
tools: {},
logging: {},
},
},
);

const transport = new StdioServerTransport();
await server.connect(transport);
Expand Down
Loading

0 comments on commit 02c5021

Please sign in to comment.