Compare commits

...

2 Commits

Author SHA1 Message Date
Krishna Kumar
66cf3e851e chore: change default model to openai/gpt-4o-mini
Some checks failed
CI/CD Pipeline / build (push) Has been cancelled
CI/CD Pipeline / publish-npm (push) Has been cancelled
CI/CD Pipeline / docker (push) Has been cancelled
2025-12-31 15:06:53 -06:00
Krishna Kumar
15127c3cbd fix: pass req.body to handleRequest for proper MCP protocol handling
Some checks failed
CI/CD Pipeline / build (push) Has been cancelled
CI/CD Pipeline / publish-npm (push) Has been cancelled
CI/CD Pipeline / docker (push) Has been cancelled
The StreamableHTTPServerTransport.handleRequest() method requires the parsed
body as the third argument for POST requests. This was causing "Parse error:
Invalid JSON" responses for all MCP requests.
2025-12-31 13:43:31 -06:00

View File

@@ -11,7 +11,7 @@ import express, { Request, Response } from 'express';
import { ToolHandlers } from './tool-handlers.js';
// Define the default model to use when none is specified
const DEFAULT_MODEL = 'qwen/qwen2.5-vl-32b-instruct:free';
const DEFAULT_MODEL = 'openai/gpt-4o-mini';
interface ServerOptions {
apiKey?: string;
@@ -110,9 +110,9 @@ class OpenRouterMultimodalServer {
return;
}
// Let the transport handle the SSE stream
// Let the transport handle the SSE stream (no body for GET)
const transport = transports[sessionId];
await transport.handleRequest(req, res);
await transport.handleRequest(req, res, undefined);
return;
}
@@ -174,9 +174,9 @@ class OpenRouterMultimodalServer {
transport = transports[sessionId];
}
// Handle the request
// Handle the request - pass body for POST, omit for GET/DELETE
try {
await transport.handleRequest(req, res);
await transport.handleRequest(req, res, req.body);
} catch (error) {
console.error('[MCP] Request handling error:', error);
if (!res.headersSent) {