yarn build
This commit is contained in:
parent
7b718de77c
commit
a1b8886b26
1 changed files with 90 additions and 54 deletions
13
dist/cli.js
generated
vendored
13
dist/cli.js
generated
vendored
|
|
@ -26,16 +26,13 @@ async function runClient(url_or_command, args) {
|
|||
// Ignore
|
||||
}
|
||||
if ((url === null || url === void 0 ? void 0 : url.protocol) === "http:" || (url === null || url === void 0 ? void 0 : url.protocol) === "https:") {
|
||||
clientTransport = new SSEClientTransport();
|
||||
await clientTransport.connect(new URL(url_or_command));
|
||||
clientTransport = new SSEClientTransport(new URL(url_or_command));
|
||||
}
|
||||
else if ((url === null || url === void 0 ? void 0 : url.protocol) === "ws:" || (url === null || url === void 0 ? void 0 : url.protocol) === "wss:") {
|
||||
clientTransport = new WebSocketClientTransport();
|
||||
await clientTransport.connect(new URL(url_or_command));
|
||||
clientTransport = new WebSocketClientTransport(new URL(url_or_command));
|
||||
}
|
||||
else {
|
||||
clientTransport = new StdioClientTransport();
|
||||
await clientTransport.spawn({
|
||||
clientTransport = new StdioClientTransport({
|
||||
command: url_or_command,
|
||||
args,
|
||||
});
|
||||
|
|
@ -52,7 +49,7 @@ async function runServer(port) {
|
|||
let servers = [];
|
||||
app.get("/sse", async (req, res) => {
|
||||
console.log("Got new SSE connection");
|
||||
const transport = new SSEServerTransport("/message");
|
||||
const transport = new SSEServerTransport("/message", res);
|
||||
const server = new Server({
|
||||
name: "mcp-typescript test server",
|
||||
version: "0.1.0",
|
||||
|
|
@ -62,7 +59,6 @@ async function runServer(port) {
|
|||
console.log("SSE connection closed");
|
||||
servers = servers.filter((s) => s !== server);
|
||||
};
|
||||
await transport.connectSSE(req, res);
|
||||
await server.connect(transport);
|
||||
});
|
||||
app.post("/message", async (req, res) => {
|
||||
|
|
@ -87,7 +83,6 @@ async function runServer(port) {
|
|||
version: "0.1.0",
|
||||
});
|
||||
const transport = new StdioServerTransport();
|
||||
await transport.start();
|
||||
await server.connect(transport);
|
||||
console.log("Server running on stdio");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue