Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +1 -49
Dockerfile
CHANGED
|
@@ -29,55 +29,7 @@ WORKDIR /app
|
|
| 29 |
RUN git config --global --add safe.directory /app
|
| 30 |
|
| 31 |
# Clone, install, build mcphub
|
| 32 |
-
RUN git clone https://github.com/
|
| 33 |
-
|
| 34 |
-
# ⭐ [PATCH 1/2] Apply the modification to make OpenAPI endpoints public (CORRECTED)
|
| 35 |
-
RUN sed -i "s|if (req.path === '/auth/login')|if (req.path === '/auth/login' \\|\\| req.path.startsWith('/openapi') \\|\\| req.path.startsWith('/tools/'))|g" src/middlewares/index.ts
|
| 36 |
-
|
| 37 |
-
# ⭐ [PATCH 2/2] Fix the Streamable HTTP session initialization logic (FINAL & PRECISE)
|
| 38 |
-
RUN sed -i '/let transport: StreamableHTTPServerTransport;/,/requestContextService.clearRequestContext();/c\
|
| 39 |
-
const requestContextService = RequestContextService.getInstance();\
|
| 40 |
-
requestContextService.setRequestContext(req);\
|
| 41 |
-
\
|
| 42 |
-
try {\
|
| 43 |
-
if (sessionId && transports[sessionId]) {\
|
| 44 |
-
console.log(`Reusing existing transport for sessionId: \${sessionId}`);\
|
| 45 |
-
const transport = transports[sessionId].transport as StreamableHTTPServerTransport;\
|
| 46 |
-
await transport.handleRequest(req, res, req.body);\
|
| 47 |
-
} else if (!sessionId && isInitializeRequest(req.body)) {\
|
| 48 |
-
const transport = new StreamableHTTPServerTransport({\
|
| 49 |
-
sessionIdGenerator: () => randomUUID(),\
|
| 50 |
-
onsessioninitialized: (newSessionId) => {\
|
| 51 |
-
console.log(`MCP session initialized: \${newSessionId} for group: \${group}`);\
|
| 52 |
-
transports[newSessionId] = { transport, group: group };\
|
| 53 |
-
const mcpServer = getMcpServer(newSessionId, group);\
|
| 54 |
-
mcpServer.connect(transport);\
|
| 55 |
-
},\
|
| 56 |
-
});\
|
| 57 |
-
\
|
| 58 |
-
transport.onclose = () => {\
|
| 59 |
-
if (transport.sessionId) {\
|
| 60 |
-
console.log(`Transport closed: \${transport.sessionId}`);\
|
| 61 |
-
delete transports[transport.sessionId];\
|
| 62 |
-
deleteMcpServer(transport.sessionId);\
|
| 63 |
-
}\
|
| 64 |
-
};\
|
| 65 |
-
\
|
| 66 |
-
await transport.handleRequest(req, res, req.body);\
|
| 67 |
-
} else {\
|
| 68 |
-
res.status(400).json({\
|
| 69 |
-
jsonrpc: '2.0',\
|
| 70 |
-
error: {\
|
| 71 |
-
code: -32000,\
|
| 72 |
-
message: 'Bad Request: No valid session ID provided',\
|
| 73 |
-
},\
|
| 74 |
-
id: null,\
|
| 75 |
-
});\
|
| 76 |
-
}\
|
| 77 |
-
} finally {\
|
| 78 |
-
requestContextService.clearRequestContext();\
|
| 79 |
-
}\
|
| 80 |
-
' src/services/sseService.ts
|
| 81 |
|
| 82 |
RUN pnpm install
|
| 83 |
RUN npm run build
|
|
|
|
| 29 |
RUN git config --global --add safe.directory /app
|
| 30 |
|
| 31 |
# Clone, install, build mcphub
|
| 32 |
+
RUN git clone https://github.com/parasshah10/mcphub.git .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
RUN pnpm install
|
| 35 |
RUN npm run build
|