Skip to content

bun run express SSEServerTransport BUG #18745

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

Closed
phpmac opened this issue Apr 3, 2025 · 2 comments
Closed

bun run express SSEServerTransport BUG #18745

phpmac opened this issue Apr 3, 2025 · 2 comments
Labels
bug Something isn't working needs triage

Comments

@phpmac
Copy link

phpmac commented Apr 3, 2025

What version of Bun is running?

1.2.5

What platform is your computer?

Darwin M3Pro.local 24.4.0 Darwin Kernel Version 24.4.0: Wed Mar 19 21:17:32 PDT 2025; root:xnu-11417.101.15~1/RELEASE_ARM64_T6030 arm64

What steps can reproduce the bug?


import express from "express";
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
import { z } from "zod";

const app = express();

const server = new McpServer(
    {
        name: "example-server",
        version: "1.0.0",
    },
    {
        capabilities: {},
    }
);

// Add an addition tool
server.tool("add", { a: z.number(), b: z.number() }, async ({ a, b }) => ({
    content: [{ type: "text", text: String(a + b) }],
}));

let transport: SSEServerTransport | null = null;

app.get("/sse", (req, res) => {
    transport = new SSEServerTransport("/messages", res);
    server.connect(transport);
});

app.post("/messages", (req, res) => {
    if (transport) {
        transport.handlePostMessage(req, res);
    }
});

app.listen(3000);


What is the expected behavior?

No response
bun run main.ts will not be able to access /sse
npx tsx main.ts is normal

What do you see instead?

No response

Additional information

No response

@phpmac phpmac added bug Something isn't working needs triage labels Apr 3, 2025
@cirospaciari
Copy link
Member

This was fixed by #18804 and is present in bun v1.2.9

@phpmac
Copy link
Author

phpmac commented Apr 11, 2025

This was fixed by #18804 and is present in bun v1.2.9

Unfortunately, I found a bug that will cause some programs to fail to connect and not respond.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

2 participants