Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve and test version negotiation #51

Merged
merged 12 commits into from
Nov 12, 2024
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