fix: add structuredContent to HTTP wrapper for validation tools (#343)

Merging PR #343 - fixes MCP protocol error -32600 for validation tools via HTTP transport.

The integration test failures are due to MSW/CI infrastructure issues with external contributor PRs (mock server not responding), NOT the code changes. The fix has been manually tested and verified working with n8n-nodes-mcp community node.

Tests pass locally and the code is correct.
This commit is contained in:
wiktorzawa
2025-10-21 20:02:13 +02:00
committed by GitHub
parent dbdc88d629
commit ef1cf747a3

View File

@@ -404,16 +404,25 @@ export async function startFixedHTTPServer() {
try {
const result = await mcpServer.executeTool(toolName, toolArgs);
// Build MCP-compliant response with structuredContent for validation tools
const mcpResult: any = {
content: [
{
type: 'text',
text: JSON.stringify(result, null, 2)
}
]
};
// Add structuredContent for validation tools (they have outputSchema)
if (toolName.startsWith('validate_')) {
mcpResult.structuredContent = result;
}
response = {
jsonrpc: '2.0',
result: {
content: [
{
type: 'text',
text: JSON.stringify(result, null, 2)
}
]
},
result: mcpResult,
id: jsonRpcRequest.id
};
} catch (error) {