Spaces:
Sleeping
Sleeping
Commit ·
8a51de0
1
Parent(s): e8ca7d1
update
Browse files
backend/src/index.ts
CHANGED
|
@@ -15,9 +15,9 @@ app.get('/api/health', (req, res) => {
|
|
| 15 |
|
| 16 |
// Proxy routes for MCP Agents
|
| 17 |
// These allow Archestra to talk to the agents through the single public port 7860
|
| 18 |
-
app.use('/mcp/analyzer', createProxyMiddleware({ target: 'http://localhost:3002', changeOrigin: true }));
|
| 19 |
-
app.use('/mcp/reader', createProxyMiddleware({ target: 'http://localhost:3003', changeOrigin: true }));
|
| 20 |
-
app.use('/mcp/generator', createProxyMiddleware({ target: 'http://localhost:3004', changeOrigin: true }));
|
| 21 |
|
| 22 |
app.use(express.json());
|
| 23 |
app.use('/api/generate', generateRouter);
|
|
|
|
| 15 |
|
| 16 |
// Proxy routes for MCP Agents
|
| 17 |
// These allow Archestra to talk to the agents through the single public port 7860
|
| 18 |
+
app.use('/mcp/analyzer', createProxyMiddleware({ target: 'http://localhost:3002', pathRewrite: { '^/mcp/analyzer': '' }, changeOrigin: true }));
|
| 19 |
+
app.use('/mcp/reader', createProxyMiddleware({ target: 'http://localhost:3003', pathRewrite: { '^/mcp/reader': '' }, changeOrigin: true }));
|
| 20 |
+
app.use('/mcp/generator', createProxyMiddleware({ target: 'http://localhost:3004', pathRewrite: { '^/mcp/generator': '' }, changeOrigin: true }));
|
| 21 |
|
| 22 |
app.use(express.json());
|
| 23 |
app.use('/api/generate', generateRouter);
|
mcp-servers/code-reader/src/index.mts
CHANGED
|
@@ -212,16 +212,16 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
| 212 |
if (process.env.PORT) {
|
| 213 |
const app = express();
|
| 214 |
app.use(cors());
|
| 215 |
-
|
| 216 |
|
| 217 |
let transport: SSEServerTransport;
|
| 218 |
|
| 219 |
app.get("/sse", async (req, res) => {
|
| 220 |
-
transport = new SSEServerTransport("
|
| 221 |
await server.connect(transport);
|
| 222 |
});
|
| 223 |
|
| 224 |
-
app.post("/
|
| 225 |
if (transport) {
|
| 226 |
await transport.handlePostMessage(req, res);
|
| 227 |
}
|
|
|
|
| 212 |
if (process.env.PORT) {
|
| 213 |
const app = express();
|
| 214 |
app.use(cors());
|
| 215 |
+
// Removed express.json() as it interferes with MCP stream reading
|
| 216 |
|
| 217 |
let transport: SSEServerTransport;
|
| 218 |
|
| 219 |
app.get("/sse", async (req, res) => {
|
| 220 |
+
transport = new SSEServerTransport("messages", res);
|
| 221 |
await server.connect(transport);
|
| 222 |
});
|
| 223 |
|
| 224 |
+
app.post("/messages", async (req, res) => {
|
| 225 |
if (transport) {
|
| 226 |
await transport.handlePostMessage(req, res);
|
| 227 |
}
|
mcp-servers/doc-generator/src/index.mts
CHANGED
|
@@ -179,16 +179,16 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
| 179 |
if (process.env.PORT) {
|
| 180 |
const app = express();
|
| 181 |
app.use(cors());
|
| 182 |
-
|
| 183 |
|
| 184 |
let transport: SSEServerTransport;
|
| 185 |
|
| 186 |
app.get("/sse", async (req, res) => {
|
| 187 |
-
transport = new SSEServerTransport("
|
| 188 |
await server.connect(transport);
|
| 189 |
});
|
| 190 |
|
| 191 |
-
app.post("/
|
| 192 |
if (transport) {
|
| 193 |
await transport.handlePostMessage(req, res);
|
| 194 |
}
|
|
|
|
| 179 |
if (process.env.PORT) {
|
| 180 |
const app = express();
|
| 181 |
app.use(cors());
|
| 182 |
+
// Removed express.json() as it interferes with MCP stream reading
|
| 183 |
|
| 184 |
let transport: SSEServerTransport;
|
| 185 |
|
| 186 |
app.get("/sse", async (req, res) => {
|
| 187 |
+
transport = new SSEServerTransport("messages", res);
|
| 188 |
await server.connect(transport);
|
| 189 |
});
|
| 190 |
|
| 191 |
+
app.post("/messages", async (req, res) => {
|
| 192 |
if (transport) {
|
| 193 |
await transport.handlePostMessage(req, res);
|
| 194 |
}
|
mcp-servers/repo-analyzer/src/index.mts
CHANGED
|
@@ -279,16 +279,17 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
| 279 |
if (process.env.PORT) {
|
| 280 |
const app = express();
|
| 281 |
app.use(cors());
|
| 282 |
-
|
| 283 |
|
| 284 |
let transport: SSEServerTransport;
|
| 285 |
|
| 286 |
app.get("/sse", async (req, res) => {
|
| 287 |
-
|
|
|
|
| 288 |
await server.connect(transport);
|
| 289 |
});
|
| 290 |
|
| 291 |
-
app.post("/
|
| 292 |
if (transport) {
|
| 293 |
await transport.handlePostMessage(req, res);
|
| 294 |
}
|
|
|
|
| 279 |
if (process.env.PORT) {
|
| 280 |
const app = express();
|
| 281 |
app.use(cors());
|
| 282 |
+
// Removed express.json() as it interferes with MCP stream reading
|
| 283 |
|
| 284 |
let transport: SSEServerTransport;
|
| 285 |
|
| 286 |
app.get("/sse", async (req, res) => {
|
| 287 |
+
// Relative path works both with and without proxy
|
| 288 |
+
transport = new SSEServerTransport("messages", res);
|
| 289 |
await server.connect(transport);
|
| 290 |
});
|
| 291 |
|
| 292 |
+
app.post("/messages", async (req, res) => {
|
| 293 |
if (transport) {
|
| 294 |
await transport.handlePostMessage(req, res);
|
| 295 |
}
|