This commit is contained in:
cliffhall
2025-04-21 11:40:01 -04:00
parent e5f6524eb6
commit 3a2e248527
2 changed files with 13 additions and 7 deletions

View File

@@ -296,8 +296,10 @@ export function useConnection({
mcpProxyServerUrl.searchParams.append("url", sseUrl);
break;
}
(mcpProxyServerUrl as URL).searchParams.append("transportType", transportType);
(mcpProxyServerUrl as URL).searchParams.append(
"transportType",
transportType,
);
try {
// Inject auth manually instead of using SSEClientTransport, because we're

View File

@@ -98,7 +98,7 @@ const createTransport = async (req: express.Request): Promise<Transport> => {
return transport;
} else if (transportType === "streamable-http") {
const headers: HeadersInit = {
Accept: "text/event-stream, application/json"
Accept: "text/event-stream, application/json",
};
for (const key of STREAMABLE_HTTP_HEADERS_PASSTHROUGH) {
@@ -129,7 +129,6 @@ const createTransport = async (req: express.Request): Promise<Transport> => {
let backingServerTransport: Transport | undefined;
app.get("/mcp", async (req, res) => {
try {
console.log("New streamable-http connection");
@@ -227,7 +226,9 @@ app.get("/stdio", async (req, res) => {
console.log("Created web app transport");
await webAppTransport.start();
(backingServerTransport as StdioClientTransport).stderr!.on("data", (chunk) => {
(backingServerTransport as StdioClientTransport).stderr!.on(
"data",
(chunk) => {
webAppTransport.send({
jsonrpc: "2.0",
method: "notifications/stderr",
@@ -235,7 +236,8 @@ app.get("/stdio", async (req, res) => {
content: chunk.toString(),
},
});
});
},
);
mcpProxy({
transportToClient: webAppTransport,
@@ -251,7 +253,9 @@ app.get("/stdio", async (req, res) => {
app.get("/sse", async (req, res) => {
try {
console.log("New SSE connection. NOTE: The sse transport is deprecated and has been replaced by streamable-http");
console.log(
"New SSE connection. NOTE: The sse transport is deprecated and has been replaced by streamable-http",
);
try {
await backingServerTransport?.close();