fastmcp 4.23.10 → 4.23.12
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-BcDb5bOz.d.cts → OAuthProvider-84BWWDBF.d.cts} +55 -1
- package/dist/{OAuthProvider-BcDb5bOz.d.ts → OAuthProvider-84BWWDBF.d.ts} +55 -1
- package/dist/auth/index.cjs +4 -2
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.cts +10 -2
- package/dist/auth/index.d.ts +10 -2
- package/dist/auth/index.js +3 -1
- package/dist/{chunk-B77E3EDN.cjs → chunk-4P2GDM7W.cjs} +90 -37
- package/dist/chunk-4P2GDM7W.cjs.map +1 -0
- package/dist/{chunk-4OWHPJEL.cjs → chunk-BV4PWTT6.cjs} +214 -43
- package/dist/chunk-BV4PWTT6.cjs.map +1 -0
- package/dist/{chunk-G44SPVP7.js → chunk-CAQLTSJ5.js} +211 -40
- package/dist/chunk-CAQLTSJ5.js.map +1 -0
- package/dist/{chunk-EHTAPWBU.js → chunk-ULNQF5KG.js} +73 -20
- package/dist/chunk-ULNQF5KG.js.map +1 -0
- package/dist/examples/custom-routes.cjs +3 -3
- package/dist/examples/custom-routes.js +2 -2
- package/dist/openapi/index.cjs +7 -7
- package/dist/openapi/index.d.cts +1 -1
- package/dist/openapi/index.d.ts +1 -1
- package/dist/openapi/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-4OWHPJEL.cjs.map +0 -1
- package/dist/chunk-B77E3EDN.cjs.map +0 -1
- package/dist/chunk-EHTAPWBU.js.map +0 -1
- package/dist/chunk-G44SPVP7.js.map +0 -1
package/dist/FastMCP.cjs
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunk4P2GDM7Wcjs = require('./chunk-4P2GDM7W.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -24,7 +24,7 @@ var _chunkB77E3EDNcjs = require('./chunk-B77E3EDN.cjs');
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var _chunkBV4PWTT6cjs = require('./chunk-BV4PWTT6.cjs');
|
|
28
28
|
require('./chunk-6TDYSPLC.cjs');
|
|
29
29
|
|
|
30
30
|
|
|
@@ -50,5 +50,5 @@ require('./chunk-6TDYSPLC.cjs');
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
exports.AuthProvider =
|
|
53
|
+
exports.AuthProvider = _chunkBV4PWTT6cjs.AuthProvider; exports.AzureProvider = _chunkBV4PWTT6cjs.AzureProvider; exports.DiscoveryDocumentCache = _chunk4P2GDM7Wcjs.DiscoveryDocumentCache; exports.FastMCP = _chunk4P2GDM7Wcjs.FastMCP; exports.FastMCPError = _chunk4P2GDM7Wcjs.FastMCPError; exports.FastMCPSession = _chunk4P2GDM7Wcjs.FastMCPSession; exports.GitHubProvider = _chunkBV4PWTT6cjs.GitHubProvider; exports.GoogleProvider = _chunkBV4PWTT6cjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunk4P2GDM7Wcjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunkBV4PWTT6cjs.OAuthProvider; exports.ServerState = _chunk4P2GDM7Wcjs.ServerState; exports.SessionError = _chunk4P2GDM7Wcjs.SessionError; exports.UnexpectedStateError = _chunk4P2GDM7Wcjs.UnexpectedStateError; exports.UserError = _chunk4P2GDM7Wcjs.UserError; exports.audioContent = _chunk4P2GDM7Wcjs.audioContent; exports.getAuthSession = _chunkBV4PWTT6cjs.getAuthSession; exports.imageContent = _chunk4P2GDM7Wcjs.imageContent; exports.jsonSchemaAdapter = _chunk4P2GDM7Wcjs.jsonSchemaAdapter; exports.requireAll = _chunkBV4PWTT6cjs.requireAll; exports.requireAny = _chunkBV4PWTT6cjs.requireAny; exports.requireAuth = _chunkBV4PWTT6cjs.requireAuth; exports.requireRole = _chunkBV4PWTT6cjs.requireRole; exports.requireScopes = _chunkBV4PWTT6cjs.requireScopes;
|
|
54
54
|
//# sourceMappingURL=FastMCP.cjs.map
|
package/dist/FastMCP.d.cts
CHANGED
|
@@ -12,8 +12,8 @@ import { CorsOptions } from 'mcp-proxy';
|
|
|
12
12
|
export { CorsOptions } from 'mcp-proxy';
|
|
13
13
|
import { StrictEventEmitter } from 'strict-event-emitter-types';
|
|
14
14
|
import { z } from 'zod';
|
|
15
|
-
import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-
|
|
16
|
-
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-
|
|
15
|
+
import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-84BWWDBF.cjs';
|
|
16
|
+
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-84BWWDBF.cjs';
|
|
17
17
|
import 'node:http';
|
|
18
18
|
|
|
19
19
|
declare class DiscoveryDocumentCache {
|
package/dist/FastMCP.d.ts
CHANGED
|
@@ -12,8 +12,8 @@ import { CorsOptions } from 'mcp-proxy';
|
|
|
12
12
|
export { CorsOptions } from 'mcp-proxy';
|
|
13
13
|
import { StrictEventEmitter } from 'strict-event-emitter-types';
|
|
14
14
|
import { z } from 'zod';
|
|
15
|
-
import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-
|
|
16
|
-
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-
|
|
15
|
+
import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-84BWWDBF.js';
|
|
16
|
+
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-84BWWDBF.js';
|
|
17
17
|
import 'node:http';
|
|
18
18
|
|
|
19
19
|
declare class DiscoveryDocumentCache {
|
package/dist/FastMCP.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
audioContent,
|
|
12
12
|
imageContent,
|
|
13
13
|
jsonSchemaAdapter
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ULNQF5KG.js";
|
|
15
15
|
import {
|
|
16
16
|
AuthProvider,
|
|
17
17
|
AzureProvider,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
requireAuth,
|
|
25
25
|
requireRole,
|
|
26
26
|
requireScopes
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-CAQLTSJ5.js";
|
|
28
28
|
import "./chunk-OKKFL2M4.js";
|
|
29
29
|
export {
|
|
30
30
|
AuthProvider,
|
|
@@ -10,6 +10,11 @@ import { IncomingMessage } from 'node:http';
|
|
|
10
10
|
declare const DEFAULT_ACCESS_TOKEN_TTL = 3600;
|
|
11
11
|
declare const DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = 31536000;
|
|
12
12
|
declare const DEFAULT_REFRESH_TOKEN_TTL = 2592000;
|
|
13
|
+
/**
|
|
14
|
+
* The token endpoint authentication methods the proxy can verify, and so the
|
|
15
|
+
* only ones a client may register with.
|
|
16
|
+
*/
|
|
17
|
+
declare const TOKEN_ENDPOINT_AUTH_METHODS: readonly ["client_secret_basic", "client_secret_post", "none"];
|
|
13
18
|
declare const DEFAULT_AUTHORIZATION_CODE_TTL = 300;
|
|
14
19
|
declare const DEFAULT_TRANSACTION_TTL = 600;
|
|
15
20
|
/**
|
|
@@ -368,6 +373,17 @@ interface ProxyDCRClient {
|
|
|
368
373
|
* Absent for a Dynamic Client Registration.
|
|
369
374
|
*/
|
|
370
375
|
source?: "cimd";
|
|
376
|
+
/**
|
|
377
|
+
* How the client authenticates at the token endpoint, as it registered.
|
|
378
|
+
* `"none"` is a public client: it is issued no secret and must use S256
|
|
379
|
+
* PKCE. Either secret method obliges it to authenticate on every token
|
|
380
|
+
* request.
|
|
381
|
+
*
|
|
382
|
+
* Absent on registrations written before this was recorded, when every
|
|
383
|
+
* client was issued a secret whatever it asked for. Those are treated as
|
|
384
|
+
* public clients that may still authenticate with that secret.
|
|
385
|
+
*/
|
|
386
|
+
tokenEndpointAuthMethod?: TokenEndpointAuthMethod;
|
|
371
387
|
}
|
|
372
388
|
/**
|
|
373
389
|
* OAuth refresh token request
|
|
@@ -379,11 +395,23 @@ interface RefreshRequest {
|
|
|
379
395
|
refresh_token: string;
|
|
380
396
|
scope?: string;
|
|
381
397
|
}
|
|
398
|
+
/**
|
|
399
|
+
* Token endpoint authentication methods a Dynamic Client Registration may ask
|
|
400
|
+
* for (RFC 7591 §2).
|
|
401
|
+
*/
|
|
402
|
+
type TokenEndpointAuthMethod = (typeof TOKEN_ENDPOINT_AUTH_METHODS)[number];
|
|
382
403
|
/**
|
|
383
404
|
* Token mapping for JWT swap pattern
|
|
384
405
|
* Maps JTI to upstream token reference
|
|
385
406
|
*/
|
|
386
407
|
interface TokenMapping {
|
|
408
|
+
/**
|
|
409
|
+
* Whether the client authenticated with its secret when this token was
|
|
410
|
+
* issued. A refresh token issued that way is only redeemed by a client that
|
|
411
|
+
* authenticates again; otherwise omitting the secret would turn it back into
|
|
412
|
+
* a bearer token.
|
|
413
|
+
*/
|
|
414
|
+
clientAuthenticated?: boolean;
|
|
387
415
|
/** Client ID */
|
|
388
416
|
clientId: string;
|
|
389
417
|
/** Creation timestamp */
|
|
@@ -581,6 +609,20 @@ declare class OAuthProxy {
|
|
|
581
609
|
* RFC 7591 Dynamic Client Registration
|
|
582
610
|
*/
|
|
583
611
|
registerClient(request: DCRRequest): Promise<DCRResponse>;
|
|
612
|
+
/**
|
|
613
|
+
* RFC 6749 §2.3 / §3.2.1: identify the client behind a token request and,
|
|
614
|
+
* when it presents a secret, authenticate it.
|
|
615
|
+
*
|
|
616
|
+
* A client registered with a secret method must present its secret. A
|
|
617
|
+
* public client must not present one: it was issued none. A registration
|
|
618
|
+
* that predates recorded auth methods may do either — it was issued a
|
|
619
|
+
* secret whatever it asked for — and is treated as unauthenticated when it
|
|
620
|
+
* leaves it out, which the grants then hold it to.
|
|
621
|
+
*
|
|
622
|
+
* Throws `invalid_client` on any failure. Nothing here touches grant state,
|
|
623
|
+
* so a caller that fails cannot spend a code or refresh token.
|
|
624
|
+
*/
|
|
625
|
+
private authenticateClient;
|
|
584
626
|
/**
|
|
585
627
|
* Calculate access token TTL from upstream tokens
|
|
586
628
|
*/
|
|
@@ -669,6 +711,12 @@ declare class OAuthProxy {
|
|
|
669
711
|
* GitHub Apps return URL-encoded format, most providers return JSON
|
|
670
712
|
*/
|
|
671
713
|
private parseTokenResponse;
|
|
714
|
+
/**
|
|
715
|
+
* Storage key for the client binding of a passthrough-mode upstream refresh
|
|
716
|
+
* token. Keyed by its hash: storage keys are not encrypted, and the token
|
|
717
|
+
* itself is a live upstream credential.
|
|
718
|
+
*/
|
|
719
|
+
private passthroughRefreshKey;
|
|
672
720
|
/**
|
|
673
721
|
* Redirect to upstream OAuth provider
|
|
674
722
|
*/
|
|
@@ -698,6 +746,12 @@ declare class OAuthProxy {
|
|
|
698
746
|
* `expiresAt`.
|
|
699
747
|
*/
|
|
700
748
|
private restoreMapping;
|
|
749
|
+
/**
|
|
750
|
+
* Record which client a passthrough-mode upstream refresh token was handed
|
|
751
|
+
* to. It lives as long as the upstream says the token does, or as the
|
|
752
|
+
* configured refresh-token lifetime when it does not say.
|
|
753
|
+
*/
|
|
754
|
+
private savePassthroughRefreshBinding;
|
|
701
755
|
/**
|
|
702
756
|
* Start periodic cleanup of expired transactions and codes
|
|
703
757
|
*/
|
|
@@ -990,4 +1044,4 @@ declare class OAuthProvider<TSession extends OAuthSession = OAuthSession> extend
|
|
|
990
1044
|
protected getTokenEndpoint(): string;
|
|
991
1045
|
}
|
|
992
1046
|
|
|
993
|
-
export { AuthProvider as A, type
|
|
1047
|
+
export { AuthProvider as A, type ClientCode as B, type ConsentData as C, DEFAULT_ACCESS_TOKEN_TTL as D, type DCRClientMetadata as E, type DCRRequest as F, GitHubProvider as G, type DCRResponse as H, type OAuthError as I, type OAuthProviderConfig as J, type OAuthProxyConfig as K, type ProxyDCRClient as L, type TokenEndpointAuthMethod as M, type TokenMapping as N, type OAuthSession as O, type PKCEPair as P, type TokenRequest as Q, type RefreshRequest as R, type TokenResponse as S, type TokenStorage as T, type UpstreamTokenSet as U, OAuthProxy as a, AzureProvider as b, GoogleProvider as c, OAuthProvider as d, requireAny as e, requireAuth as f, getAuthSession as g, requireRole as h, requireScopes as i, type AuthProviderConfig as j, type AzureProviderConfig as k, type AzureSession as l, type GenericOAuthProviderConfig as m, type GitHubSession as n, type GoogleSession as o, type OAuthTransaction as p, type TokenVerifier as q, requireAll as r, type TokenVerificationResult as s, OAuthProxyError as t, DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH as u, DEFAULT_AUTHORIZATION_CODE_TTL as v, DEFAULT_REFRESH_TOKEN_TTL as w, DEFAULT_TRANSACTION_TTL as x, TOKEN_ENDPOINT_AUTH_METHODS as y, type AuthorizationParams as z };
|
|
@@ -10,6 +10,11 @@ import { IncomingMessage } from 'node:http';
|
|
|
10
10
|
declare const DEFAULT_ACCESS_TOKEN_TTL = 3600;
|
|
11
11
|
declare const DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = 31536000;
|
|
12
12
|
declare const DEFAULT_REFRESH_TOKEN_TTL = 2592000;
|
|
13
|
+
/**
|
|
14
|
+
* The token endpoint authentication methods the proxy can verify, and so the
|
|
15
|
+
* only ones a client may register with.
|
|
16
|
+
*/
|
|
17
|
+
declare const TOKEN_ENDPOINT_AUTH_METHODS: readonly ["client_secret_basic", "client_secret_post", "none"];
|
|
13
18
|
declare const DEFAULT_AUTHORIZATION_CODE_TTL = 300;
|
|
14
19
|
declare const DEFAULT_TRANSACTION_TTL = 600;
|
|
15
20
|
/**
|
|
@@ -368,6 +373,17 @@ interface ProxyDCRClient {
|
|
|
368
373
|
* Absent for a Dynamic Client Registration.
|
|
369
374
|
*/
|
|
370
375
|
source?: "cimd";
|
|
376
|
+
/**
|
|
377
|
+
* How the client authenticates at the token endpoint, as it registered.
|
|
378
|
+
* `"none"` is a public client: it is issued no secret and must use S256
|
|
379
|
+
* PKCE. Either secret method obliges it to authenticate on every token
|
|
380
|
+
* request.
|
|
381
|
+
*
|
|
382
|
+
* Absent on registrations written before this was recorded, when every
|
|
383
|
+
* client was issued a secret whatever it asked for. Those are treated as
|
|
384
|
+
* public clients that may still authenticate with that secret.
|
|
385
|
+
*/
|
|
386
|
+
tokenEndpointAuthMethod?: TokenEndpointAuthMethod;
|
|
371
387
|
}
|
|
372
388
|
/**
|
|
373
389
|
* OAuth refresh token request
|
|
@@ -379,11 +395,23 @@ interface RefreshRequest {
|
|
|
379
395
|
refresh_token: string;
|
|
380
396
|
scope?: string;
|
|
381
397
|
}
|
|
398
|
+
/**
|
|
399
|
+
* Token endpoint authentication methods a Dynamic Client Registration may ask
|
|
400
|
+
* for (RFC 7591 §2).
|
|
401
|
+
*/
|
|
402
|
+
type TokenEndpointAuthMethod = (typeof TOKEN_ENDPOINT_AUTH_METHODS)[number];
|
|
382
403
|
/**
|
|
383
404
|
* Token mapping for JWT swap pattern
|
|
384
405
|
* Maps JTI to upstream token reference
|
|
385
406
|
*/
|
|
386
407
|
interface TokenMapping {
|
|
408
|
+
/**
|
|
409
|
+
* Whether the client authenticated with its secret when this token was
|
|
410
|
+
* issued. A refresh token issued that way is only redeemed by a client that
|
|
411
|
+
* authenticates again; otherwise omitting the secret would turn it back into
|
|
412
|
+
* a bearer token.
|
|
413
|
+
*/
|
|
414
|
+
clientAuthenticated?: boolean;
|
|
387
415
|
/** Client ID */
|
|
388
416
|
clientId: string;
|
|
389
417
|
/** Creation timestamp */
|
|
@@ -581,6 +609,20 @@ declare class OAuthProxy {
|
|
|
581
609
|
* RFC 7591 Dynamic Client Registration
|
|
582
610
|
*/
|
|
583
611
|
registerClient(request: DCRRequest): Promise<DCRResponse>;
|
|
612
|
+
/**
|
|
613
|
+
* RFC 6749 §2.3 / §3.2.1: identify the client behind a token request and,
|
|
614
|
+
* when it presents a secret, authenticate it.
|
|
615
|
+
*
|
|
616
|
+
* A client registered with a secret method must present its secret. A
|
|
617
|
+
* public client must not present one: it was issued none. A registration
|
|
618
|
+
* that predates recorded auth methods may do either — it was issued a
|
|
619
|
+
* secret whatever it asked for — and is treated as unauthenticated when it
|
|
620
|
+
* leaves it out, which the grants then hold it to.
|
|
621
|
+
*
|
|
622
|
+
* Throws `invalid_client` on any failure. Nothing here touches grant state,
|
|
623
|
+
* so a caller that fails cannot spend a code or refresh token.
|
|
624
|
+
*/
|
|
625
|
+
private authenticateClient;
|
|
584
626
|
/**
|
|
585
627
|
* Calculate access token TTL from upstream tokens
|
|
586
628
|
*/
|
|
@@ -669,6 +711,12 @@ declare class OAuthProxy {
|
|
|
669
711
|
* GitHub Apps return URL-encoded format, most providers return JSON
|
|
670
712
|
*/
|
|
671
713
|
private parseTokenResponse;
|
|
714
|
+
/**
|
|
715
|
+
* Storage key for the client binding of a passthrough-mode upstream refresh
|
|
716
|
+
* token. Keyed by its hash: storage keys are not encrypted, and the token
|
|
717
|
+
* itself is a live upstream credential.
|
|
718
|
+
*/
|
|
719
|
+
private passthroughRefreshKey;
|
|
672
720
|
/**
|
|
673
721
|
* Redirect to upstream OAuth provider
|
|
674
722
|
*/
|
|
@@ -698,6 +746,12 @@ declare class OAuthProxy {
|
|
|
698
746
|
* `expiresAt`.
|
|
699
747
|
*/
|
|
700
748
|
private restoreMapping;
|
|
749
|
+
/**
|
|
750
|
+
* Record which client a passthrough-mode upstream refresh token was handed
|
|
751
|
+
* to. It lives as long as the upstream says the token does, or as the
|
|
752
|
+
* configured refresh-token lifetime when it does not say.
|
|
753
|
+
*/
|
|
754
|
+
private savePassthroughRefreshBinding;
|
|
701
755
|
/**
|
|
702
756
|
* Start periodic cleanup of expired transactions and codes
|
|
703
757
|
*/
|
|
@@ -990,4 +1044,4 @@ declare class OAuthProvider<TSession extends OAuthSession = OAuthSession> extend
|
|
|
990
1044
|
protected getTokenEndpoint(): string;
|
|
991
1045
|
}
|
|
992
1046
|
|
|
993
|
-
export { AuthProvider as A, type
|
|
1047
|
+
export { AuthProvider as A, type ClientCode as B, type ConsentData as C, DEFAULT_ACCESS_TOKEN_TTL as D, type DCRClientMetadata as E, type DCRRequest as F, GitHubProvider as G, type DCRResponse as H, type OAuthError as I, type OAuthProviderConfig as J, type OAuthProxyConfig as K, type ProxyDCRClient as L, type TokenEndpointAuthMethod as M, type TokenMapping as N, type OAuthSession as O, type PKCEPair as P, type TokenRequest as Q, type RefreshRequest as R, type TokenResponse as S, type TokenStorage as T, type UpstreamTokenSet as U, OAuthProxy as a, AzureProvider as b, GoogleProvider as c, OAuthProvider as d, requireAny as e, requireAuth as f, getAuthSession as g, requireRole as h, requireScopes as i, type AuthProviderConfig as j, type AzureProviderConfig as k, type AzureSession as l, type GenericOAuthProviderConfig as m, type GitHubSession as n, type GoogleSession as o, type OAuthTransaction as p, type TokenVerifier as q, requireAll as r, type TokenVerificationResult as s, OAuthProxyError as t, DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH as u, DEFAULT_AUTHORIZATION_CODE_TTL as v, DEFAULT_REFRESH_TOKEN_TTL as w, DEFAULT_TRANSACTION_TTL as x, TOKEN_ENDPOINT_AUTH_METHODS as y, type AuthorizationParams as z };
|
package/dist/auth/index.cjs
CHANGED
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var _chunk4OWHPJELcjs = require('../chunk-4OWHPJEL.cjs');
|
|
28
27
|
|
|
28
|
+
var _chunkBV4PWTT6cjs = require('../chunk-BV4PWTT6.cjs');
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
@@ -51,5 +51,7 @@ var _chunk4OWHPJELcjs = require('../chunk-4OWHPJEL.cjs');
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
exports.AuthProvider = _chunkBV4PWTT6cjs.AuthProvider; exports.AzureProvider = _chunkBV4PWTT6cjs.AzureProvider; exports.ConsentManager = _chunkBV4PWTT6cjs.ConsentManager; exports.DEFAULT_ACCESS_TOKEN_TTL = _chunkBV4PWTT6cjs.DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = _chunkBV4PWTT6cjs.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_AUTHORIZATION_CODE_TTL = _chunkBV4PWTT6cjs.DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_REFRESH_TOKEN_TTL = _chunkBV4PWTT6cjs.DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_TRANSACTION_TTL = _chunkBV4PWTT6cjs.DEFAULT_TRANSACTION_TTL; exports.DiskStore = _chunkBV4PWTT6cjs.DiskStore; exports.EncryptedTokenStorage = _chunkBV4PWTT6cjs.EncryptedTokenStorage; exports.GitHubProvider = _chunkBV4PWTT6cjs.GitHubProvider; exports.GoogleProvider = _chunkBV4PWTT6cjs.GoogleProvider; exports.JWKSVerifier = _chunkBV4PWTT6cjs.JWKSVerifier; exports.JWTIssuer = _chunkBV4PWTT6cjs.JWTIssuer; exports.MemoryTokenStorage = _chunkBV4PWTT6cjs.MemoryTokenStorage; exports.OAuthProvider = _chunkBV4PWTT6cjs.OAuthProvider; exports.OAuthProxy = _chunkBV4PWTT6cjs.OAuthProxy; exports.OAuthProxyError = _chunkBV4PWTT6cjs.OAuthProxyError; exports.PKCEUtils = _chunkBV4PWTT6cjs.PKCEUtils; exports.TOKEN_ENDPOINT_AUTH_METHODS = _chunkBV4PWTT6cjs.TOKEN_ENDPOINT_AUTH_METHODS; exports.getAuthSession = _chunkBV4PWTT6cjs.getAuthSession; exports.requireAll = _chunkBV4PWTT6cjs.requireAll; exports.requireAny = _chunkBV4PWTT6cjs.requireAny; exports.requireAuth = _chunkBV4PWTT6cjs.requireAuth; exports.requireRole = _chunkBV4PWTT6cjs.requireRole; exports.requireScopes = _chunkBV4PWTT6cjs.requireScopes;
|
|
55
57
|
//# sourceMappingURL=index.cjs.map
|
package/dist/auth/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/fastmcp/fastmcp/dist/auth/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/fastmcp/fastmcp/dist/auth/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,qmDAAC","file":"/home/runner/work/fastmcp/fastmcp/dist/auth/index.cjs"}
|
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,
|
|
1
|
+
import { p as OAuthTransaction, C as ConsentData, T as TokenStorage, q as TokenVerifier, s as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-84BWWDBF.cjs';
|
|
2
|
+
export { A as AuthProvider, j as AuthProviderConfig, z as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, B as ClientCode, E as DCRClientMetadata, F as DCRRequest, H 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, I as OAuthError, d as OAuthProvider, J as OAuthProviderConfig, a as OAuthProxy, K as OAuthProxyConfig, t as OAuthProxyError, O as OAuthSession, L as ProxyDCRClient, R as RefreshRequest, y as TOKEN_ENDPOINT_AUTH_METHODS, M as TokenEndpointAuthMethod, N as TokenMapping, Q as TokenRequest, S 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-84BWWDBF.cjs';
|
|
3
3
|
import 'node:http';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -150,6 +150,14 @@ interface JWTClaims {
|
|
|
150
150
|
jti: string;
|
|
151
151
|
/** Scopes */
|
|
152
152
|
scope: string[];
|
|
153
|
+
/**
|
|
154
|
+
* Which kind of token this is. Access and refresh tokens share a signing
|
|
155
|
+
* key, audience and claim set, so without this either one verifies as the
|
|
156
|
+
* other: an access token — sent on every request — could be redeemed for a
|
|
157
|
+
* refresh token, and a refresh token presented as a bearer credential.
|
|
158
|
+
* Absent from tokens issued before it existed; those are refused as both.
|
|
159
|
+
*/
|
|
160
|
+
token_use?: "access" | "refresh";
|
|
153
161
|
}
|
|
154
162
|
/**
|
|
155
163
|
* JWT Issuer configuration
|
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,
|
|
1
|
+
import { p as OAuthTransaction, C as ConsentData, T as TokenStorage, q as TokenVerifier, s as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-84BWWDBF.js';
|
|
2
|
+
export { A as AuthProvider, j as AuthProviderConfig, z as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, B as ClientCode, E as DCRClientMetadata, F as DCRRequest, H 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, I as OAuthError, d as OAuthProvider, J as OAuthProviderConfig, a as OAuthProxy, K as OAuthProxyConfig, t as OAuthProxyError, O as OAuthSession, L as ProxyDCRClient, R as RefreshRequest, y as TOKEN_ENDPOINT_AUTH_METHODS, M as TokenEndpointAuthMethod, N as TokenMapping, Q as TokenRequest, S 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-84BWWDBF.js';
|
|
3
3
|
import 'node:http';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -150,6 +150,14 @@ interface JWTClaims {
|
|
|
150
150
|
jti: string;
|
|
151
151
|
/** Scopes */
|
|
152
152
|
scope: string[];
|
|
153
|
+
/**
|
|
154
|
+
* Which kind of token this is. Access and refresh tokens share a signing
|
|
155
|
+
* key, audience and claim set, so without this either one verifies as the
|
|
156
|
+
* other: an access token — sent on every request — could be redeemed for a
|
|
157
|
+
* refresh token, and a refresh token presented as a bearer credential.
|
|
158
|
+
* Absent from tokens issued before it existed; those are refused as both.
|
|
159
|
+
*/
|
|
160
|
+
token_use?: "access" | "refresh";
|
|
153
161
|
}
|
|
154
162
|
/**
|
|
155
163
|
* JWT Issuer configuration
|
package/dist/auth/index.js
CHANGED
|
@@ -18,13 +18,14 @@ import {
|
|
|
18
18
|
OAuthProxy,
|
|
19
19
|
OAuthProxyError,
|
|
20
20
|
PKCEUtils,
|
|
21
|
+
TOKEN_ENDPOINT_AUTH_METHODS,
|
|
21
22
|
getAuthSession,
|
|
22
23
|
requireAll,
|
|
23
24
|
requireAny,
|
|
24
25
|
requireAuth,
|
|
25
26
|
requireRole,
|
|
26
27
|
requireScopes
|
|
27
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-CAQLTSJ5.js";
|
|
28
29
|
export {
|
|
29
30
|
AuthProvider,
|
|
30
31
|
AzureProvider,
|
|
@@ -45,6 +46,7 @@ export {
|
|
|
45
46
|
OAuthProxy,
|
|
46
47
|
OAuthProxyError,
|
|
47
48
|
PKCEUtils,
|
|
49
|
+
TOKEN_ENDPOINT_AUTH_METHODS,
|
|
48
50
|
getAuthSession,
|
|
49
51
|
requireAll,
|
|
50
52
|
requireAny,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkBV4PWTT6cjs = require('./chunk-BV4PWTT6.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -141,7 +141,7 @@ var DiscoveryDocumentCache = class {
|
|
|
141
141
|
throw error;
|
|
142
142
|
}
|
|
143
143
|
if (!res.ok) {
|
|
144
|
-
await
|
|
144
|
+
await _chunkBV4PWTT6cjs.cancelResponseBody.call(void 0, res);
|
|
145
145
|
throw new Error(
|
|
146
146
|
`Failed to fetch discovery document from ${url}: ${res.status} ${res.statusText}`
|
|
147
147
|
);
|
|
@@ -258,7 +258,7 @@ var imageContent = async (input) => {
|
|
|
258
258
|
signal: AbortSignal.timeout(timeoutMs)
|
|
259
259
|
});
|
|
260
260
|
if (!response.ok) {
|
|
261
|
-
await
|
|
261
|
+
await _chunkBV4PWTT6cjs.cancelResponseBody.call(void 0, response);
|
|
262
262
|
throw new Error(
|
|
263
263
|
`Server responded with status: ${response.status} - ${response.statusText}`
|
|
264
264
|
);
|
|
@@ -340,7 +340,7 @@ var audioContent = async (input) => {
|
|
|
340
340
|
signal: AbortSignal.timeout(timeoutMs)
|
|
341
341
|
});
|
|
342
342
|
if (!response.ok) {
|
|
343
|
-
await
|
|
343
|
+
await _chunkBV4PWTT6cjs.cancelResponseBody.call(void 0, response);
|
|
344
344
|
throw new Error(
|
|
345
345
|
`Server responded with status: ${response.status} - ${response.statusText}`
|
|
346
346
|
);
|
|
@@ -1451,7 +1451,6 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1451
1451
|
if (!match) {
|
|
1452
1452
|
continue;
|
|
1453
1453
|
}
|
|
1454
|
-
const uri = uriTemplate.fill(match);
|
|
1455
1454
|
const result = await resourceTemplate.load(
|
|
1456
1455
|
match,
|
|
1457
1456
|
this.#auth,
|
|
@@ -1468,7 +1467,9 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1468
1467
|
description: resourceTemplate.description,
|
|
1469
1468
|
mimeType: _nullishCoalesce(resource2.mimeType, () => ( resourceTemplate.mimeType)),
|
|
1470
1469
|
name: resourceTemplate.name,
|
|
1471
|
-
|
|
1470
|
+
// The URI asked for. Refilling the template from `match` can
|
|
1471
|
+
// spell it differently: `{path}` refills `a,b` as `a%2Cb`.
|
|
1472
|
+
uri: _nullishCoalesce(resource2.uri, () => ( request.params.uri))
|
|
1472
1473
|
}))
|
|
1473
1474
|
};
|
|
1474
1475
|
}
|
|
@@ -1879,6 +1880,19 @@ function matchUriTemplate(template, uri) {
|
|
|
1879
1880
|
if (!match) {
|
|
1880
1881
|
return void 0;
|
|
1881
1882
|
}
|
|
1883
|
+
const scalarNames = new Set(template.varNames);
|
|
1884
|
+
for (const [expression] of template.template.matchAll(/\{[^}]*\}/g)) {
|
|
1885
|
+
if (/^\{[?&]/.test(expression) || expression.includes("*")) {
|
|
1886
|
+
for (const name of _uritemplates2.default.call(void 0, expression).varNames) {
|
|
1887
|
+
scalarNames.delete(name);
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
for (const [name, value] of Object.entries(match)) {
|
|
1892
|
+
if (scalarNames.has(name) && Array.isArray(value)) {
|
|
1893
|
+
match[name] = value.join(",");
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1882
1896
|
const checksQuery = !/\{[?&]/.test(template.template);
|
|
1883
1897
|
const checksFragment = !template.template.includes("{#");
|
|
1884
1898
|
const shape = (value) => [
|
|
@@ -1900,15 +1914,20 @@ function normalizePath(path) {
|
|
|
1900
1914
|
return path.startsWith("/") ? path : `/${path}`;
|
|
1901
1915
|
}
|
|
1902
1916
|
function parseBasicAuthHeader(authHeader) {
|
|
1903
|
-
const basicMatch = _optionalChain([authHeader, 'optionalAccess', _66 => _66.match, 'call', _67 => _67(/^Basic\s+(
|
|
1917
|
+
const basicMatch = _optionalChain([authHeader, 'optionalAccess', _66 => _66.match, 'call', _67 => _67(/^Basic\s+(.*)$/i)]);
|
|
1904
1918
|
if (!basicMatch) return null;
|
|
1919
|
+
const credentials = Buffer.from(basicMatch[1].trim(), "base64").toString(
|
|
1920
|
+
"utf-8"
|
|
1921
|
+
);
|
|
1922
|
+
const separator = credentials.indexOf(":");
|
|
1923
|
+
if (separator <= 0) return "malformed";
|
|
1905
1924
|
try {
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1925
|
+
return {
|
|
1926
|
+
clientId: decodeURIComponent(credentials.slice(0, separator)),
|
|
1927
|
+
clientSecret: decodeURIComponent(credentials.slice(separator + 1))
|
|
1928
|
+
};
|
|
1910
1929
|
} catch (e6) {
|
|
1911
|
-
return
|
|
1930
|
+
return "malformed";
|
|
1912
1931
|
}
|
|
1913
1932
|
}
|
|
1914
1933
|
function parseBooleanSetting(value, source) {
|
|
@@ -1957,6 +1976,10 @@ var OAUTH_CREDENTIAL_RESPONSE_HEADERS = {
|
|
|
1957
1976
|
"Content-Type": "application/json",
|
|
1958
1977
|
Pragma: "no-cache"
|
|
1959
1978
|
};
|
|
1979
|
+
var OAUTH_INVALID_CLIENT_RESPONSE_HEADERS = {
|
|
1980
|
+
...OAUTH_CREDENTIAL_RESPONSE_HEADERS,
|
|
1981
|
+
"WWW-Authenticate": 'Basic realm="oauth", charset="UTF-8"'
|
|
1982
|
+
};
|
|
1960
1983
|
function stripBasePath(path, basePath) {
|
|
1961
1984
|
if (!basePath) {
|
|
1962
1985
|
return path;
|
|
@@ -3040,8 +3063,37 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
3040
3063
|
const basicAuth = parseBasicAuthHeader(
|
|
3041
3064
|
req.headers.authorization
|
|
3042
3065
|
);
|
|
3043
|
-
|
|
3044
|
-
|
|
3066
|
+
if (basicAuth === "malformed") {
|
|
3067
|
+
throw {
|
|
3068
|
+
toJSON: () => ({
|
|
3069
|
+
error: "invalid_client",
|
|
3070
|
+
error_description: "Malformed Basic Authorization header"
|
|
3071
|
+
})
|
|
3072
|
+
};
|
|
3073
|
+
}
|
|
3074
|
+
if (basicAuth) {
|
|
3075
|
+
if (params.has("client_secret")) {
|
|
3076
|
+
throw {
|
|
3077
|
+
statusCode: 400,
|
|
3078
|
+
toJSON: () => ({
|
|
3079
|
+
error: "invalid_request",
|
|
3080
|
+
error_description: "Send client credentials in the Authorization header or the request body, not both"
|
|
3081
|
+
})
|
|
3082
|
+
};
|
|
3083
|
+
}
|
|
3084
|
+
const bodyClientId = params.get("client_id");
|
|
3085
|
+
if (bodyClientId !== null && bodyClientId !== basicAuth.clientId) {
|
|
3086
|
+
throw {
|
|
3087
|
+
statusCode: 400,
|
|
3088
|
+
toJSON: () => ({
|
|
3089
|
+
error: "invalid_request",
|
|
3090
|
+
error_description: "client_id in the request body does not match the Authorization header"
|
|
3091
|
+
})
|
|
3092
|
+
};
|
|
3093
|
+
}
|
|
3094
|
+
}
|
|
3095
|
+
const clientId = basicAuth ? basicAuth.clientId : params.get("client_id") || "";
|
|
3096
|
+
const clientSecret = basicAuth ? basicAuth.clientSecret : _nullishCoalesce(params.get("client_secret"), () => ( void 0));
|
|
3045
3097
|
let response;
|
|
3046
3098
|
if (grantType === "authorization_code") {
|
|
3047
3099
|
response = await oauthProxy.exchangeAuthorizationCode({
|
|
@@ -3068,14 +3120,15 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
3068
3120
|
}
|
|
3069
3121
|
res.writeHead(200, OAUTH_CREDENTIAL_RESPONSE_HEADERS).end(JSON.stringify(response));
|
|
3070
3122
|
} catch (error) {
|
|
3071
|
-
const
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3123
|
+
const body = _optionalChain([error, 'access', _84 => _84.toJSON, 'optionalCall', _85 => _85()]) || {
|
|
3124
|
+
error: "invalid_request"
|
|
3125
|
+
};
|
|
3126
|
+
if (body.error === "invalid_client") {
|
|
3127
|
+
res.writeHead(401, OAUTH_INVALID_CLIENT_RESPONSE_HEADERS).end(JSON.stringify(body));
|
|
3128
|
+
} else {
|
|
3129
|
+
const statusCode = error.statusCode || 400;
|
|
3130
|
+
res.writeHead(statusCode, OAUTH_CREDENTIAL_RESPONSE_HEADERS).end(JSON.stringify(body));
|
|
3131
|
+
}
|
|
3079
3132
|
}
|
|
3080
3133
|
resolve();
|
|
3081
3134
|
});
|
|
@@ -3097,7 +3150,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
3097
3150
|
* regardless (RFC 7235), so no config is needed just to get the header.
|
|
3098
3151
|
*/
|
|
3099
3152
|
#httpStreamOAuthConfig() {
|
|
3100
|
-
const resource = _optionalChain([this, 'access',
|
|
3153
|
+
const resource = _optionalChain([this, 'access', _86 => _86.#options, 'access', _87 => _87.oauth, 'optionalAccess', _88 => _88.enabled]) ? _optionalChain([this, 'access', _89 => _89.#options, 'access', _90 => _90.oauth, 'access', _91 => _91.protectedResource, 'optionalAccess', _92 => _92.resource]) : void 0;
|
|
3101
3154
|
if (!resource) {
|
|
3102
3155
|
return {};
|
|
3103
3156
|
}
|
|
@@ -3203,24 +3256,24 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
3203
3256
|
const envBasePath = process.env.FASTMCP_BASE_PATH;
|
|
3204
3257
|
const envStateless = process.env.FASTMCP_STATELESS;
|
|
3205
3258
|
const envHost = process.env.FASTMCP_HOST;
|
|
3206
|
-
const transportType = _optionalChain([overrides, 'optionalAccess',
|
|
3259
|
+
const transportType = _optionalChain([overrides, 'optionalAccess', _93 => _93.transportType]) || parseTransportSetting(transportArg, "--transport") || parseTransportSetting(envTransport, "FASTMCP_TRANSPORT") || "stdio";
|
|
3207
3260
|
if (transportType === "httpStream") {
|
|
3208
3261
|
const port = parseInt(
|
|
3209
|
-
_optionalChain([overrides, 'optionalAccess',
|
|
3262
|
+
_optionalChain([overrides, 'optionalAccess', _94 => _94.httpStream, 'optionalAccess', _95 => _95.port, 'optionalAccess', _96 => _96.toString, 'call', _97 => _97()]) || portArg || envPort || "8080"
|
|
3210
3263
|
);
|
|
3211
|
-
const host = _optionalChain([overrides, 'optionalAccess',
|
|
3212
|
-
const endpoint = _optionalChain([overrides, 'optionalAccess',
|
|
3264
|
+
const host = _optionalChain([overrides, 'optionalAccess', _98 => _98.httpStream, 'optionalAccess', _99 => _99.host]) || hostArg || envHost || "localhost";
|
|
3265
|
+
const endpoint = _optionalChain([overrides, 'optionalAccess', _100 => _100.httpStream, 'optionalAccess', _101 => _101.endpoint]) || endpointArg || envEndpoint || "/mcp";
|
|
3213
3266
|
const basePath = normalizeBasePath(
|
|
3214
|
-
_optionalChain([overrides, 'optionalAccess',
|
|
3267
|
+
_optionalChain([overrides, 'optionalAccess', _102 => _102.httpStream, 'optionalAccess', _103 => _103.basePath]) || basePathArg || envBasePath
|
|
3215
3268
|
);
|
|
3216
|
-
const enableJsonResponse = _optionalChain([overrides, 'optionalAccess',
|
|
3217
|
-
const stateless = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([overrides, 'optionalAccess',
|
|
3269
|
+
const enableJsonResponse = _optionalChain([overrides, 'optionalAccess', _104 => _104.httpStream, 'optionalAccess', _105 => _105.enableJsonResponse]) || false;
|
|
3270
|
+
const stateless = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([overrides, 'optionalAccess', _106 => _106.httpStream, 'optionalAccess', _107 => _107.stateless]), () => ( // A bare `--stateless` means `--stateless true`.
|
|
3218
3271
|
(statelessArg === "" ? true : parseBooleanSetting(statelessArg, "--stateless")))), () => ( parseBooleanSetting(envStateless, "FASTMCP_STATELESS"))), () => ( false));
|
|
3219
|
-
const cors = _optionalChain([overrides, 'optionalAccess',
|
|
3220
|
-
const eventStore = _optionalChain([overrides, 'optionalAccess',
|
|
3221
|
-
const sslCa = _optionalChain([overrides, 'optionalAccess',
|
|
3222
|
-
const sslCert = _optionalChain([overrides, 'optionalAccess',
|
|
3223
|
-
const sslKey = _optionalChain([overrides, 'optionalAccess',
|
|
3272
|
+
const cors = _optionalChain([overrides, 'optionalAccess', _108 => _108.httpStream, 'optionalAccess', _109 => _109.cors]);
|
|
3273
|
+
const eventStore = _optionalChain([overrides, 'optionalAccess', _110 => _110.httpStream, 'optionalAccess', _111 => _111.eventStore]);
|
|
3274
|
+
const sslCa = _optionalChain([overrides, 'optionalAccess', _112 => _112.httpStream, 'optionalAccess', _113 => _113.sslCa]);
|
|
3275
|
+
const sslCert = _optionalChain([overrides, 'optionalAccess', _114 => _114.httpStream, 'optionalAccess', _115 => _115.sslCert]);
|
|
3276
|
+
const sslKey = _optionalChain([overrides, 'optionalAccess', _116 => _116.httpStream, 'optionalAccess', _117 => _117.sslKey]);
|
|
3224
3277
|
return {
|
|
3225
3278
|
httpStream: {
|
|
3226
3279
|
basePath,
|
|
@@ -3312,7 +3365,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
3312
3365
|
*/
|
|
3313
3366
|
#useEndpointAsResource(endpoint) {
|
|
3314
3367
|
const oauth = this.#options.oauth;
|
|
3315
|
-
if (this.#providerResourceBase === void 0 || !_optionalChain([oauth, 'optionalAccess',
|
|
3368
|
+
if (this.#providerResourceBase === void 0 || !_optionalChain([oauth, 'optionalAccess', _118 => _118.protectedResource]))
|
|
3316
3369
|
return;
|
|
3317
3370
|
this.#options = {
|
|
3318
3371
|
...this.#options,
|
|
@@ -3341,4 +3394,4 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
3341
3394
|
|
|
3342
3395
|
|
|
3343
3396
|
exports.DiscoveryDocumentCache = DiscoveryDocumentCache; exports.jsonSchemaAdapter = jsonSchemaAdapter; exports.MEDIA_FETCH_TIMEOUT_MS = MEDIA_FETCH_TIMEOUT_MS; exports.imageContent = imageContent; exports.audioContent = audioContent; exports.FastMCPError = FastMCPError; exports.SessionError = SessionError; exports.UnexpectedStateError = UnexpectedStateError; exports.UserError = UserError; exports.ServerState = ServerState; exports.FastMCPSession = FastMCPSession; exports.FastMCP = FastMCP;
|
|
3344
|
-
//# sourceMappingURL=chunk-
|
|
3397
|
+
//# sourceMappingURL=chunk-4P2GDM7W.cjs.map
|