-
Notifications
You must be signed in to change notification settings - Fork 1.7k
v2: limit public exports
#1680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v2: limit public exports
#1680
Changes from all commits
fa77d2e
d32bc9f
b2b1e72
7f8082b
7c3542e
25e73e6
7689c21
847eaf4
d49f7e2
1b23d33
434d914
4449c77
9468791
8980103
0318c95
37d1b4f
dd6c5ce
227bf4c
a8b1087
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,73 @@ | ||
| export * from './client/auth.js'; | ||
| export * from './client/authExtensions.js'; | ||
| export * from './client/client.js'; | ||
| export * from './client/crossAppAccess.js'; | ||
| export * from './client/middleware.js'; | ||
| export * from './client/sse.js'; | ||
| export * from './client/stdio.js'; | ||
| export * from './client/streamableHttp.js'; | ||
| export * from './client/websocket.js'; | ||
| // Public API for @modelcontextprotocol/client. | ||
| // | ||
| // This file defines the complete public surface. It consists of: | ||
| // - Package-specific exports: listed explicitly below (named imports) | ||
| // - Protocol-level types: re-exported from @modelcontextprotocol/core/public | ||
| // | ||
| // Any new export added here becomes public API. Use named exports, not wildcards. | ||
|
|
||
| export type { | ||
| AddClientAuthentication, | ||
| AuthProvider, | ||
| AuthResult, | ||
| ClientAuthMethod, | ||
| OAuthClientProvider, | ||
| OAuthDiscoveryState, | ||
| OAuthServerInfo | ||
| } from './client/auth.js'; | ||
| export { | ||
| auth, | ||
| buildDiscoveryUrls, | ||
| discoverAuthorizationServerMetadata, | ||
| discoverOAuthMetadata, | ||
| discoverOAuthProtectedResourceMetadata, | ||
| discoverOAuthServerInfo, | ||
| exchangeAuthorization, | ||
| extractResourceMetadataUrl, | ||
| extractWWWAuthenticateParams, | ||
| fetchToken, | ||
| isHttpsUrl, | ||
| parseErrorResponse, | ||
| prepareAuthorizationCodeRequest, | ||
| refreshAuthorization, | ||
| registerClient, | ||
| selectClientAuthMethod, | ||
| selectResourceURL, | ||
| startAuthorization, | ||
| UnauthorizedError | ||
| } from './client/auth.js'; | ||
| export type { | ||
| AssertionCallback, | ||
| ClientCredentialsProviderOptions, | ||
| CrossAppAccessContext, | ||
| CrossAppAccessProviderOptions, | ||
| PrivateKeyJwtProviderOptions, | ||
| StaticPrivateKeyJwtProviderOptions | ||
| } from './client/authExtensions.js'; | ||
| export { | ||
| ClientCredentialsProvider, | ||
| createPrivateKeyJwtAuth, | ||
| CrossAppAccessProvider, | ||
| PrivateKeyJwtProvider, | ||
| StaticPrivateKeyJwtProvider | ||
| } from './client/authExtensions.js'; | ||
| export type { ClientOptions } from './client/client.js'; | ||
| export { Client } from './client/client.js'; | ||
| export { getSupportedElicitationModes } from './client/client.js'; | ||
| export type { DiscoverAndRequestJwtAuthGrantOptions, JwtAuthGrantResult, RequestJwtAuthGrantOptions } from './client/crossAppAccess.js'; | ||
| export { discoverAndRequestJwtAuthGrant, exchangeJwtAuthGrant, requestJwtAuthorizationGrant } from './client/crossAppAccess.js'; | ||
| export type { LoggingOptions, Middleware, RequestLogger } from './client/middleware.js'; | ||
| export { applyMiddlewares, createMiddleware, withLogging, withOAuth } from './client/middleware.js'; | ||
| export type { SSEClientTransportOptions } from './client/sse.js'; | ||
| export { SSEClientTransport, SseError } from './client/sse.js'; | ||
| export type { StdioServerParameters } from './client/stdio.js'; | ||
| export { DEFAULT_INHERITED_ENV_VARS, getDefaultEnvironment, StdioClientTransport } from './client/stdio.js'; | ||
| export type { StartSSEOptions, StreamableHTTPClientTransportOptions, StreamableHTTPReconnectionOptions } from './client/streamableHttp.js'; | ||
| export { StreamableHTTPClientTransport } from './client/streamableHttp.js'; | ||
| export { WebSocketClientTransport } from './client/websocket.js'; | ||
|
|
||
| // experimental exports | ||
| export * from './experimental/index.js'; | ||
| export { ExperimentalClientTasks } from './experimental/tasks/client.js'; | ||
|
|
||
| // re-export shared types | ||
| export * from '@modelcontextprotocol/core'; | ||
| // re-export curated public API from core | ||
| export * from '@modelcontextprotocol/core/public'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Both Fix: add Extended reasoning...What the bug isBoth How it could be triggeredThis would be triggered during The PR author tested Addressing the refutationOne verifier argued this is not a real bug because: (1) the base tsconfig uses This is a reasonable argument. TypeScript's However, this fallback behavior depends on tsdown's DTS resolver ( ImpactIf the tsdown DTS resolver does NOT correctly fall through to exports-based resolution, Suggested fixAdd the missing path mapping to both tsdown configs: // packages/client/tsdown.config.ts (and packages/server/tsdown.config.ts)
dts: {
resolver: 'tsc',
compilerOptions: {
baseUrl: '.',
paths: {
- '@modelcontextprotocol/core': ['../core/src/index.ts']
+ '@modelcontextprotocol/core': ['../core/src/index.ts'],
+ '@modelcontextprotocol/core/public': ['../core/src/exports/public/index.ts']
}
}
},Step-by-step proof
|
||
Uh oh!
There was an error while loading. Please reload this page.