mirror of
https://github.com/koala73/worldmonitor.git
synced 2026-04-25 17:14:57 +02:00
feat(mcp): expose /mcp as clean public endpoint (#2411)
Adds a /mcp rewrite in vercel.json pointing to /api/mcp, so MCP clients (Claude Desktop, etc.) can connect to https://api.worldmonitor.app/mcp instead of /api/mcp. Benefits: cleaner URL for docs/config, CF bot-blocking rules target /api/* only so /mcp bypasses them without needing extra CF rule exceptions. Also adds CORS headers for /mcp and excludes it from the SPA rewrite and no-cache catch-all patterns. Updates deploy-config test to match new pattern.
This commit is contained in:
13
vercel.json
13
vercel.json
@@ -7,7 +7,8 @@
|
||||
"rewrites": [
|
||||
{ "source": "/docs/:match*", "destination": "https://worldmonitor.mintlify.dev/docs/:match*" },
|
||||
{ "source": "/pro", "destination": "/pro/index.html" },
|
||||
{ "source": "/((?!api|assets|blog|docs|favico|map-styles|data|textures|pro|sw\\.js|workbox-[a-f0-9]+\\.js|manifest\\.webmanifest|offline\\.html|robots\\.txt|sitemap\\.xml|llms\\.txt|llms-full\\.txt|\\.well-known|wm-widget-sandbox\\.html).*)", "destination": "/index.html" }
|
||||
{ "source": "/mcp", "destination": "/api/mcp" },
|
||||
{ "source": "/((?!api|mcp|assets|blog|docs|favico|map-styles|data|textures|pro|sw\\.js|workbox-[a-f0-9]+\\.js|manifest\\.webmanifest|offline\\.html|robots\\.txt|sitemap\\.xml|llms\\.txt|llms-full\\.txt|\\.well-known|wm-widget-sandbox\\.html).*)", "destination": "/index.html" }
|
||||
],
|
||||
"headers": [
|
||||
{
|
||||
@@ -18,6 +19,14 @@
|
||||
{ "key": "Access-Control-Allow-Headers", "value": "Content-Type, Authorization, X-WorldMonitor-Key, X-Widget-Key, X-Pro-Key" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"source": "/mcp",
|
||||
"headers": [
|
||||
{ "key": "Access-Control-Allow-Origin", "value": "*" },
|
||||
{ "key": "Access-Control-Allow-Methods", "value": "GET, POST, OPTIONS" },
|
||||
{ "key": "Access-Control-Allow-Headers", "value": "Content-Type, Authorization, X-WorldMonitor-Key" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"source": "/docs/:path*",
|
||||
"headers": [
|
||||
@@ -50,7 +59,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"source": "/((?!api|assets|blog|docs|favico|map-styles|data|textures|pro|sw\\.js|workbox-[a-f0-9]+\\.js|manifest\\.webmanifest|offline\\.html|robots\\.txt|sitemap\\.xml|llms\\.txt|llms-full\\.txt|\\.well-known|wm-widget-sandbox\\.html).*)",
|
||||
"source": "/((?!api|mcp|assets|blog|docs|favico|map-styles|data|textures|pro|sw\\.js|workbox-[a-f0-9]+\\.js|manifest\\.webmanifest|offline\\.html|robots\\.txt|sitemap\\.xml|llms\\.txt|llms-full\\.txt|\\.well-known|wm-widget-sandbox\\.html).*)",
|
||||
"headers": [
|
||||
{ "key": "Cache-Control", "value": "no-cache, no-store, must-revalidate" }
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user