Skip to content

Commit f15d414

Browse files
committed
Redirect root
1 parent 0320a7a commit f15d414

File tree

3 files changed

+4
-29
lines changed

3 files changed

+4
-29
lines changed

netlify.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
11
[build]
22
publish = "public"
3-
4-
[[redirects]]
5-
from = "/"
6-
to = "https://docs.astro.build/en/reference/mcp-server/"

netlify/edge-functions/mcp-server.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
22
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
33
import { toFetchResponse, toReqRes } from "fetch-to-node";
44
import z from "zod";
5-
import type { Config } from "@netlify/edge-functions";
5+
import type { Config, Context } from "@netlify/edge-functions";
66

77
const apiKey = Netlify.env.get("KAPA_API_KEY");
88
const projectId = Netlify.env.get("KAPA_PROJECT_ID");
@@ -95,8 +95,8 @@ function formatResponse(data: unknown): {
9595
}
9696

9797
// Netlify Edge Function Handler
98-
export default async function handler(req: Request) {
99-
if (req.method !== "POST") {
98+
export default async function handler(req: Request, { url }: Context) {
99+
if (req.method !== "POST" || url.pathname !== "/mcp") {
100100
return Response.redirect(
101101
"https://docs.astro.build/en/reference/mcp-server/",
102102
302
@@ -134,6 +134,6 @@ export default async function handler(req: Request) {
134134
}
135135

136136
export const config: Config = {
137-
path: "/mcp",
137+
path: ["/", "/mcp"],
138138
method: ["POST", "GET"],
139139
};

public/index.html

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)