Change: just require auth for MCP

This commit is contained in:
shamoon
2026-07-13 09:53:41 -07:00
parent 126d4ac341
commit 8a2d6647d2
5 changed files with 29 additions and 20 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
import { getServerSession } from "next-auth/next";
import { authOptions } from "pages/api/auth/[...nextauth]";
import { handleMcpRequest, mcpAuthorized, mcpEnabled } from "utils/mcp/homepage-mcp";
import { handleMcpRequest, mcpEnabled, mcpTokenAuthorized } from "utils/mcp/homepage-mcp";
async function hasHomepageSession(req, res) {
if (!process.env.HOMEPAGE_AUTH_ENABLED) return false;
@@ -13,7 +13,7 @@ export default async function handler(req, res) {
return res.status(404).end("Not Found");
}
if (!mcpAuthorized(req) && !(await hasHomepageSession(req, res))) {
if (!mcpTokenAuthorized(req) && !(await hasHomepageSession(req, res))) {
return res.status(401).json({ error: "Unauthorized" });
}