fix: validate MCP v2 routes

This commit is contained in:
Thomas Camlong authored and ajnart committed 2026-08-14 11:32:10 +02:00
1 parent ae68d599be
commit 3cef3cbdbd
2 files changed
+3 -2

No files matched your search

@@ -101,7 +101,7 @@ async function callMcp(method: string, params: Record<string, unknown> = {}, id
const data = response.headers.get("content-type")?.includes("text/event-stream")
? text
.split("\n")
.find((line) => line.startsWith("data: "))
.find((line: string) => line.startsWith("data: "))
?.slice("data: ".length)
: text;
if (!data) throw new Error(`MCP response did not contain JSON-RPC data: ${text}`);
+2 -1
View File
@@ -1,6 +1,7 @@
import type { NextRequest } from "next/server";
import { userAgent } from "next/server";
import { ResourceTemplate, type McpServer } from "@modelcontextprotocol/server";
import type { McpServer } from "@modelcontextprotocol/server";
import { ResourceTemplate } from "@modelcontextprotocol/server";
import { z } from "zod/v4";
import type { McpTool } from "@homarr/api/mcp";