Prettier
This commit is contained in:
@@ -296,8 +296,10 @@ export function useConnection({
|
|||||||
mcpProxyServerUrl.searchParams.append("url", sseUrl);
|
mcpProxyServerUrl.searchParams.append("url", sseUrl);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
(mcpProxyServerUrl as URL).searchParams.append("transportType", transportType);
|
(mcpProxyServerUrl as URL).searchParams.append(
|
||||||
|
"transportType",
|
||||||
|
transportType,
|
||||||
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Inject auth manually instead of using SSEClientTransport, because we're
|
// Inject auth manually instead of using SSEClientTransport, because we're
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ const createTransport = async (req: express.Request): Promise<Transport> => {
|
|||||||
return transport;
|
return transport;
|
||||||
} else if (transportType === "streamable-http") {
|
} else if (transportType === "streamable-http") {
|
||||||
const headers: HeadersInit = {
|
const headers: HeadersInit = {
|
||||||
Accept: "text/event-stream, application/json"
|
Accept: "text/event-stream, application/json",
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const key of STREAMABLE_HTTP_HEADERS_PASSTHROUGH) {
|
for (const key of STREAMABLE_HTTP_HEADERS_PASSTHROUGH) {
|
||||||
@@ -129,7 +129,6 @@ const createTransport = async (req: express.Request): Promise<Transport> => {
|
|||||||
|
|
||||||
let backingServerTransport: Transport | undefined;
|
let backingServerTransport: Transport | undefined;
|
||||||
|
|
||||||
|
|
||||||
app.get("/mcp", async (req, res) => {
|
app.get("/mcp", async (req, res) => {
|
||||||
try {
|
try {
|
||||||
console.log("New streamable-http connection");
|
console.log("New streamable-http connection");
|
||||||
@@ -227,7 +226,9 @@ app.get("/stdio", async (req, res) => {
|
|||||||
console.log("Created web app transport");
|
console.log("Created web app transport");
|
||||||
|
|
||||||
await webAppTransport.start();
|
await webAppTransport.start();
|
||||||
(backingServerTransport as StdioClientTransport).stderr!.on("data", (chunk) => {
|
(backingServerTransport as StdioClientTransport).stderr!.on(
|
||||||
|
"data",
|
||||||
|
(chunk) => {
|
||||||
webAppTransport.send({
|
webAppTransport.send({
|
||||||
jsonrpc: "2.0",
|
jsonrpc: "2.0",
|
||||||
method: "notifications/stderr",
|
method: "notifications/stderr",
|
||||||
@@ -235,7 +236,8 @@ app.get("/stdio", async (req, res) => {
|
|||||||
content: chunk.toString(),
|
content: chunk.toString(),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
mcpProxy({
|
mcpProxy({
|
||||||
transportToClient: webAppTransport,
|
transportToClient: webAppTransport,
|
||||||
@@ -251,7 +253,9 @@ app.get("/stdio", async (req, res) => {
|
|||||||
|
|
||||||
app.get("/sse", async (req, res) => {
|
app.get("/sse", async (req, res) => {
|
||||||
try {
|
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 {
|
try {
|
||||||
await backingServerTransport?.close();
|
await backingServerTransport?.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user