Skip to content

Commit b6e7dd1

Browse files
committed
rm sse + dockerfile update to support pnpm
1 parent 5fd6b2f commit b6e7dd1

File tree

5 files changed

+7
-47
lines changed

5 files changed

+7
-47
lines changed

config.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export type Config = {
6363
*/
6464
server?: {
6565
/**
66-
* The port to listen on for SSE or MCP transport.
66+
* The port to listen on for SHTTP or MCP transport.
6767
*/
6868
port?: number;
6969
/**

smithery.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
runtime: "typescript"
2-
packageManager: "pnpm"
3-
buildCommand: "pnpm build"
2+
build:
3+
dockerfile: "Dockerfile"
4+
dockerBuildPath: "."

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export const configSchema = z
8181
port: z
8282
.number()
8383
.optional()
84-
.describe("The port to listen on for SSE or MCP transport"),
84+
.describe("The port to listen on for SHTTP or MCP transport"),
8585
host: z
8686
.string()
8787
.optional()

src/program.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ program
4646
"Whether to persist the Browserbase context",
4747
true,
4848
)
49-
.option("--port <port>", "Port to listen on for SSE transport.")
49+
.option("--port <port>", "Port to listen on for SHTTP transport.")
5050
.option(
5151
"--host <host>",
5252
"Host to bind server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces.",

src/transport.ts

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import crypto from "node:crypto";
44

55
import { ServerList } from "./server.js";
66
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
7-
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
87
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
98
import type { Config } from "../config.js";
109

@@ -76,44 +75,6 @@ The server will now attempt to start, but will likely fail without the API key..
7675
await server.connect(new StdioServerTransport());
7776
}
7877

79-
async function handleSSE(
80-
req: http.IncomingMessage,
81-
res: http.ServerResponse,
82-
url: URL,
83-
serverList: ServerList,
84-
sessions: Map<string, SSEServerTransport>,
85-
) {
86-
if (req.method === "POST") {
87-
const sessionId = url.searchParams.get("sessionId");
88-
if (!sessionId) {
89-
res.statusCode = 400;
90-
return res.end("Missing sessionId");
91-
}
92-
93-
const transport = sessions.get(sessionId);
94-
if (!transport) {
95-
res.statusCode = 404;
96-
return res.end("Session not found");
97-
}
98-
99-
return await transport.handlePostMessage(req, res);
100-
} else if (req.method === "GET") {
101-
const transport = new SSEServerTransport("/sse", res);
102-
sessions.set(transport.sessionId, transport);
103-
const server = await serverList.create();
104-
res.on("close", () => {
105-
sessions.delete(transport.sessionId);
106-
serverList.close(server).catch((e) => {
107-
console.error(e);
108-
});
109-
});
110-
return await server.connect(transport);
111-
}
112-
113-
res.statusCode = 405;
114-
res.end("Method not allowed");
115-
}
116-
11778
async function handleStreamable(
11879
req: http.IncomingMessage,
11980
res: http.ServerResponse,
@@ -155,7 +116,6 @@ export function startHttpTransport(
155116
hostname: string | undefined,
156117
serverList: ServerList,
157118
) {
158-
const sseSessions = new Map<string, SSEServerTransport>();
159119
const streamableSessions = new Map<string, StreamableHTTPServerTransport>();
160120
const httpServer = http.createServer(async (req, res) => {
161121
if (!req.url) {
@@ -166,7 +126,6 @@ export function startHttpTransport(
166126
const url = new URL(`http://localhost${req.url}`);
167127
if (url.pathname.startsWith("/mcp"))
168128
await handleStreamable(req, res, serverList, streamableSessions);
169-
else await handleSSE(req, res, url, serverList, sseSessions);
170129
});
171130
httpServer.listen(port, hostname, () => {
172131
const address = httpServer.address();
@@ -189,7 +148,7 @@ export function startHttpTransport(
189148
{
190149
mcpServers: {
191150
browserbase: {
192-
url: `${url}/sse`,
151+
url: `${url}/mcp`,
193152
},
194153
},
195154
},

0 commit comments

Comments
 (0)