mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-10 23:48:26 +00:00
Fix: mcp server stream is failing in mid flight
This commit is contained in:
parent
cdb6788ef0
commit
c488d08483
@ -229,13 +229,17 @@ export const handleMCPRequest = async (
|
||||
export const handleSessionRequest = async (
|
||||
req: Request,
|
||||
res: Response,
|
||||
workspaceId: string,
|
||||
userId: string,
|
||||
) => {
|
||||
const sessionId = req.headers["mcp-session-id"] as string | undefined;
|
||||
const workspace = await getWorkspaceByUser(userId);
|
||||
|
||||
if (
|
||||
sessionId &&
|
||||
(await MCPSessionManager.isSessionActive(sessionId, workspaceId))
|
||||
(await MCPSessionManager.isSessionActive(
|
||||
sessionId,
|
||||
workspace?.id as string,
|
||||
))
|
||||
) {
|
||||
const sessionData = TransportManager.getSessionInfo(sessionId);
|
||||
|
||||
|
||||
@ -3,10 +3,7 @@ import compression from "compression";
|
||||
import express from "express";
|
||||
import morgan from "morgan";
|
||||
|
||||
// import {
|
||||
// handleMCPRequest,
|
||||
// handleSessionRequest,
|
||||
// } from "~/services/mcp.server";
|
||||
// import { handleMCPRequest, handleSessionRequest } from "~/services/mcp.server";
|
||||
// import { authenticateHybridRequest } from "~/services/routeBuilders/apiBuilder.server";
|
||||
|
||||
let viteDevServer: any;
|
||||
@ -65,7 +62,7 @@ async function init() {
|
||||
return;
|
||||
}
|
||||
|
||||
await module.handleSessionRequest(req, res);
|
||||
await module.handleSessionRequest(req, res, authenticationResult.userId);
|
||||
});
|
||||
|
||||
app.post("/api/v1/mcp", async (req, res) => {
|
||||
@ -116,7 +113,7 @@ async function init() {
|
||||
return;
|
||||
}
|
||||
|
||||
await module.handleSessionRequest(req, res);
|
||||
await module.handleSessionRequest(req, res, authenticationResult.userId);
|
||||
});
|
||||
|
||||
app.options("/api/v1/mcp", (_, res) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user