fastmcp 3.35.0 → 4.0.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/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-R8buLRa8.d.cts → OAuthProvider-BV6EpF_k.d.cts} +38 -3
- package/dist/{OAuthProvider-R8buLRa8.d.ts → OAuthProvider-BV6EpF_k.d.ts} +38 -3
- 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/{chunk-JP7QSER3.cjs → chunk-EXZZ3NKL.cjs} +102 -89
- package/dist/chunk-EXZZ3NKL.cjs.map +1 -0
- package/dist/{chunk-7UDY4VFQ.cjs → chunk-SSVFQCSN.cjs} +99 -46
- package/dist/chunk-SSVFQCSN.cjs.map +1 -0
- package/dist/{chunk-UVX47AE5.js → chunk-TNX4H4LB.js} +102 -89
- package/dist/{chunk-UVX47AE5.js.map → chunk-TNX4H4LB.js.map} +1 -1
- package/dist/{chunk-H4VC4YTC.js → chunk-UN72PIH2.js} +96 -43
- package/dist/chunk-UN72PIH2.js.map +1 -0
- package/dist/examples/custom-routes.cjs +3 -3
- package/dist/examples/custom-routes.js +2 -2
- package/package.json +2 -2
- package/dist/chunk-7UDY4VFQ.cjs.map +0 -1
- package/dist/chunk-H4VC4YTC.js.map +0 -1
- package/dist/chunk-JP7QSER3.cjs.map +0 -1
package/dist/FastMCP.cjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkEXZZ3NKLcjs = require('./chunk-EXZZ3NKL.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -20,7 +20,7 @@ var _chunkJP7QSER3cjs = require('./chunk-JP7QSER3.cjs');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _chunkSSVFQCSNcjs = require('./chunk-SSVFQCSN.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
@@ -41,5 +41,5 @@ var _chunk7UDY4VFQcjs = require('./chunk-7UDY4VFQ.cjs');
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
exports.AuthProvider =
|
|
44
|
+
exports.AuthProvider = _chunkSSVFQCSNcjs.AuthProvider; exports.AzureProvider = _chunkSSVFQCSNcjs.AzureProvider; exports.DiscoveryDocumentCache = _chunkEXZZ3NKLcjs.DiscoveryDocumentCache; exports.FastMCP = _chunkEXZZ3NKLcjs.FastMCP; exports.FastMCPSession = _chunkEXZZ3NKLcjs.FastMCPSession; exports.GitHubProvider = _chunkSSVFQCSNcjs.GitHubProvider; exports.GoogleProvider = _chunkSSVFQCSNcjs.GoogleProvider; exports.OAuthProvider = _chunkSSVFQCSNcjs.OAuthProvider; exports.ServerState = _chunkEXZZ3NKLcjs.ServerState; exports.UnexpectedStateError = _chunkEXZZ3NKLcjs.UnexpectedStateError; exports.UserError = _chunkEXZZ3NKLcjs.UserError; exports.audioContent = _chunkEXZZ3NKLcjs.audioContent; exports.getAuthSession = _chunkSSVFQCSNcjs.getAuthSession; exports.imageContent = _chunkEXZZ3NKLcjs.imageContent; exports.requireAll = _chunkSSVFQCSNcjs.requireAll; exports.requireAny = _chunkSSVFQCSNcjs.requireAny; exports.requireAuth = _chunkSSVFQCSNcjs.requireAuth; exports.requireRole = _chunkSSVFQCSNcjs.requireRole; exports.requireScopes = _chunkSSVFQCSNcjs.requireScopes;
|
|
45
45
|
//# sourceMappingURL=FastMCP.cjs.map
|
package/dist/FastMCP.d.cts
CHANGED
|
@@ -10,8 +10,8 @@ import { Hono } from 'hono';
|
|
|
10
10
|
import http from 'http';
|
|
11
11
|
import { StrictEventEmitter } from 'strict-event-emitter-types';
|
|
12
12
|
import { z } from 'zod';
|
|
13
|
-
import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-
|
|
14
|
-
export { j as AuthProviderConfig, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, d as OAuthProvider, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from './OAuthProvider-
|
|
13
|
+
import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-BV6EpF_k.cjs';
|
|
14
|
+
export { j as AuthProviderConfig, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, d as OAuthProvider, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from './OAuthProvider-BV6EpF_k.cjs';
|
|
15
15
|
import 'node:http';
|
|
16
16
|
|
|
17
17
|
declare class DiscoveryDocumentCache {
|
package/dist/FastMCP.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ import { Hono } from 'hono';
|
|
|
10
10
|
import http from 'http';
|
|
11
11
|
import { StrictEventEmitter } from 'strict-event-emitter-types';
|
|
12
12
|
import { z } from 'zod';
|
|
13
|
-
import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-
|
|
14
|
-
export { j as AuthProviderConfig, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, d as OAuthProvider, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from './OAuthProvider-
|
|
13
|
+
import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-BV6EpF_k.js';
|
|
14
|
+
export { j as AuthProviderConfig, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, d as OAuthProvider, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from './OAuthProvider-BV6EpF_k.js';
|
|
15
15
|
import 'node:http';
|
|
16
16
|
|
|
17
17
|
declare class DiscoveryDocumentCache {
|
package/dist/FastMCP.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
UserError,
|
|
8
8
|
audioContent,
|
|
9
9
|
imageContent
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-TNX4H4LB.js";
|
|
11
11
|
import {
|
|
12
12
|
AuthProvider,
|
|
13
13
|
AzureProvider,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
requireAuth,
|
|
21
21
|
requireRole,
|
|
22
22
|
requireScopes
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-UN72PIH2.js";
|
|
24
24
|
export {
|
|
25
25
|
AuthProvider,
|
|
26
26
|
AzureProvider,
|
|
@@ -185,7 +185,23 @@ interface OAuthProviderConfig {
|
|
|
185
185
|
interface OAuthProxyConfig {
|
|
186
186
|
/** Access token TTL in seconds (default: 3600) */
|
|
187
187
|
accessTokenTtl?: number;
|
|
188
|
-
/**
|
|
188
|
+
/**
|
|
189
|
+
* Allow-list of redirect URI patterns accepted by Dynamic Client Registration.
|
|
190
|
+
*
|
|
191
|
+
* A client calling POST /oauth/register must present a `redirect_uri` that
|
|
192
|
+
* matches one of these patterns (exact string or glob with `*` / `?`);
|
|
193
|
+
* otherwise the registration is rejected with `invalid_redirect_uri`. Once
|
|
194
|
+
* registered, the same exact URI must be echoed back at /oauth/authorize —
|
|
195
|
+
* the proxy performs exact string comparison per RFC 6749 §3.1.2.3.
|
|
196
|
+
*
|
|
197
|
+
* Default: `[]` (DCR rejects everything — explicit opt-in required).
|
|
198
|
+
*
|
|
199
|
+
* Prior versions defaulted to `["https://*", "http://localhost:*"]` with an
|
|
200
|
+
* implicit fallback that allowed any https URL. This enabled CWE-601
|
|
201
|
+
* open-redirect / authorization-code theft: an attacker could DCR their own
|
|
202
|
+
* URL and then steal victim codes via /oauth/authorize. Do not loosen this
|
|
203
|
+
* default without understanding that threat model.
|
|
204
|
+
*/
|
|
189
205
|
allowedRedirectUriPatterns?: string[];
|
|
190
206
|
/** Authorization code TTL in seconds (default: 300) */
|
|
191
207
|
authorizationCodeTtl?: number;
|
|
@@ -548,7 +564,16 @@ declare class OAuthProxy {
|
|
|
548
564
|
*/
|
|
549
565
|
private startCleanup;
|
|
550
566
|
/**
|
|
551
|
-
* Validate redirect URI against
|
|
567
|
+
* Validate a redirect URI against the configured allow-list.
|
|
568
|
+
*
|
|
569
|
+
* Returns `true` only if the URI is syntactically valid AND matches one of
|
|
570
|
+
* the explicitly configured `allowedRedirectUriPatterns`. An empty or unset
|
|
571
|
+
* pattern list means DCR will reject every URI — framework users must
|
|
572
|
+
* opt-in by listing the exact URIs (or wildcards) they trust.
|
|
573
|
+
*
|
|
574
|
+
* Prior versions also fell back to allowing any https URL or localhost,
|
|
575
|
+
* which enabled attackers to DCR an arbitrary URL and then abuse it via
|
|
576
|
+
* /oauth/authorize (CWE-601). Do not re-introduce that fallback.
|
|
552
577
|
*/
|
|
553
578
|
private validateRedirectUri;
|
|
554
579
|
}
|
|
@@ -573,7 +598,17 @@ declare class OAuthProxyError extends Error {
|
|
|
573
598
|
* Configuration common to all OAuth providers.
|
|
574
599
|
*/
|
|
575
600
|
interface AuthProviderConfig {
|
|
576
|
-
/**
|
|
601
|
+
/**
|
|
602
|
+
* Allow-list of redirect URI patterns accepted by Dynamic Client
|
|
603
|
+
* Registration. Required for any deployment that exposes /oauth/register
|
|
604
|
+
* or /oauth/authorize — an empty/unset list rejects every URI.
|
|
605
|
+
*
|
|
606
|
+
* Example: `["https://yourapp.example.com/*"]`
|
|
607
|
+
*
|
|
608
|
+
* Prior versions defaulted to `["http://localhost:*", "https://*"]`, which
|
|
609
|
+
* enabled CWE-601 open-redirect / authorization-code theft. See the
|
|
610
|
+
* SECURITY advisory before loosening this.
|
|
611
|
+
*/
|
|
577
612
|
allowedRedirectUriPatterns?: string[];
|
|
578
613
|
/** Base URL where the MCP server is accessible */
|
|
579
614
|
baseUrl: string;
|
|
@@ -185,7 +185,23 @@ interface OAuthProviderConfig {
|
|
|
185
185
|
interface OAuthProxyConfig {
|
|
186
186
|
/** Access token TTL in seconds (default: 3600) */
|
|
187
187
|
accessTokenTtl?: number;
|
|
188
|
-
/**
|
|
188
|
+
/**
|
|
189
|
+
* Allow-list of redirect URI patterns accepted by Dynamic Client Registration.
|
|
190
|
+
*
|
|
191
|
+
* A client calling POST /oauth/register must present a `redirect_uri` that
|
|
192
|
+
* matches one of these patterns (exact string or glob with `*` / `?`);
|
|
193
|
+
* otherwise the registration is rejected with `invalid_redirect_uri`. Once
|
|
194
|
+
* registered, the same exact URI must be echoed back at /oauth/authorize —
|
|
195
|
+
* the proxy performs exact string comparison per RFC 6749 §3.1.2.3.
|
|
196
|
+
*
|
|
197
|
+
* Default: `[]` (DCR rejects everything — explicit opt-in required).
|
|
198
|
+
*
|
|
199
|
+
* Prior versions defaulted to `["https://*", "http://localhost:*"]` with an
|
|
200
|
+
* implicit fallback that allowed any https URL. This enabled CWE-601
|
|
201
|
+
* open-redirect / authorization-code theft: an attacker could DCR their own
|
|
202
|
+
* URL and then steal victim codes via /oauth/authorize. Do not loosen this
|
|
203
|
+
* default without understanding that threat model.
|
|
204
|
+
*/
|
|
189
205
|
allowedRedirectUriPatterns?: string[];
|
|
190
206
|
/** Authorization code TTL in seconds (default: 300) */
|
|
191
207
|
authorizationCodeTtl?: number;
|
|
@@ -548,7 +564,16 @@ declare class OAuthProxy {
|
|
|
548
564
|
*/
|
|
549
565
|
private startCleanup;
|
|
550
566
|
/**
|
|
551
|
-
* Validate redirect URI against
|
|
567
|
+
* Validate a redirect URI against the configured allow-list.
|
|
568
|
+
*
|
|
569
|
+
* Returns `true` only if the URI is syntactically valid AND matches one of
|
|
570
|
+
* the explicitly configured `allowedRedirectUriPatterns`. An empty or unset
|
|
571
|
+
* pattern list means DCR will reject every URI — framework users must
|
|
572
|
+
* opt-in by listing the exact URIs (or wildcards) they trust.
|
|
573
|
+
*
|
|
574
|
+
* Prior versions also fell back to allowing any https URL or localhost,
|
|
575
|
+
* which enabled attackers to DCR an arbitrary URL and then abuse it via
|
|
576
|
+
* /oauth/authorize (CWE-601). Do not re-introduce that fallback.
|
|
552
577
|
*/
|
|
553
578
|
private validateRedirectUri;
|
|
554
579
|
}
|
|
@@ -573,7 +598,17 @@ declare class OAuthProxyError extends Error {
|
|
|
573
598
|
* Configuration common to all OAuth providers.
|
|
574
599
|
*/
|
|
575
600
|
interface AuthProviderConfig {
|
|
576
|
-
/**
|
|
601
|
+
/**
|
|
602
|
+
* Allow-list of redirect URI patterns accepted by Dynamic Client
|
|
603
|
+
* Registration. Required for any deployment that exposes /oauth/register
|
|
604
|
+
* or /oauth/authorize — an empty/unset list rejects every URI.
|
|
605
|
+
*
|
|
606
|
+
* Example: `["https://yourapp.example.com/*"]`
|
|
607
|
+
*
|
|
608
|
+
* Prior versions defaulted to `["http://localhost:*", "https://*"]`, which
|
|
609
|
+
* enabled CWE-601 open-redirect / authorization-code theft. See the
|
|
610
|
+
* SECURITY advisory before loosening this.
|
|
611
|
+
*/
|
|
577
612
|
allowedRedirectUriPatterns?: string[];
|
|
578
613
|
/** Base URL where the MCP server is accessible */
|
|
579
614
|
baseUrl: string;
|
package/dist/auth/index.cjs
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var _chunkSSVFQCSNcjs = require('../chunk-SSVFQCSN.cjs');
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
@@ -51,5 +51,5 @@ var _chunk7UDY4VFQcjs = require('../chunk-7UDY4VFQ.cjs');
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
exports.AuthProvider =
|
|
54
|
+
exports.AuthProvider = _chunkSSVFQCSNcjs.AuthProvider; exports.AzureProvider = _chunkSSVFQCSNcjs.AzureProvider; exports.ConsentManager = _chunkSSVFQCSNcjs.ConsentManager; exports.DEFAULT_ACCESS_TOKEN_TTL = _chunkSSVFQCSNcjs.DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = _chunkSSVFQCSNcjs.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_AUTHORIZATION_CODE_TTL = _chunkSSVFQCSNcjs.DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_REFRESH_TOKEN_TTL = _chunkSSVFQCSNcjs.DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_TRANSACTION_TTL = _chunkSSVFQCSNcjs.DEFAULT_TRANSACTION_TTL; exports.DiskStore = _chunkSSVFQCSNcjs.DiskStore; exports.EncryptedTokenStorage = _chunkSSVFQCSNcjs.EncryptedTokenStorage; exports.GitHubProvider = _chunkSSVFQCSNcjs.GitHubProvider; exports.GoogleProvider = _chunkSSVFQCSNcjs.GoogleProvider; exports.JWKSVerifier = _chunkSSVFQCSNcjs.JWKSVerifier; exports.JWTIssuer = _chunkSSVFQCSNcjs.JWTIssuer; exports.MemoryTokenStorage = _chunkSSVFQCSNcjs.MemoryTokenStorage; exports.OAuthProvider = _chunkSSVFQCSNcjs.OAuthProvider; exports.OAuthProxy = _chunkSSVFQCSNcjs.OAuthProxy; exports.OAuthProxyError = _chunkSSVFQCSNcjs.OAuthProxyError; exports.PKCEUtils = _chunkSSVFQCSNcjs.PKCEUtils; exports.getAuthSession = _chunkSSVFQCSNcjs.getAuthSession; exports.requireAll = _chunkSSVFQCSNcjs.requireAll; exports.requireAny = _chunkSSVFQCSNcjs.requireAny; exports.requireAuth = _chunkSSVFQCSNcjs.requireAuth; exports.requireRole = _chunkSSVFQCSNcjs.requireRole; exports.requireScopes = _chunkSSVFQCSNcjs.requireScopes;
|
|
55
55
|
//# sourceMappingURL=index.cjs.map
|
package/dist/auth/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as OAuthTransaction, C as ConsentData, T as TokenStorage, q as TokenVerifier, s as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-
|
|
2
|
-
export { A as AuthProvider, j as AuthProviderConfig, y as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, z as ClientCode, B as DCRClientMetadata, E as DCRRequest, F as DCRResponse, D as DEFAULT_ACCESS_TOKEN_TTL, u as DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH, v as DEFAULT_AUTHORIZATION_CODE_TTL, w as DEFAULT_REFRESH_TOKEN_TTL, x as DEFAULT_TRANSACTION_TTL, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, H as OAuthError, d as OAuthProvider, I as OAuthProviderConfig, a as OAuthProxy, J as OAuthProxyConfig, t as OAuthProxyError, O as OAuthSession, K as ProxyDCRClient, R as RefreshRequest, L as TokenMapping, M as TokenRequest, N as TokenResponse, U as UpstreamTokenSet, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from '../OAuthProvider-
|
|
1
|
+
import { p as OAuthTransaction, C as ConsentData, T as TokenStorage, q as TokenVerifier, s as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-BV6EpF_k.cjs';
|
|
2
|
+
export { A as AuthProvider, j as AuthProviderConfig, y as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, z as ClientCode, B as DCRClientMetadata, E as DCRRequest, F as DCRResponse, D as DEFAULT_ACCESS_TOKEN_TTL, u as DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH, v as DEFAULT_AUTHORIZATION_CODE_TTL, w as DEFAULT_REFRESH_TOKEN_TTL, x as DEFAULT_TRANSACTION_TTL, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, H as OAuthError, d as OAuthProvider, I as OAuthProviderConfig, a as OAuthProxy, J as OAuthProxyConfig, t as OAuthProxyError, O as OAuthSession, K as ProxyDCRClient, R as RefreshRequest, L as TokenMapping, M as TokenRequest, N as TokenResponse, U as UpstreamTokenSet, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from '../OAuthProvider-BV6EpF_k.cjs';
|
|
3
3
|
import 'node:http';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as OAuthTransaction, C as ConsentData, T as TokenStorage, q as TokenVerifier, s as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-
|
|
2
|
-
export { A as AuthProvider, j as AuthProviderConfig, y as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, z as ClientCode, B as DCRClientMetadata, E as DCRRequest, F as DCRResponse, D as DEFAULT_ACCESS_TOKEN_TTL, u as DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH, v as DEFAULT_AUTHORIZATION_CODE_TTL, w as DEFAULT_REFRESH_TOKEN_TTL, x as DEFAULT_TRANSACTION_TTL, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, H as OAuthError, d as OAuthProvider, I as OAuthProviderConfig, a as OAuthProxy, J as OAuthProxyConfig, t as OAuthProxyError, O as OAuthSession, K as ProxyDCRClient, R as RefreshRequest, L as TokenMapping, M as TokenRequest, N as TokenResponse, U as UpstreamTokenSet, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from '../OAuthProvider-
|
|
1
|
+
import { p as OAuthTransaction, C as ConsentData, T as TokenStorage, q as TokenVerifier, s as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-BV6EpF_k.js';
|
|
2
|
+
export { A as AuthProvider, j as AuthProviderConfig, y as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, z as ClientCode, B as DCRClientMetadata, E as DCRRequest, F as DCRResponse, D as DEFAULT_ACCESS_TOKEN_TTL, u as DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH, v as DEFAULT_AUTHORIZATION_CODE_TTL, w as DEFAULT_REFRESH_TOKEN_TTL, x as DEFAULT_TRANSACTION_TTL, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, H as OAuthError, d as OAuthProvider, I as OAuthProviderConfig, a as OAuthProxy, J as OAuthProxyConfig, t as OAuthProxyError, O as OAuthSession, K as ProxyDCRClient, R as RefreshRequest, L as TokenMapping, M as TokenRequest, N as TokenResponse, U as UpstreamTokenSet, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from '../OAuthProvider-BV6EpF_k.js';
|
|
3
3
|
import 'node:http';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/auth/index.js
CHANGED
|
@@ -1819,23 +1819,26 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
1819
1819
|
const url2 = new URL(req.url || "", `http://${host}`);
|
|
1820
1820
|
try {
|
|
1821
1821
|
if (req.method === "POST" && url2.pathname === "/oauth/register") {
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
error
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1822
|
+
await new Promise((resolve) => {
|
|
1823
|
+
let body = "";
|
|
1824
|
+
req.on("data", (chunk) => body += chunk);
|
|
1825
|
+
req.on("end", async () => {
|
|
1826
|
+
try {
|
|
1827
|
+
const request = JSON.parse(body);
|
|
1828
|
+
const response = await oauthProxy.registerClient(request);
|
|
1829
|
+
res.writeHead(201, { "Content-Type": "application/json" }).end(JSON.stringify(response));
|
|
1830
|
+
} catch (error) {
|
|
1831
|
+
const statusCode = error.statusCode || 400;
|
|
1832
|
+
res.writeHead(statusCode, { "Content-Type": "application/json" }).end(
|
|
1833
|
+
JSON.stringify(
|
|
1834
|
+
_optionalChain([error, 'access', _44 => _44.toJSON, 'optionalCall', _45 => _45()]) || {
|
|
1835
|
+
error: "invalid_request"
|
|
1836
|
+
}
|
|
1837
|
+
)
|
|
1838
|
+
);
|
|
1839
|
+
}
|
|
1840
|
+
resolve();
|
|
1841
|
+
});
|
|
1839
1842
|
});
|
|
1840
1843
|
return;
|
|
1841
1844
|
}
|
|
@@ -1886,82 +1889,93 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
1886
1889
|
return;
|
|
1887
1890
|
}
|
|
1888
1891
|
if (req.method === "POST" && url2.pathname === "/oauth/consent") {
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
if (location) {
|
|
1903
|
-
res.writeHead(response.status, { Location: location }).end();
|
|
1904
|
-
} else {
|
|
1905
|
-
const text = await response.text();
|
|
1906
|
-
res.writeHead(response.status).end(text);
|
|
1907
|
-
}
|
|
1908
|
-
} catch (error) {
|
|
1909
|
-
res.writeHead(400, { "Content-Type": "application/json" }).end(
|
|
1910
|
-
JSON.stringify(
|
|
1911
|
-
_optionalChain([error, 'access', _50 => _50.toJSON, 'optionalCall', _51 => _51()]) || {
|
|
1912
|
-
error: "server_error"
|
|
1892
|
+
await new Promise((resolve) => {
|
|
1893
|
+
let body = "";
|
|
1894
|
+
req.on("data", (chunk) => body += chunk);
|
|
1895
|
+
req.on("end", async () => {
|
|
1896
|
+
try {
|
|
1897
|
+
const mockRequest = new Request(
|
|
1898
|
+
`http://${host}/oauth/consent`,
|
|
1899
|
+
{
|
|
1900
|
+
body,
|
|
1901
|
+
headers: {
|
|
1902
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1903
|
+
},
|
|
1904
|
+
method: "POST"
|
|
1913
1905
|
}
|
|
1914
|
-
)
|
|
1915
|
-
|
|
1916
|
-
|
|
1906
|
+
);
|
|
1907
|
+
const response = await oauthProxy.handleConsent(mockRequest);
|
|
1908
|
+
const location = response.headers.get("Location");
|
|
1909
|
+
if (location) {
|
|
1910
|
+
res.writeHead(response.status, { Location: location }).end();
|
|
1911
|
+
} else {
|
|
1912
|
+
const text = await response.text();
|
|
1913
|
+
res.writeHead(response.status).end(text);
|
|
1914
|
+
}
|
|
1915
|
+
} catch (error) {
|
|
1916
|
+
res.writeHead(400, { "Content-Type": "application/json" }).end(
|
|
1917
|
+
JSON.stringify(
|
|
1918
|
+
_optionalChain([error, 'access', _50 => _50.toJSON, 'optionalCall', _51 => _51()]) || {
|
|
1919
|
+
error: "server_error"
|
|
1920
|
+
}
|
|
1921
|
+
)
|
|
1922
|
+
);
|
|
1923
|
+
}
|
|
1924
|
+
resolve();
|
|
1925
|
+
});
|
|
1917
1926
|
});
|
|
1918
1927
|
return;
|
|
1919
1928
|
}
|
|
1920
1929
|
if (req.method === "POST" && url2.pathname === "/oauth/token") {
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1930
|
+
await new Promise((resolve) => {
|
|
1931
|
+
let body = "";
|
|
1932
|
+
req.on("data", (chunk) => body += chunk);
|
|
1933
|
+
req.on("end", async () => {
|
|
1934
|
+
try {
|
|
1935
|
+
const params = new URLSearchParams(body);
|
|
1936
|
+
const grantType = params.get("grant_type");
|
|
1937
|
+
const basicAuth = parseBasicAuthHeader(
|
|
1938
|
+
req.headers.authorization
|
|
1939
|
+
);
|
|
1940
|
+
const clientId = _optionalChain([basicAuth, 'optionalAccess', _52 => _52.clientId]) || params.get("client_id") || "";
|
|
1941
|
+
const clientSecret = _nullishCoalesce(_nullishCoalesce(_optionalChain([basicAuth, 'optionalAccess', _53 => _53.clientSecret]), () => ( params.get("client_secret"))), () => ( void 0));
|
|
1942
|
+
let response;
|
|
1943
|
+
if (grantType === "authorization_code") {
|
|
1944
|
+
response = await oauthProxy.exchangeAuthorizationCode({
|
|
1945
|
+
client_id: clientId,
|
|
1946
|
+
client_secret: clientSecret,
|
|
1947
|
+
code: params.get("code") || "",
|
|
1948
|
+
code_verifier: params.get("code_verifier") || void 0,
|
|
1949
|
+
grant_type: "authorization_code",
|
|
1950
|
+
redirect_uri: params.get("redirect_uri") || ""
|
|
1951
|
+
});
|
|
1952
|
+
} else if (grantType === "refresh_token") {
|
|
1953
|
+
response = await oauthProxy.exchangeRefreshToken({
|
|
1954
|
+
client_id: clientId,
|
|
1955
|
+
client_secret: clientSecret,
|
|
1956
|
+
grant_type: "refresh_token",
|
|
1957
|
+
refresh_token: params.get("refresh_token") || "",
|
|
1958
|
+
scope: params.get("scope") || void 0
|
|
1959
|
+
});
|
|
1960
|
+
} else {
|
|
1961
|
+
throw {
|
|
1962
|
+
statusCode: 400,
|
|
1963
|
+
toJSON: () => ({ error: "unsupported_grant_type" })
|
|
1964
|
+
};
|
|
1965
|
+
}
|
|
1966
|
+
res.writeHead(200, { "Content-Type": "application/json" }).end(JSON.stringify(response));
|
|
1967
|
+
} catch (error) {
|
|
1968
|
+
const statusCode = error.statusCode || 400;
|
|
1969
|
+
res.writeHead(statusCode, { "Content-Type": "application/json" }).end(
|
|
1970
|
+
JSON.stringify(
|
|
1971
|
+
_optionalChain([error, 'access', _54 => _54.toJSON, 'optionalCall', _55 => _55()]) || {
|
|
1972
|
+
error: "invalid_request"
|
|
1973
|
+
}
|
|
1974
|
+
)
|
|
1975
|
+
);
|
|
1953
1976
|
}
|
|
1954
|
-
|
|
1955
|
-
}
|
|
1956
|
-
const statusCode = error.statusCode || 400;
|
|
1957
|
-
res.writeHead(statusCode, { "Content-Type": "application/json" }).end(
|
|
1958
|
-
JSON.stringify(
|
|
1959
|
-
_optionalChain([error, 'access', _54 => _54.toJSON, 'optionalCall', _55 => _55()]) || {
|
|
1960
|
-
error: "invalid_request"
|
|
1961
|
-
}
|
|
1962
|
-
)
|
|
1963
|
-
);
|
|
1964
|
-
}
|
|
1977
|
+
resolve();
|
|
1978
|
+
});
|
|
1965
1979
|
});
|
|
1966
1980
|
return;
|
|
1967
1981
|
}
|
|
@@ -1971,7 +1985,6 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
1971
1985
|
return;
|
|
1972
1986
|
}
|
|
1973
1987
|
}
|
|
1974
|
-
res.writeHead(404).end();
|
|
1975
1988
|
};
|
|
1976
1989
|
/**
|
|
1977
1990
|
* Converts Node.js IncomingMessage to Web Request for Hono
|
|
@@ -2107,4 +2120,4 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2107
2120
|
|
|
2108
2121
|
|
|
2109
2122
|
exports.DiscoveryDocumentCache = DiscoveryDocumentCache; exports.imageContent = imageContent; exports.audioContent = audioContent; exports.UnexpectedStateError = UnexpectedStateError; exports.UserError = UserError; exports.ServerState = ServerState; exports.FastMCPSession = FastMCPSession; exports.FastMCP = FastMCP;
|
|
2110
|
-
//# sourceMappingURL=chunk-
|
|
2123
|
+
//# sourceMappingURL=chunk-EXZZ3NKL.cjs.map
|