keryx 0.35.0 → 0.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/initializers/mcp.ts +4 -1
- package/initializers/oauth.ts +16 -4
- package/package.json +1 -1
package/initializers/mcp.ts
CHANGED
|
@@ -152,8 +152,11 @@ export class McpInitializer extends Initializer {
|
|
|
152
152
|
requestOrigin,
|
|
153
153
|
{
|
|
154
154
|
"Access-Control-Allow-Methods": "GET, POST, DELETE, OPTIONS",
|
|
155
|
+
// MCP-Protocol-Version is sent by clients on every request after
|
|
156
|
+
// initialize (spec 2025-06-18+). Browser connectors preflight it, so
|
|
157
|
+
// it must be allow-listed or those requests are silently blocked.
|
|
155
158
|
"Access-Control-Allow-Headers":
|
|
156
|
-
"Content-Type, mcp-session-id, Authorization",
|
|
159
|
+
"Content-Type, mcp-session-id, mcp-protocol-version, Authorization",
|
|
157
160
|
"Access-Control-Expose-Headers": "mcp-session-id",
|
|
158
161
|
},
|
|
159
162
|
mcpAllowedOrigins,
|
package/initializers/oauth.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
appendHeaders,
|
|
7
7
|
buildCorsHeaders,
|
|
8
8
|
getExternalOrigin,
|
|
9
|
+
getMcpAllowedOrigins,
|
|
9
10
|
} from "../util/http";
|
|
10
11
|
import {
|
|
11
12
|
handleAuthorizeGet,
|
|
@@ -60,10 +61,21 @@ export class OAuthInitializer extends Initializer {
|
|
|
60
61
|
const method = req.method.toUpperCase();
|
|
61
62
|
const origin = getExternalOrigin(req, url);
|
|
62
63
|
const requestOrigin = req.headers.get("origin") ?? undefined;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
// OAuth discovery, dynamic client registration, and token exchange are
|
|
65
|
+
// performed as browser fetches by browser-based MCP connectors (e.g.
|
|
66
|
+
// claude.ai). Reflect Access-Control-Allow-Origin for the same connector
|
|
67
|
+
// origins the MCP endpoint admits, or the browser blocks the responses
|
|
68
|
+
// (the requests still return 2xx, so nothing errors server-side) and the
|
|
69
|
+
// connector silently fails to complete. These endpoints are public by
|
|
70
|
+
// design — protected by PKCE and registration, not by Origin.
|
|
71
|
+
const corsHeaders = buildCorsHeaders(
|
|
72
|
+
requestOrigin,
|
|
73
|
+
{
|
|
74
|
+
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
|
|
75
|
+
"Access-Control-Allow-Headers": "Content-Type, Authorization",
|
|
76
|
+
},
|
|
77
|
+
getMcpAllowedOrigins(),
|
|
78
|
+
);
|
|
67
79
|
|
|
68
80
|
// Handle CORS preflight for OAuth endpoints
|
|
69
81
|
if (
|