fastmcp 4.28.2 → 4.28.4
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 +4 -4
- package/dist/FastMCP.d.cts +2 -2
- package/dist/FastMCP.d.ts +2 -2
- package/dist/FastMCP.js +3 -3
- package/dist/{OAuthProvider-DvIxa9N1.d.cts → OAuthProvider-C2Z93xC5.d.cts} +3 -1
- package/dist/{OAuthProvider-DvIxa9N1.d.ts → OAuthProvider-C2Z93xC5.d.ts} +3 -1
- 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 +0 -1
- package/dist/bin/fastmcp.cjs.map +1 -1
- package/dist/bin/fastmcp.js +0 -1
- package/dist/bin/fastmcp.js.map +1 -1
- package/dist/{chunk-HZJE6ZGH.cjs → chunk-7IQ5QHVZ.cjs} +39 -19
- package/dist/chunk-7IQ5QHVZ.cjs.map +1 -0
- package/dist/{chunk-AM3HVK4Z.js → chunk-B2QUCZGV.js} +42 -18
- package/dist/chunk-B2QUCZGV.js.map +1 -0
- package/dist/{chunk-GW5MENCI.cjs → chunk-DPJW5QEO.cjs} +34 -13
- package/dist/chunk-DPJW5QEO.cjs.map +1 -0
- package/dist/{chunk-2NZFMD6I.cjs → chunk-OCCYKYIM.cjs} +42 -18
- package/dist/chunk-OCCYKYIM.cjs.map +1 -0
- package/dist/{chunk-MBIVAKUB.js → chunk-Q57EM4LH.js} +28 -7
- package/dist/chunk-Q57EM4LH.js.map +1 -0
- package/dist/{chunk-76OY4FEK.js → chunk-UFPH23EN.js} +35 -15
- package/dist/chunk-UFPH23EN.js.map +1 -0
- package/dist/edge/index.cjs +19 -8
- package/dist/edge/index.cjs.map +1 -1
- package/dist/edge/index.js +17 -6
- package/dist/edge/index.js.map +1 -1
- package/dist/examples/custom-routes.cjs +4 -4
- package/dist/examples/custom-routes.js +3 -3
- package/dist/openapi/index.cjs +23 -12
- package/dist/openapi/index.cjs.map +1 -1
- package/dist/openapi/index.d.cts +1 -1
- package/dist/openapi/index.d.ts +1 -1
- package/dist/openapi/index.js +17 -6
- package/dist/openapi/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2NZFMD6I.cjs.map +0 -1
- package/dist/chunk-76OY4FEK.js.map +0 -1
- package/dist/chunk-AM3HVK4Z.js.map +0 -1
- package/dist/chunk-GW5MENCI.cjs.map +0 -1
- package/dist/chunk-HZJE6ZGH.cjs.map +0 -1
- package/dist/chunk-MBIVAKUB.js.map +0 -1
|
@@ -2108,7 +2108,7 @@ var OAuthProxy = class {
|
|
|
2108
2108
|
let errorCode = "server_error";
|
|
2109
2109
|
let errorDescription;
|
|
2110
2110
|
try {
|
|
2111
|
-
const error = await
|
|
2111
|
+
const error = await this.parseTokenResponseBody(tokenResponse);
|
|
2112
2112
|
errorCode = error.error || "server_error";
|
|
2113
2113
|
errorDescription = error.error_description;
|
|
2114
2114
|
} catch {
|
|
@@ -2299,7 +2299,7 @@ var OAuthProxy = class {
|
|
|
2299
2299
|
let errorCode = "invalid_grant";
|
|
2300
2300
|
let errorDescription;
|
|
2301
2301
|
try {
|
|
2302
|
-
const error = await
|
|
2302
|
+
const error = await this.parseTokenResponseBody(tokenResponse);
|
|
2303
2303
|
errorCode = error.error || "invalid_grant";
|
|
2304
2304
|
errorDescription = error.error_description;
|
|
2305
2305
|
} catch {
|
|
@@ -2639,7 +2639,6 @@ var OAuthProxy = class {
|
|
|
2639
2639
|
* GitHub Apps return URL-encoded format, most providers return JSON
|
|
2640
2640
|
*/
|
|
2641
2641
|
async parseTokenResponse(response) {
|
|
2642
|
-
const contentType = (response.headers.get("content-type") || "").toLowerCase();
|
|
2643
2642
|
const tokenResponseSchema = z2.object({
|
|
2644
2643
|
access_token: z2.string().min(1, "access_token cannot be empty"),
|
|
2645
2644
|
expires_in: z2.coerce.number().int().positive().optional(),
|
|
@@ -2653,13 +2652,9 @@ var OAuthProxy = class {
|
|
|
2653
2652
|
).optional(),
|
|
2654
2653
|
token_type: z2.string().optional()
|
|
2655
2654
|
});
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
const params =
|
|
2659
|
-
this.rejectUpstreamError({
|
|
2660
|
-
error: params.get("error"),
|
|
2661
|
-
error_description: params.get("error_description")
|
|
2662
|
-
});
|
|
2655
|
+
const payload = await this.parseTokenResponseBody(response);
|
|
2656
|
+
if (payload instanceof URLSearchParams) {
|
|
2657
|
+
const params = payload;
|
|
2663
2658
|
const rawData = {
|
|
2664
2659
|
access_token: params.get("access_token") || "",
|
|
2665
2660
|
expires_in: params.get("expires_in") ? parseInt(params.get("expires_in")) : void 0,
|
|
@@ -2671,9 +2666,31 @@ var OAuthProxy = class {
|
|
|
2671
2666
|
};
|
|
2672
2667
|
return tokenResponseSchema.parse(rawData);
|
|
2673
2668
|
}
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2669
|
+
this.rejectUpstreamError(payload);
|
|
2670
|
+
return tokenResponseSchema.parse(payload);
|
|
2671
|
+
}
|
|
2672
|
+
async parseTokenResponseBody(response) {
|
|
2673
|
+
const type = response.headers.get("content-type")?.toLowerCase() ?? "";
|
|
2674
|
+
const formType = "application/x-www-form-urlencoded";
|
|
2675
|
+
const isForm = response.ok ? type.includes(formType) : withoutOptionalWhitespace(type.split(";", 1)[0]) === formType;
|
|
2676
|
+
if (!isForm) return response.json();
|
|
2677
|
+
const text = await response.text();
|
|
2678
|
+
const params = new URLSearchParams(text);
|
|
2679
|
+
const error = params.get("error");
|
|
2680
|
+
if (!response.ok) {
|
|
2681
|
+
try {
|
|
2682
|
+
return JSON.parse(text);
|
|
2683
|
+
} catch (cause) {
|
|
2684
|
+
if (!error) throw cause;
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2687
|
+
if (error) {
|
|
2688
|
+
return {
|
|
2689
|
+
error,
|
|
2690
|
+
error_description: params.get("error_description") ?? void 0
|
|
2691
|
+
};
|
|
2692
|
+
}
|
|
2693
|
+
return params;
|
|
2677
2694
|
}
|
|
2678
2695
|
/**
|
|
2679
2696
|
* Storage key for the client binding of a passthrough-mode upstream refresh
|
|
@@ -2760,7 +2777,7 @@ var OAuthProxy = class {
|
|
|
2760
2777
|
let errorCode = "invalid_grant";
|
|
2761
2778
|
let errorDescription = "Upstream refresh failed";
|
|
2762
2779
|
try {
|
|
2763
|
-
const error = await
|
|
2780
|
+
const error = await this.parseTokenResponseBody(tokenResponse);
|
|
2764
2781
|
errorCode = error.error || "invalid_grant";
|
|
2765
2782
|
errorDescription = error.error_description || "Upstream refresh failed";
|
|
2766
2783
|
} catch {
|
|
@@ -2919,6 +2936,9 @@ var OAuthProxy = class {
|
|
|
2919
2936
|
if (parsed.username !== "" || parsed.password !== "") {
|
|
2920
2937
|
return false;
|
|
2921
2938
|
}
|
|
2939
|
+
if (parsed.href.includes("#")) {
|
|
2940
|
+
return false;
|
|
2941
|
+
}
|
|
2922
2942
|
const patterns = this.config.allowedRedirectUriPatterns;
|
|
2923
2943
|
if (Array.isArray(patterns) && patterns.length === 0) {
|
|
2924
2944
|
return false;
|
|
@@ -3614,4 +3634,4 @@ export {
|
|
|
3614
3634
|
DiskStore,
|
|
3615
3635
|
JWKSVerifier
|
|
3616
3636
|
};
|
|
3617
|
-
//# sourceMappingURL=chunk-
|
|
3637
|
+
//# sourceMappingURL=chunk-UFPH23EN.js.map
|