@nest-mcp/nestjs 2.0.0 → 2.1.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/CHANGELOG.md +33 -0
- package/dist/index.d.mts +24 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +18 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @nest-mcp/nestjs
|
|
2
2
|
|
|
3
|
+
## 2.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ba91202: Add host-managed sign-in to the OAuth authorization-server proxy, for hosts whose identity provider
|
|
8
|
+
cannot be an OAuth redirect target (a client-side identity SDK, a session-cookie login). Configure
|
|
9
|
+
`hostSignIn` instead of `upstream` on `McpOAuthProxy` (`oauth.proxy.hostSignIn` in Nest, a provider
|
|
10
|
+
with `getHostSignIn()`): the approved consent sends the browser to the host's own sign-in page, and
|
|
11
|
+
the host completes the transaction with `McpOAuthProxy.completeHostSignIn()` (or
|
|
12
|
+
`McpOAuthService.completeHostSignIn()`), which returns the proxy callback URL with a single-use
|
|
13
|
+
sign-in code bound to the transaction. The callback keeps every proxy invariant: it verifies the
|
|
14
|
+
transaction's session-binding cookie before consuming the transaction or the code, the transaction
|
|
15
|
+
must have been consented to, and two-tier PKCE, single-use codes and refresh-family revocation are
|
|
16
|
+
unchanged. `hostSignIn.subject: "verbatim"` puts the host's opaque account id in `sub` instead of a
|
|
17
|
+
pseudonym, and `hostSignIn.confirmAccount()` re-checks the account on every refresh (`false` revokes
|
|
18
|
+
the grant). Grants from a host sign-in hold no upstream tokens (`McpGrantRecord.upstream` is now
|
|
19
|
+
optional).
|
|
20
|
+
|
|
21
|
+
The default consent page's CSP now admits the consent post's redirect targets (the sign-in page or
|
|
22
|
+
upstream authorization endpoint, and the client's redirect URI) in `form-action`, which browsers
|
|
23
|
+
apply to redirects after a form submission; custom consent renderers receive them as
|
|
24
|
+
`McpConsentViewModel.navigationTargets`.
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [ba91202]
|
|
29
|
+
- @nest-mcp/auth@2.1.0
|
|
30
|
+
- @nest-mcp/client@2.1.0
|
|
31
|
+
- @nest-mcp/core@2.1.0
|
|
32
|
+
- @nest-mcp/gateway@2.1.0
|
|
33
|
+
- @nest-mcp/manager@2.1.0
|
|
34
|
+
- @nest-mcp/server@2.1.0
|
|
35
|
+
|
|
3
36
|
## 2.0.0
|
|
4
37
|
|
|
5
38
|
### Major Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -9,7 +9,7 @@ import { MaybePromise, McpAuthorizationDecision, McpAuthorizationPolicy, McpLife
|
|
|
9
9
|
import { AuthInfo, CreateMcpHandlerOptions, OAuthMetadata, OAuthTokenVerifier, ServerContext as ServerContext$1, ServerEventBus, ServerOptions, Tool as Tool$1, jsonSchemaValidator } from "@modelcontextprotocol/server";
|
|
10
10
|
import { DiscoveryService, MetadataScanner, Reflector } from "@nestjs/core";
|
|
11
11
|
import { McpClientRuntime } from "@nest-mcp/client";
|
|
12
|
-
import { McpConsentRenderer, McpFetchLike, McpOAuthClientResolver, McpOAuthProxy, McpOAuthProxyTtl, McpOAuthStore, McpTokenKeyRing, McpUpstreamAuthorizationServer, McpUpstreamSubjectResolver } from "@nest-mcp/auth";
|
|
12
|
+
import { McpConsentRenderer, McpFetchLike, McpHostSignInCompletion, McpHostSignInOptions, McpOAuthClientResolver, McpOAuthProxy, McpOAuthProxyTtl, McpOAuthStore, McpTokenKeyRing, McpUpstreamAuthorizationServer, McpUpstreamSubjectResolver } from "@nest-mcp/auth";
|
|
13
13
|
import { McpFetchHandler } from "@nest-mcp/server/auth";
|
|
14
14
|
//#region src/mcp-catalog-exposure.d.ts
|
|
15
15
|
declare const MCP_CATALOG_SEARCH_TOOL_NAME = "nest-mcp.catalog.search";
|
|
@@ -244,6 +244,14 @@ interface McpOAuthSecretProvider {
|
|
|
244
244
|
interface McpOAuthUpstreamProvider {
|
|
245
245
|
getUpstream(): McpUpstreamAuthorizationServer;
|
|
246
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* Supplies host-managed sign-in: the host's own sign-in page and account
|
|
249
|
+
* re-check, in place of an upstream IdP (see `McpHostSignInOptions`). The host
|
|
250
|
+
* completes each sign-in through `McpOAuthService.completeHostSignIn()`.
|
|
251
|
+
*/
|
|
252
|
+
interface McpOAuthHostSignInProvider {
|
|
253
|
+
getHostSignIn(): McpHostSignInOptions;
|
|
254
|
+
}
|
|
247
255
|
/** Supplies the consent screen. */
|
|
248
256
|
interface McpOAuthConsentProvider {
|
|
249
257
|
render: McpConsentRenderer;
|
|
@@ -272,7 +280,10 @@ interface McpNestOAuthProxyOptions {
|
|
|
272
280
|
readonly scopesSupported?: readonly string[];
|
|
273
281
|
readonly signingKeys: McpProviderToken<McpOAuthSigningKeyProvider>;
|
|
274
282
|
readonly secret: McpProviderToken<McpOAuthSecretProvider>;
|
|
275
|
-
|
|
283
|
+
/** The upstream IdP. Exactly one of `upstream` and `hostSignIn`. */
|
|
284
|
+
readonly upstream?: McpProviderToken<McpOAuthUpstreamProvider>;
|
|
285
|
+
/** Host-managed sign-in on the host's own page, for hosts without a redirectable IdP. */
|
|
286
|
+
readonly hostSignIn?: McpProviderToken<McpOAuthHostSignInProvider>;
|
|
276
287
|
/** Token/state storage. `McpOAuthStore` is itself the provider (structural). */
|
|
277
288
|
readonly stateStore: McpProviderToken<McpOAuthStore>;
|
|
278
289
|
readonly tokenStore?: McpProviderToken<McpOAuthStore>;
|
|
@@ -687,6 +698,16 @@ declare class McpOAuthService {
|
|
|
687
698
|
* `AuthInfo` (via its `gid` claim). Returns `undefined` when the server has
|
|
688
699
|
* no proxy, the token carries no grant id, or the grant has been revoked.
|
|
689
700
|
*/
|
|
701
|
+
/**
|
|
702
|
+
* Host-managed sign-in (`oauth.proxy.hostSignIn`): once the host has
|
|
703
|
+
* authenticated the user for a transaction, returns the proxy callback URL
|
|
704
|
+
* the browser must navigate to. Throws `McpHostSignInError` for an unknown,
|
|
705
|
+
* expired or unconsented transaction, and `McpModuleError` when the server
|
|
706
|
+
* has no proxy.
|
|
707
|
+
*/
|
|
708
|
+
completeHostSignIn(serverName: string, completion: McpHostSignInCompletion): Promise<{
|
|
709
|
+
readonly redirectTo: string;
|
|
710
|
+
}>;
|
|
690
711
|
upstreamTokens(serverName: string, authInfo: Readonly<AuthInfo>): Promise<{
|
|
691
712
|
readonly accessToken: string;
|
|
692
713
|
readonly refreshToken?: string;
|
|
@@ -712,5 +733,5 @@ declare class McpModule extends ConfigurableModuleClass {
|
|
|
712
733
|
*/
|
|
713
734
|
declare function createMcpHandlerPassthroughMiddleware(middleware: McpHandlerPassthroughMiddleware): McpHandlerMiddleware;
|
|
714
735
|
//#endregion
|
|
715
|
-
export { type CacheHint, type CallToolResult, type CompletableSchema, type CompleteCallback, type CompleteResourceTemplateCallback, type ElicitInputParams, type GetPromptResult, type Icon, type InputRequiredResult, type InputRequiredSpec, type InputResponseView, MCP_CATALOG_SCHEMAS_TOOL_NAME, MCP_CATALOG_SEARCH_TOOL_NAME, type McpAnonymousAccessPolicy, type McpAuthorizationDecision, McpCapabilitiesService, type McpCapabilityDescriptor, type McpCapabilityMutation, type McpCapabilityMutationKind, type McpCapabilityMutationObserver, type McpCapabilityMutationType, type McpCapabilityVisibility, type McpCapabilityVisibilityPolicy, type McpCatalogEagerExposure, type McpCatalogExposureKind, type McpCatalogExposurePolicy, type McpCatalogExposureResolverInput, type McpCatalogExposureStrategy, type McpCatalogLazyExposure, type McpCatalogNameSelector, type McpCatalogPredicateSelector, type McpCatalogReadonly, type McpCatalogSchemasResult, type McpCatalogSearchExposure, type McpCatalogSearchResult, type McpCatalogSearchResultTool, type McpCatalogTagSelector, type McpCatalogTool, type McpCatalogToolSelector, type McpClientAttributesResolverProvider, type McpClientBootstrapOptions, type McpClientClock, type McpClientConfiguratorProvider, type McpClientFetchMiddlewareProvider, type McpClientFetchProvider, type McpClientForRootAsyncOptions, type McpClientForRootOptions, type McpClientLifecycleErrorReporter, type McpClientMiddlewareProvider, McpClientModule, type McpClientModuleExtras, type McpClientModuleOptions, type McpClientOperationIdFactory, type McpClientPrincipalResolverProvider, type McpClientProgressObserver, type McpClientReconnectionSchedulerProvider, McpClientService, type McpCorsInput, type McpCorsOptions, type McpDynamicHandlerRegistration, type McpForRootAsyncOptions, type McpForRootOptions, type McpGatewayAuthorizationContextProvider, type McpGatewayClientProvider, type McpGatewayDiscoveryCacheProvider, type McpGatewayLifecycleObserverProvider, type McpGatewayMiddlewareProvider, type McpGatewayNameCodecProvider, type McpGatewayObserverErrorReporter, type McpGatewayPromptNameCodecProvider, type McpGatewayResourceTemplateUriCodecProvider, type McpGatewayResourceUriCodecProvider, type McpHandlerAuthorizationPolicy, type McpHandlerInvocationInput, type McpHandlerInvocationOutput, type McpHandlerInvocationOutputFor, type McpHandlerInvocationOutputMap, type McpHandlerLifecycleObserver, type McpHandlerMiddleware, type McpHandlerMiddlewareProvider, type McpHandlerOperationContext, type McpHandlerPassthroughMiddleware, McpHttpController, type McpHttpControllerClass, McpHttpControllerFor, type McpHttpDiscoveryRoutes, type McpHttpRoute, type McpHttpSecurityOptions, type McpHttpSecurityPolicy, McpModule, McpModuleError, type McpModuleErrorCode, type McpModuleExtras, type McpModuleOptions, type McpNestCatalogExposureOptions, type McpNestClientConnectOptions, type McpNestClientDefinition, type McpNestClientIdMetadataOptions, type McpNestClientLifecycleOptions, type McpNestClientOptions, type McpNestClientRuntimeOptions, type McpNestClientTransportDefinition, type McpNestCollaborators, type McpNestCorsOptions, type McpNestGatewayOptions, type McpNestGatewayProviderUpstream, type McpNestGatewayUpstream, type McpNestGatewayUpstreamDefinition, type McpNestHttpClientTransportDefinition, type McpNestOAuthMetadataOptions, type McpNestOAuthProxyOptions, type McpNestOAuthResourceOptions, type McpNestServerDefinition, type McpNestServerHttpOptions, type McpNestServerOAuthOptions, type McpNestServerOptions, type McpNestStdioClientTransportDefinition, type McpOAuthConsentProvider, McpOAuthController, type McpOAuthControllerClass, McpOAuthControllerFor, type McpOAuthFetchProvider, type McpOAuthSecretProvider, McpOAuthService, type McpOAuthSigningKeyProvider, type McpOAuthSubjectResolverProvider, type McpOAuthTokenVerifierProvider, type McpOAuthUpstreamProvider, type McpProviderToken, type McpRequestStateVerifier, McpRuntimeService, type McpServerBuildContext, type McpServerContributor, type McpServerErrorReporter, type McpServerLifecycleObserver, type McpServerMiddleware, type McpServerMiddlewareProvider, type McpServerPrincipal, type McpServerPrincipalClaims, type McpServerPrincipalClaimsProvider, type McpServerRuntimeObserverProvider, Prompt, type PromptCallback, type PromptMethodDecorator, type PromptOptions, type ReadResourceCallback, type ReadResourceResult, type ReadResourceTemplateCallback, type RequestStateCodec, type RequestStateCodecOptions, Resource, type ResourceMetadata, type ResourceMethodDecorator, type ResourceOptions, ResourceTemplate, type ServerContext, type StandardSchemaWithJSON, Targets, Tool, type ToolAnnotations, type ToolCallback, type ToolMethodDecorator, type ToolOptions, acceptedContent, allowMcpOperation, completable, createMcpHandlerPassthroughMiddleware, createRequestStateCodec, denyMcpOperation, fromJsonSchema, inputRequired, inputResponse, mcpCorsOptions };
|
|
736
|
+
export { type CacheHint, type CallToolResult, type CompletableSchema, type CompleteCallback, type CompleteResourceTemplateCallback, type ElicitInputParams, type GetPromptResult, type Icon, type InputRequiredResult, type InputRequiredSpec, type InputResponseView, MCP_CATALOG_SCHEMAS_TOOL_NAME, MCP_CATALOG_SEARCH_TOOL_NAME, type McpAnonymousAccessPolicy, type McpAuthorizationDecision, McpCapabilitiesService, type McpCapabilityDescriptor, type McpCapabilityMutation, type McpCapabilityMutationKind, type McpCapabilityMutationObserver, type McpCapabilityMutationType, type McpCapabilityVisibility, type McpCapabilityVisibilityPolicy, type McpCatalogEagerExposure, type McpCatalogExposureKind, type McpCatalogExposurePolicy, type McpCatalogExposureResolverInput, type McpCatalogExposureStrategy, type McpCatalogLazyExposure, type McpCatalogNameSelector, type McpCatalogPredicateSelector, type McpCatalogReadonly, type McpCatalogSchemasResult, type McpCatalogSearchExposure, type McpCatalogSearchResult, type McpCatalogSearchResultTool, type McpCatalogTagSelector, type McpCatalogTool, type McpCatalogToolSelector, type McpClientAttributesResolverProvider, type McpClientBootstrapOptions, type McpClientClock, type McpClientConfiguratorProvider, type McpClientFetchMiddlewareProvider, type McpClientFetchProvider, type McpClientForRootAsyncOptions, type McpClientForRootOptions, type McpClientLifecycleErrorReporter, type McpClientMiddlewareProvider, McpClientModule, type McpClientModuleExtras, type McpClientModuleOptions, type McpClientOperationIdFactory, type McpClientPrincipalResolverProvider, type McpClientProgressObserver, type McpClientReconnectionSchedulerProvider, McpClientService, type McpCorsInput, type McpCorsOptions, type McpDynamicHandlerRegistration, type McpForRootAsyncOptions, type McpForRootOptions, type McpGatewayAuthorizationContextProvider, type McpGatewayClientProvider, type McpGatewayDiscoveryCacheProvider, type McpGatewayLifecycleObserverProvider, type McpGatewayMiddlewareProvider, type McpGatewayNameCodecProvider, type McpGatewayObserverErrorReporter, type McpGatewayPromptNameCodecProvider, type McpGatewayResourceTemplateUriCodecProvider, type McpGatewayResourceUriCodecProvider, type McpHandlerAuthorizationPolicy, type McpHandlerInvocationInput, type McpHandlerInvocationOutput, type McpHandlerInvocationOutputFor, type McpHandlerInvocationOutputMap, type McpHandlerLifecycleObserver, type McpHandlerMiddleware, type McpHandlerMiddlewareProvider, type McpHandlerOperationContext, type McpHandlerPassthroughMiddleware, McpHttpController, type McpHttpControllerClass, McpHttpControllerFor, type McpHttpDiscoveryRoutes, type McpHttpRoute, type McpHttpSecurityOptions, type McpHttpSecurityPolicy, McpModule, McpModuleError, type McpModuleErrorCode, type McpModuleExtras, type McpModuleOptions, type McpNestCatalogExposureOptions, type McpNestClientConnectOptions, type McpNestClientDefinition, type McpNestClientIdMetadataOptions, type McpNestClientLifecycleOptions, type McpNestClientOptions, type McpNestClientRuntimeOptions, type McpNestClientTransportDefinition, type McpNestCollaborators, type McpNestCorsOptions, type McpNestGatewayOptions, type McpNestGatewayProviderUpstream, type McpNestGatewayUpstream, type McpNestGatewayUpstreamDefinition, type McpNestHttpClientTransportDefinition, type McpNestOAuthMetadataOptions, type McpNestOAuthProxyOptions, type McpNestOAuthResourceOptions, type McpNestServerDefinition, type McpNestServerHttpOptions, type McpNestServerOAuthOptions, type McpNestServerOptions, type McpNestStdioClientTransportDefinition, type McpOAuthConsentProvider, McpOAuthController, type McpOAuthControllerClass, McpOAuthControllerFor, type McpOAuthFetchProvider, type McpOAuthHostSignInProvider, type McpOAuthSecretProvider, McpOAuthService, type McpOAuthSigningKeyProvider, type McpOAuthSubjectResolverProvider, type McpOAuthTokenVerifierProvider, type McpOAuthUpstreamProvider, type McpProviderToken, type McpRequestStateVerifier, McpRuntimeService, type McpServerBuildContext, type McpServerContributor, type McpServerErrorReporter, type McpServerLifecycleObserver, type McpServerMiddleware, type McpServerMiddlewareProvider, type McpServerPrincipal, type McpServerPrincipalClaims, type McpServerPrincipalClaimsProvider, type McpServerRuntimeObserverProvider, Prompt, type PromptCallback, type PromptMethodDecorator, type PromptOptions, type ReadResourceCallback, type ReadResourceResult, type ReadResourceTemplateCallback, type RequestStateCodec, type RequestStateCodecOptions, Resource, type ResourceMetadata, type ResourceMethodDecorator, type ResourceOptions, ResourceTemplate, type ServerContext, type StandardSchemaWithJSON, Targets, Tool, type ToolAnnotations, type ToolCallback, type ToolMethodDecorator, type ToolOptions, acceptedContent, allowMcpOperation, completable, createMcpHandlerPassthroughMiddleware, createRequestStateCodec, denyMcpOperation, fromJsonSchema, inputRequired, inputResponse, mcpCorsOptions };
|
|
716
737
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/mcp-catalog-exposure.ts","../src/mcp-capability.types.ts","../src/decorators/mcp-handler.decorators.ts","../src/http/mcp-http-route.types.ts","../src/oauth/mcp-oauth.types.ts","../src/server/mcp-server.types.ts","../src/mcp.types.ts","../src/discovery/mcp-handler.registry.ts","../src/mcp-capabilities.service.ts","../src/discovery/mcp-handler.explorer.ts","../src/mcp-runtime.service.ts","../src/mcp-http.controller.ts","../src/mcp-cors.ts","../src/oauth/mcp-oauth.controller.ts","../src/oauth/mcp-oauth.service.ts","../src/mcp.module-definition.ts","../src/mcp.module.ts","../src/mcp-handler.middleware.ts"],"mappings":";;;;;;;;;;;;;;cAIa;cACA;KAED;;KAGA,mBAAmB,SAAS,+CACzB,eAAe,QAAQ,mBAAmB,MAAM,aAC5D,mCACa,aAAa,QAAQ,mBAAmB,MAAM,WAC1D;;UAGa;WACP,MAAM,mBAAmB;WACzB;;UAGO;WACP;WACA;;UAGO;WACP;WACA;;UAGO;WACP;WACA,YAAY,MAAM;;KAGhB,yBACX,yBAAyB,wBAAwB;UAEjC;WACP;;UAGO;WACP;;WAEA,iBAAiB;;WAEjB,kBAAkB,SAAS;;UAGpB;WACP;;WAEA,iBAAiB;;KAGf,2BACX,aAAa,yBAAyB,0BACnC,QACH,0BAA0B,2BAA2B;WAC1C,MAAM;;;UAID;WACP;WACA,KAAK;WACL,YAAY,SAAS;WACrB,SAAS;WACT,gBAAgB;;KAGd,2BACX,iBAAiB,6BAA6B,+BAC1C,OAAO,oCAAoC,aAAa;;UAG5C,yBAChB,iBAAiB,6BAA6B;EAE9C,QAAQ,OAAO,kCAAkC,aAAa;;;UAI9C;WACP,UAAU;;UAGH;WACP;WACA;WACA;WACA;;UAGO;WACP,gBAAgB;WAChB;;UAGO;WACP,gBAAgB,mBAAmB;;;;;UClG5B;EAChB,UAAU,SAAS,SAAS,2BAAyB;;;KAI1C,oCAAoC,eAAe;;UAG9C,8BAA8B;WACrC;;EAET,QAAQ,SAAS;;EAEjB;;KAGW;KACA;;UAGK;WACP,MAAM;WACN,MAAM;WACN;WACA;;KAGE,iCAAiC,UAAU,0BAA0B;;UAGhE;WACP,MAAM;WACN;WACA;WACA;;;;UCvBA;;WAEA;;WAEA,aAAa;;UAGN,YAChB,oBAAoB,uCAAqC,8CAChD;WACA;WACA;WACA;WACA,cAAc;WACd,eAAe;WACf,cAAc;WACd,QAAQ;WACR,QAAQ;;WAER;;UAGO,gBAChB,qBAAqB,8BAA4B,4BACxC;WACA;WACA,KAAK;WACL;WACA;WACA;WACA;WACA,QAAQ;WACR,cAAc;WACd,QAAQ;WACR,YAAY;;UAGL,cAChB,mBAAmB,uCAAqC,8CAC/C;WACA;WACA;WACA;WACA,aAAa;WACb,QAAQ;WACR,QAAQ;;UAGD;WACP;WACA,SAAS;;UAGF;WACP;WACA,SAAS;;UAGF;WACP;WACA,SAAS;;KAGP,oBACX,wBAAwB,4BAA4B;;KAGzC,qBAAqB,oBAAoB,gBAAgB,iBACpE,gBACA,8BACA,YAAY,wBAAwB;KAGzB,oBAAoB,oBAAoB,wCACnD,qBAAqB,eAAa;KAEvB,sBAAsB,mBAAmB,wCACpD,qBAAqB,iBAAe;KAEzB,wBAAwB,qBAAqB,sBAAoB,qBAC5E,qBAAqB,yBAAuB;iBAG7B,WAAW,oBAAoB,kDAC9C,SAAS,YAAY,eACnB,oBAAoB;iBAIP,eAAe,qBAAqB,oBACnD,SAAS,gBAAgB,OACvB,wBAAwB;iBAIX,aAAa,mBAAmB,kDAC/C,SAAS,cAAc,cACrB,sBAAsB;;iBAKT,WAAW,8CAA8C;;;;UCnHxD;;WAEP;;WAEA;;WAEA,sBAAsB;;;UAIf;WACP;;WAEA;WACA,UAAU;;WAEV,sBAAsB;;WAEtB,YAAY;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/mcp-catalog-exposure.ts","../src/mcp-capability.types.ts","../src/decorators/mcp-handler.decorators.ts","../src/http/mcp-http-route.types.ts","../src/oauth/mcp-oauth.types.ts","../src/server/mcp-server.types.ts","../src/mcp.types.ts","../src/discovery/mcp-handler.registry.ts","../src/mcp-capabilities.service.ts","../src/discovery/mcp-handler.explorer.ts","../src/mcp-runtime.service.ts","../src/mcp-http.controller.ts","../src/mcp-cors.ts","../src/oauth/mcp-oauth.controller.ts","../src/oauth/mcp-oauth.service.ts","../src/mcp.module-definition.ts","../src/mcp.module.ts","../src/mcp-handler.middleware.ts"],"mappings":";;;;;;;;;;;;;;cAIa;cACA;KAED;;KAGA,mBAAmB,SAAS,+CACzB,eAAe,QAAQ,mBAAmB,MAAM,aAC5D,mCACa,aAAa,QAAQ,mBAAmB,MAAM,WAC1D;;UAGa;WACP,MAAM,mBAAmB;WACzB;;UAGO;WACP;WACA;;UAGO;WACP;WACA;;UAGO;WACP;WACA,YAAY,MAAM;;KAGhB,yBACX,yBAAyB,wBAAwB;UAEjC;WACP;;UAGO;WACP;;WAEA,iBAAiB;;WAEjB,kBAAkB,SAAS;;UAGpB;WACP;;WAEA,iBAAiB;;KAGf,2BACX,aAAa,yBAAyB,0BACnC,QACH,0BAA0B,2BAA2B;WAC1C,MAAM;;;UAID;WACP;WACA,KAAK;WACL,YAAY,SAAS;WACrB,SAAS;WACT,gBAAgB;;KAGd,2BACX,iBAAiB,6BAA6B,+BAC1C,OAAO,oCAAoC,aAAa;;UAG5C,yBAChB,iBAAiB,6BAA6B;EAE9C,QAAQ,OAAO,kCAAkC,aAAa;;;UAI9C;WACP,UAAU;;UAGH;WACP;WACA;WACA;WACA;;UAGO;WACP,gBAAgB;WAChB;;UAGO;WACP,gBAAgB,mBAAmB;;;;;UClG5B;EAChB,UAAU,SAAS,SAAS,2BAAyB;;;KAI1C,oCAAoC,eAAe;;UAG9C,8BAA8B;WACrC;;EAET,QAAQ,SAAS;;EAEjB;;KAGW;KACA;;UAGK;WACP,MAAM;WACN,MAAM;WACN;WACA;;KAGE,iCAAiC,UAAU,0BAA0B;;UAGhE;WACP,MAAM;WACN;WACA;WACA;;;;UCvBA;;WAEA;;WAEA,aAAa;;UAGN,YAChB,oBAAoB,uCAAqC,8CAChD;WACA;WACA;WACA;WACA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;;;;YASvC,qBAAqB,SAAS,mBAAmB;;YAKjD,yBAAyB,SAAS;;;;;;YASlC,0BAA0B;;;;;;;;;;;;;;;;;iBAwCrB,qBAAqB,qBAAqB;;;UC1HzC;;WAEP;;WAEA;WACA;WACA;WACA;;;;;;UAOO;EAChB;EACA;EACA;EACA;EACA;EACA;;;;;;;;;;iBAWe,eAAe,OAAO,eAAe;;;;KC3BzC,wCACX,gBAAgB,sBACZ;;;;;;;;;;uBAaiB;;mBACmC;EAAxD,YAAwD,gBAAgB;gBAE1D;EAOR,4BAAwD,oBAAoB;EAK5E,KAAiC,oBAAoB;EAKrD,0BAAsD,oBAAoB;EAK1E,UACE,kBACqB,oBAC1B;EAMG,QACE,kBACqB,oBAC1B;EAMG,SACE,kBACqB,oBAC1B;EAMG,MACE,kBACqB,oBAC1B;;;;;;;;;;;;;;iBAyCY,sBAAsB,qBAAqB;;;;;;;;cC/G9C;mBACiB;EAA7B,YAA6B,gBAAgB;;;;;;;;;;;;;EAcvC,mBACL,oBACA,YAAY,0BACV;aAAmB;;EAWhB,eACL,oBACA,UAAU,SAAS,YACjB;aACW;aAA8B;aAAgC;;;;;cCvC9D,kDAAuB,sBAAA,iDAAA,kBAAE,cAAY,mBAAA,QAAA,kBAAE,6CAAkB,+BAAA,wCAAA,QAAA;KAwB5D,2BAA2B;KAC3B,gCAAgC;;;cCF/B,kBAAkB;SACd,QAAQ,UAAS,oBAAyB;SAI1C,aAAa,SAAS,yBAAyB;;;;;;;;iBCpBhD,sCACf,YAAY,kCACV"}
|
package/dist/index.mjs
CHANGED
|
@@ -1338,7 +1338,9 @@ function resolveProxy(options, providers, serverName) {
|
|
|
1338
1338
|
if (!Array.isArray(proxyOptions.resources) || proxyOptions.resources.length === 0 || typeof primaryResource !== "string") throw new McpModuleError("INVALID_OPTIONS", `MCP server "${serverName}" oauth.proxy.resources must list at least one resource URL.`);
|
|
1339
1339
|
const signingKeys = requireMethodProvider(providers, proxyOptions.signingKeys, "getSigningKeys").getSigningKeys();
|
|
1340
1340
|
const masterSecret = requireMethodProvider(providers, proxyOptions.secret, "getMasterSecret").getMasterSecret();
|
|
1341
|
-
|
|
1341
|
+
if (proxyOptions.upstream === void 0 === (proxyOptions.hostSignIn === void 0)) throw new McpModuleError("INVALID_OPTIONS", `MCP server "${serverName}" oauth.proxy must configure exactly one of upstream and hostSignIn.`);
|
|
1342
|
+
const upstreamConfig = proxyOptions.upstream === void 0 ? void 0 : requireMethodProvider(providers, proxyOptions.upstream, "getUpstream").getUpstream();
|
|
1343
|
+
const hostSignIn = proxyOptions.hostSignIn === void 0 ? void 0 : requireMethodProvider(providers, proxyOptions.hostSignIn, "getHostSignIn").getHostSignIn();
|
|
1342
1344
|
const stateStore = requireMethodProvider(providers, proxyOptions.stateStore, "take");
|
|
1343
1345
|
const tokenStore = proxyOptions.tokenStore === void 0 ? void 0 : requireMethodProvider(providers, proxyOptions.tokenStore, "take");
|
|
1344
1346
|
const clientResolver = proxyOptions.clientResolver === void 0 ? void 0 : requireMethodProvider(providers, proxyOptions.clientResolver, "resolveClient");
|
|
@@ -1351,7 +1353,7 @@ function resolveProxy(options, providers, serverName) {
|
|
|
1351
1353
|
...proxyOptions.cimd.maxDocumentBytes === void 0 ? {} : { maxDocumentBytes: proxyOptions.cimd.maxDocumentBytes },
|
|
1352
1354
|
...proxyOptions.cimd.fetchTimeoutMs === void 0 ? {} : { fetchTimeoutMs: proxyOptions.cimd.fetchTimeoutMs }
|
|
1353
1355
|
}) : void 0;
|
|
1354
|
-
const upstream = new McpUpstreamAdapter({
|
|
1356
|
+
const upstream = upstreamConfig === void 0 ? void 0 : new McpUpstreamAdapter({
|
|
1355
1357
|
upstream: upstreamConfig,
|
|
1356
1358
|
...guardedFetch === void 0 ? {} : { fetch: guardedFetch }
|
|
1357
1359
|
});
|
|
@@ -1360,7 +1362,8 @@ function resolveProxy(options, providers, serverName) {
|
|
|
1360
1362
|
resources: proxyOptions.resources,
|
|
1361
1363
|
signingKeys,
|
|
1362
1364
|
secrets: new McpOAuthSecretKeyring(masterSecret),
|
|
1363
|
-
upstream,
|
|
1365
|
+
...upstream === void 0 ? {} : { upstream },
|
|
1366
|
+
...hostSignIn === void 0 ? {} : { hostSignIn },
|
|
1364
1367
|
stateStore,
|
|
1365
1368
|
...proxyOptions.basePath === void 0 ? {} : { basePath: proxyOptions.basePath },
|
|
1366
1369
|
...proxyOptions.scopesSupported === void 0 ? {} : { scopesSupported: proxyOptions.scopesSupported },
|
|
@@ -2053,6 +2056,18 @@ let McpOAuthService = class McpOAuthService {
|
|
|
2053
2056
|
* `AuthInfo` (via its `gid` claim). Returns `undefined` when the server has
|
|
2054
2057
|
* no proxy, the token carries no grant id, or the grant has been revoked.
|
|
2055
2058
|
*/
|
|
2059
|
+
/**
|
|
2060
|
+
* Host-managed sign-in (`oauth.proxy.hostSignIn`): once the host has
|
|
2061
|
+
* authenticated the user for a transaction, returns the proxy callback URL
|
|
2062
|
+
* the browser must navigate to. Throws `McpHostSignInError` for an unknown,
|
|
2063
|
+
* expired or unconsented transaction, and `McpModuleError` when the server
|
|
2064
|
+
* has no proxy.
|
|
2065
|
+
*/
|
|
2066
|
+
async completeHostSignIn(serverName, completion) {
|
|
2067
|
+
const proxy = this.runtimeService.oauthProxy(serverName);
|
|
2068
|
+
if (proxy === void 0) throw new McpModuleError("INVALID_OPTIONS", `MCP server "${serverName}" has no oauth.proxy configured.`);
|
|
2069
|
+
return proxy.completeHostSignIn(completion);
|
|
2070
|
+
}
|
|
2056
2071
|
async upstreamTokens(serverName, authInfo) {
|
|
2057
2072
|
const proxy = this.runtimeService.oauthProxy(serverName);
|
|
2058
2073
|
if (proxy === void 0) return void 0;
|