fastmcp 4.24.4 → 4.25.0
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/dist/FastMCP.cjs +3 -3
- package/dist/FastMCP.d.cts +2 -2
- package/dist/FastMCP.d.ts +2 -2
- package/dist/FastMCP.js +2 -2
- package/dist/{OAuthProvider-84BWWDBF.d.cts → OAuthProvider-BGtNEdC3.d.cts} +14 -0
- package/dist/{OAuthProvider-84BWWDBF.d.ts → OAuthProvider-BGtNEdC3.d.ts} +14 -0
- package/dist/auth/index.cjs +2 -2
- package/dist/auth/index.d.cts +2 -2
- package/dist/auth/index.d.ts +2 -2
- package/dist/auth/index.js +1 -1
- package/dist/bin/fastmcp.cjs +1 -0
- package/dist/bin/fastmcp.cjs.map +1 -1
- package/dist/bin/fastmcp.js +1 -0
- package/dist/bin/fastmcp.js.map +1 -1
- package/dist/{chunk-XPGMRMMN.cjs → chunk-AJE7ERFM.cjs} +14 -9
- package/dist/chunk-AJE7ERFM.cjs.map +1 -0
- package/dist/{chunk-BV4PWTT6.cjs → chunk-B7IXBMHV.cjs} +32 -1
- package/dist/chunk-B7IXBMHV.cjs.map +1 -0
- package/dist/{chunk-CAQLTSJ5.js → chunk-JFHOYU3S.js} +32 -1
- package/dist/chunk-JFHOYU3S.js.map +1 -0
- package/dist/{chunk-D2CVYAA5.js → chunk-PU3JOW7T.js} +11 -6
- package/dist/chunk-PU3JOW7T.js.map +1 -0
- package/dist/edge/index.cjs +18 -10
- package/dist/edge/index.cjs.map +1 -1
- package/dist/edge/index.js +18 -10
- package/dist/edge/index.js.map +1 -1
- package/dist/examples/custom-routes.cjs +3 -3
- package/dist/examples/custom-routes.js +2 -2
- package/dist/openapi/index.cjs +667 -556
- package/dist/openapi/index.cjs.map +1 -1
- package/dist/openapi/index.d.cts +8 -3
- package/dist/openapi/index.d.ts +8 -3
- package/dist/openapi/index.js +648 -537
- package/dist/openapi/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-BV4PWTT6.cjs.map +0 -1
- package/dist/chunk-CAQLTSJ5.js.map +0 -1
- package/dist/chunk-D2CVYAA5.js.map +0 -1
- package/dist/chunk-XPGMRMMN.cjs.map +0 -1
|
@@ -2451,6 +2451,10 @@ var OAuthProxy = class {
|
|
|
2451
2451
|
if (contentType.includes("application/x-www-form-urlencoded")) {
|
|
2452
2452
|
const text = await response.text();
|
|
2453
2453
|
const params = new URLSearchParams(text);
|
|
2454
|
+
this.rejectUpstreamError({
|
|
2455
|
+
error: params.get("error"),
|
|
2456
|
+
error_description: params.get("error_description")
|
|
2457
|
+
});
|
|
2454
2458
|
const rawData = {
|
|
2455
2459
|
access_token: params.get("access_token") || "",
|
|
2456
2460
|
expires_in: params.get("expires_in") ? parseInt(params.get("expires_in")) : void 0,
|
|
@@ -2463,6 +2467,7 @@ var OAuthProxy = class {
|
|
|
2463
2467
|
return tokenResponseSchema.parse(rawData);
|
|
2464
2468
|
}
|
|
2465
2469
|
const rawJson = await response.json();
|
|
2470
|
+
this.rejectUpstreamError(rawJson);
|
|
2466
2471
|
return tokenResponseSchema.parse(rawJson);
|
|
2467
2472
|
}
|
|
2468
2473
|
/**
|
|
@@ -2556,6 +2561,32 @@ var OAuthProxy = class {
|
|
|
2556
2561
|
tokenType: tokens.token_type || "Bearer"
|
|
2557
2562
|
};
|
|
2558
2563
|
}
|
|
2564
|
+
/**
|
|
2565
|
+
* RFC 6749 §5.2: a provider refuses a token request by naming the error in
|
|
2566
|
+
* the response body. The status that carries it is not fixed — GitHub, whose
|
|
2567
|
+
* own branch exists above, answers every refusal with 200 — so a refusal is
|
|
2568
|
+
* recognised here, from the body, rather than left to fail the token schema
|
|
2569
|
+
* parse. Without this the upstream's own diagnosis (`bad_verification_code`,
|
|
2570
|
+
* `invalid_grant`, …) is replaced by a `ZodError`, which the routes answer as
|
|
2571
|
+
* `server_error` (callback) or `invalid_request` (token).
|
|
2572
|
+
*
|
|
2573
|
+
* The upstream's code is kept as the `OAuthProxyError` code, and its
|
|
2574
|
+
* description when it sent one, so the client is told what the provider
|
|
2575
|
+
* actually refused.
|
|
2576
|
+
*/
|
|
2577
|
+
rejectUpstreamError(payload) {
|
|
2578
|
+
if (!payload || typeof payload !== "object") {
|
|
2579
|
+
return;
|
|
2580
|
+
}
|
|
2581
|
+
const { error, error_description } = payload;
|
|
2582
|
+
if (typeof error !== "string" || error === "") {
|
|
2583
|
+
return;
|
|
2584
|
+
}
|
|
2585
|
+
throw new OAuthProxyError(
|
|
2586
|
+
error,
|
|
2587
|
+
typeof error_description === "string" ? error_description : void 0
|
|
2588
|
+
);
|
|
2589
|
+
}
|
|
2559
2590
|
/**
|
|
2560
2591
|
* Resolve the client behind a `client_id`: a stored registration if there is
|
|
2561
2592
|
* one, otherwise — when CIMD is enabled — the client's metadata document.
|
|
@@ -3324,4 +3355,4 @@ export {
|
|
|
3324
3355
|
DiskStore,
|
|
3325
3356
|
JWKSVerifier
|
|
3326
3357
|
};
|
|
3327
|
-
//# sourceMappingURL=chunk-
|
|
3358
|
+
//# sourceMappingURL=chunk-JFHOYU3S.js.map
|