mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-11 09:58:28 +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 (
|
export const handleSessionRequest = async (
|
||||||
req: Request,
|
req: Request,
|
||||||
res: Response,
|
res: Response,
|
||||||
workspaceId: string,
|
userId: string,
|
||||||
) => {
|
) => {
|
||||||
const sessionId = req.headers["mcp-session-id"] as string | undefined;
|
const sessionId = req.headers["mcp-session-id"] as string | undefined;
|
||||||
|
const workspace = await getWorkspaceByUser(userId);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
sessionId &&
|
sessionId &&
|
||||||
(await MCPSessionManager.isSessionActive(sessionId, workspaceId))
|
(await MCPSessionManager.isSessionActive(
|
||||||
|
sessionId,
|
||||||
|
workspace?.id as string,
|
||||||
|
))
|
||||||
) {
|
) {
|
||||||
const sessionData = TransportManager.getSessionInfo(sessionId);
|
const sessionData = TransportManager.getSessionInfo(sessionId);
|
||||||
|
|
||||||
|
|||||||
@ -3,10 +3,7 @@ import compression from "compression";
|
|||||||
import express from "express";
|
import express from "express";
|
||||||
import morgan from "morgan";
|
import morgan from "morgan";
|
||||||
|
|
||||||
// import {
|
// import { handleMCPRequest, handleSessionRequest } from "~/services/mcp.server";
|
||||||
// handleMCPRequest,
|
|
||||||
// handleSessionRequest,
|
|
||||||
// } from "~/services/mcp.server";
|
|
||||||
// import { authenticateHybridRequest } from "~/services/routeBuilders/apiBuilder.server";
|
// import { authenticateHybridRequest } from "~/services/routeBuilders/apiBuilder.server";
|
||||||
|
|
||||||
let viteDevServer: any;
|
let viteDevServer: any;
|
||||||
@ -65,7 +62,7 @@ async function init() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await module.handleSessionRequest(req, res);
|
await module.handleSessionRequest(req, res, authenticationResult.userId);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post("/api/v1/mcp", async (req, res) => {
|
app.post("/api/v1/mcp", async (req, res) => {
|
||||||
@ -116,7 +113,7 @@ async function init() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await module.handleSessionRequest(req, res);
|
await module.handleSessionRequest(req, res, authenticationResult.userId);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.options("/api/v1/mcp", (_, res) => {
|
app.options("/api/v1/mcp", (_, res) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user