fix: validate MCP v2 routes
This commit is contained in:
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}`);
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in new issue
Block a user