@vitemcp/server 1.9.0 → 1.9.2

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.
Files changed (41) hide show
  1. package/README.md +7 -2
  2. package/dist/{OAuthProvider-DvW1SyKx.d.cts → OAuthProvider-BaPwgWny.d.cts} +12 -2
  3. package/dist/{OAuthProvider-DvW1SyKx.d.ts → OAuthProvider-BaPwgWny.d.ts} +12 -2
  4. package/dist/ViteMCP.cjs +4 -3
  5. package/dist/ViteMCP.cjs.map +1 -1
  6. package/dist/ViteMCP.d.cts +2 -2
  7. package/dist/ViteMCP.d.ts +2 -2
  8. package/dist/ViteMCP.js +3 -2
  9. package/dist/auth/index.cjs +2 -2
  10. package/dist/auth/index.d.cts +2 -2
  11. package/dist/auth/index.d.ts +2 -2
  12. package/dist/auth/index.js +1 -1
  13. package/dist/chunk-4FH73ERY.js +64 -0
  14. package/dist/chunk-4FH73ERY.js.map +1 -0
  15. package/dist/{chunk-UFLW3ODH.js → chunk-DSDLJS6O.js} +107 -130
  16. package/dist/chunk-DSDLJS6O.js.map +1 -0
  17. package/dist/chunk-FEM6LNS4.cjs +64 -0
  18. package/dist/chunk-FEM6LNS4.cjs.map +1 -0
  19. package/dist/{chunk-HWSTK2ZH.js → chunk-KKSDTVEW.js} +79 -18
  20. package/dist/chunk-KKSDTVEW.js.map +1 -0
  21. package/dist/{chunk-UPZH53RX.cjs → chunk-RQEMPJ2L.cjs} +109 -132
  22. package/dist/chunk-RQEMPJ2L.cjs.map +1 -0
  23. package/dist/{chunk-KFOTRFZS.cjs → chunk-SHPKRGNY.cjs} +93 -32
  24. package/dist/chunk-SHPKRGNY.cjs.map +1 -0
  25. package/dist/edge/index.cjs +128 -21
  26. package/dist/edge/index.cjs.map +1 -1
  27. package/dist/edge/index.d.cts +6 -0
  28. package/dist/edge/index.d.ts +6 -0
  29. package/dist/edge/index.js +127 -20
  30. package/dist/edge/index.js.map +1 -1
  31. package/dist/openapi/index.cjs +69 -29
  32. package/dist/openapi/index.cjs.map +1 -1
  33. package/dist/openapi/index.d.cts +1 -1
  34. package/dist/openapi/index.d.ts +1 -1
  35. package/dist/openapi/index.js +61 -21
  36. package/dist/openapi/index.js.map +1 -1
  37. package/package.json +1 -1
  38. package/dist/chunk-HWSTK2ZH.js.map +0 -1
  39. package/dist/chunk-KFOTRFZS.cjs.map +0 -1
  40. package/dist/chunk-UFLW3ODH.js.map +0 -1
  41. package/dist/chunk-UPZH53RX.cjs.map +0 -1
package/README.md CHANGED
@@ -1134,7 +1134,7 @@ This configuration automatically exposes OAuth discovery endpoints:
1134
1134
 
1135
1135
  Clients discover protected resource metadata using the following search order:
1136
1136
 
1137
- 1. **WWW-Authenticate header** - Primary method (handled automatically by mcp-proxy)
1137
+ 1. **WWW-Authenticate header** - Primary method. The `401` challenge carries `resource_metadata`, formed from the configured `resource`, so it names the public address even behind a proxy that terminates TLS
1138
1138
  2. **Sub-path well-known** - `/.well-known/oauth-protected-resource<endpoint>` (e.g., `/.well-known/oauth-protected-resource/mcp`)
1139
1139
  3. **Root well-known** - `/.well-known/oauth-protected-resource` (fallback)
1140
1140
 
@@ -1390,6 +1390,9 @@ document looks like this:
1390
1390
  }
1391
1391
  ```
1392
1392
 
1393
+ Such a client is a public one — it holds no secret — so the proxy requires
1394
+ `S256` PKCE from it, whatever `allowPlainPkce` is set to.
1395
+
1393
1396
  > [!WARNING]
1394
1397
  >
1395
1398
  > Resolving a URL-formatted `client_id` means **your server fetches a URL an
@@ -2009,6 +2012,8 @@ When running on edge runtimes:
2009
2012
  - **No filesystem access**: Use fetch APIs for external data
2010
2013
  - **V8 Isolates**: Fast cold starts and efficient resource usage
2011
2014
  - **Global deployment**: Automatic distribution to edge locations
2015
+ - **Request size**: The MCP endpoint refuses a body over `maxBodySize` (1 MiB by default, as on Node). Routes added through `getApp()` are not covered
2016
+ - **Schema libraries**: Zod, ArkType and Valibot describe a tool as they do on Node. Any other library that carries no JSON Schema of its own is not converted here: a tool written in one is left out and reported through the logger
2012
2017
 
2013
2018
  #### Custom Routes on Edge
2014
2019
 
@@ -2137,7 +2142,7 @@ Follow the guide https://modelcontextprotocol.io/quickstart/user and add the fol
2137
2142
 
2138
2143
  ### How to run ViteMCP behind a proxy?
2139
2144
 
2140
- Refer to this [issue](https://github.com/vitemcp/server/issues/25#issuecomment-3004568732) for an example of using ViteMCP with `express` and `http-proxy-middleware`.
2145
+ Refer to this [issue](https://github.com/punkpeye/fastmcp/issues/25#issuecomment-3004568732) for an example with `express` and `http-proxy-middleware`. It was written for FastMCP, which ViteMCP continues.
2141
2146
 
2142
2147
  ## Showcase
2143
2148
 
@@ -235,11 +235,13 @@ interface OAuthProxyConfig {
235
235
  *
236
236
  * Left as an escape hatch for the rare client that genuinely cannot hash.
237
237
  * Enabling it re-advertises `plain` in the authorization server metadata.
238
+ * It does not reach Client ID Metadata Document clients, which are held to
239
+ * S256 either way.
238
240
  */
239
241
  allowPlainPkce?: boolean;
240
242
  /** Authorization code TTL in seconds (default: 300) */
241
243
  authorizationCodeTtl?: number;
242
- /** Base URL of this proxy server */
244
+ /** Base URL of this proxy server. A trailing slash is ignored. */
243
245
  baseUrl: string;
244
246
  /**
245
247
  * Client ID Metadata Document support (the mechanism that supersedes DCR).
@@ -376,6 +378,14 @@ interface ProxyDCRClient {
376
378
  redirectUris: string[];
377
379
  /** Client registration timestamp */
378
380
  registeredAt: Date;
381
+ /**
382
+ * How this client came to be known, where that changes the rules applied to
383
+ * it. `"cimd"` marks a public client resolved from a Client ID Metadata
384
+ * Document: it holds no secret and its identity is a URL anyone can name, so
385
+ * the proxy requires S256 PKCE of it. Absent for a Dynamic Client
386
+ * Registration.
387
+ */
388
+ source?: "cimd";
379
389
  }
380
390
  /**
381
391
  * OAuth refresh token request
@@ -806,7 +816,7 @@ interface AuthProviderConfig {
806
816
  * client that cannot hash. See `OAuthProxyConfig.allowPlainPkce` first.
807
817
  */
808
818
  allowPlainPkce?: boolean;
809
- /** Base URL where the MCP server is accessible */
819
+ /** Base URL where the MCP server is accessible. A trailing slash is ignored. */
810
820
  baseUrl: string;
811
821
  /** OAuth client ID */
812
822
  clientId: string;
@@ -235,11 +235,13 @@ interface OAuthProxyConfig {
235
235
  *
236
236
  * Left as an escape hatch for the rare client that genuinely cannot hash.
237
237
  * Enabling it re-advertises `plain` in the authorization server metadata.
238
+ * It does not reach Client ID Metadata Document clients, which are held to
239
+ * S256 either way.
238
240
  */
239
241
  allowPlainPkce?: boolean;
240
242
  /** Authorization code TTL in seconds (default: 300) */
241
243
  authorizationCodeTtl?: number;
242
- /** Base URL of this proxy server */
244
+ /** Base URL of this proxy server. A trailing slash is ignored. */
243
245
  baseUrl: string;
244
246
  /**
245
247
  * Client ID Metadata Document support (the mechanism that supersedes DCR).
@@ -376,6 +378,14 @@ interface ProxyDCRClient {
376
378
  redirectUris: string[];
377
379
  /** Client registration timestamp */
378
380
  registeredAt: Date;
381
+ /**
382
+ * How this client came to be known, where that changes the rules applied to
383
+ * it. `"cimd"` marks a public client resolved from a Client ID Metadata
384
+ * Document: it holds no secret and its identity is a URL anyone can name, so
385
+ * the proxy requires S256 PKCE of it. Absent for a Dynamic Client
386
+ * Registration.
387
+ */
388
+ source?: "cimd";
379
389
  }
380
390
  /**
381
391
  * OAuth refresh token request
@@ -806,7 +816,7 @@ interface AuthProviderConfig {
806
816
  * client that cannot hash. See `OAuthProxyConfig.allowPlainPkce` first.
807
817
  */
808
818
  allowPlainPkce?: boolean;
809
- /** Base URL where the MCP server is accessible */
819
+ /** Base URL where the MCP server is accessible. A trailing slash is ignored. */
810
820
  baseUrl: string;
811
821
  /** OAuth client ID */
812
822
  clientId: string;
package/dist/ViteMCP.cjs CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
 
12
12
 
13
- var _chunkUPZH53RXcjs = require('./chunk-UPZH53RX.cjs');
13
+ var _chunkRQEMPJ2Lcjs = require('./chunk-RQEMPJ2L.cjs');
14
14
 
15
15
 
16
16
 
@@ -25,7 +25,8 @@ var _chunkUPZH53RXcjs = require('./chunk-UPZH53RX.cjs');
25
25
 
26
26
 
27
27
 
28
- var _chunkKFOTRFZScjs = require('./chunk-KFOTRFZS.cjs');
28
+ var _chunkSHPKRGNYcjs = require('./chunk-SHPKRGNY.cjs');
29
+ require('./chunk-FEM6LNS4.cjs');
29
30
 
30
31
 
31
32
 
@@ -51,5 +52,5 @@ var _chunkKFOTRFZScjs = require('./chunk-KFOTRFZS.cjs');
51
52
 
52
53
 
53
54
 
54
- exports.AuthProvider = _chunkKFOTRFZScjs.AuthProvider; exports.AzureProvider = _chunkKFOTRFZScjs.AzureProvider; exports.DiscoveryDocumentCache = _chunkUPZH53RXcjs.DiscoveryDocumentCache; exports.GitHubProvider = _chunkKFOTRFZScjs.GitHubProvider; exports.GoogleProvider = _chunkKFOTRFZScjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunkUPZH53RXcjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunkKFOTRFZScjs.OAuthProvider; exports.OAuthProxy = _chunkKFOTRFZScjs.OAuthProxy; exports.OAuthProxyError = _chunkKFOTRFZScjs.OAuthProxyError; exports.ServerState = _chunkUPZH53RXcjs.ServerState; exports.UnexpectedStateError = _chunkUPZH53RXcjs.UnexpectedStateError; exports.UserError = _chunkUPZH53RXcjs.UserError; exports.ViteMCP = _chunkUPZH53RXcjs.ViteMCP; exports.ViteMCPError = _chunkUPZH53RXcjs.ViteMCPError; exports.audioContent = _chunkUPZH53RXcjs.audioContent; exports.delay = _chunkUPZH53RXcjs.delay; exports.getAuthSession = _chunkKFOTRFZScjs.getAuthSession; exports.imageContent = _chunkUPZH53RXcjs.imageContent; exports.jsonSchemaAdapter = _chunkUPZH53RXcjs.jsonSchemaAdapter; exports.requireAll = _chunkKFOTRFZScjs.requireAll; exports.requireAny = _chunkKFOTRFZScjs.requireAny; exports.requireAuth = _chunkKFOTRFZScjs.requireAuth; exports.requireRole = _chunkKFOTRFZScjs.requireRole; exports.requireScopes = _chunkKFOTRFZScjs.requireScopes;
55
+ exports.AuthProvider = _chunkSHPKRGNYcjs.AuthProvider; exports.AzureProvider = _chunkSHPKRGNYcjs.AzureProvider; exports.DiscoveryDocumentCache = _chunkRQEMPJ2Lcjs.DiscoveryDocumentCache; exports.GitHubProvider = _chunkSHPKRGNYcjs.GitHubProvider; exports.GoogleProvider = _chunkSHPKRGNYcjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunkRQEMPJ2Lcjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunkSHPKRGNYcjs.OAuthProvider; exports.OAuthProxy = _chunkSHPKRGNYcjs.OAuthProxy; exports.OAuthProxyError = _chunkSHPKRGNYcjs.OAuthProxyError; exports.ServerState = _chunkRQEMPJ2Lcjs.ServerState; exports.UnexpectedStateError = _chunkRQEMPJ2Lcjs.UnexpectedStateError; exports.UserError = _chunkRQEMPJ2Lcjs.UserError; exports.ViteMCP = _chunkRQEMPJ2Lcjs.ViteMCP; exports.ViteMCPError = _chunkRQEMPJ2Lcjs.ViteMCPError; exports.audioContent = _chunkRQEMPJ2Lcjs.audioContent; exports.delay = _chunkRQEMPJ2Lcjs.delay; exports.getAuthSession = _chunkSHPKRGNYcjs.getAuthSession; exports.imageContent = _chunkRQEMPJ2Lcjs.imageContent; exports.jsonSchemaAdapter = _chunkRQEMPJ2Lcjs.jsonSchemaAdapter; exports.requireAll = _chunkSHPKRGNYcjs.requireAll; exports.requireAny = _chunkSHPKRGNYcjs.requireAny; exports.requireAuth = _chunkSHPKRGNYcjs.requireAuth; exports.requireRole = _chunkSHPKRGNYcjs.requireRole; exports.requireScopes = _chunkSHPKRGNYcjs.requireScopes;
55
56
  //# sourceMappingURL=ViteMCP.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/server/server/dist/ViteMCP.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,i1CAAC","file":"/home/runner/work/server/server/dist/ViteMCP.cjs"}
1
+ {"version":3,"sources":["/home/runner/work/server/server/dist/ViteMCP.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,i1CAAC","file":"/home/runner/work/server/server/dist/ViteMCP.cjs"}
@@ -4,8 +4,8 @@ import { StandardSchemaV1 } from '@standard-schema/spec';
4
4
  import { Hono } from 'hono';
5
5
  import { cors } from 'hono/cors';
6
6
  export { setTimeout as delay } from 'timers/promises';
7
- import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-DvW1SyKx.cjs';
8
- 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, p as OAuthProxyError, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from './OAuthProvider-DvW1SyKx.cjs';
7
+ import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-BaPwgWny.cjs';
8
+ 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, p as OAuthProxyError, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from './OAuthProvider-BaPwgWny.cjs';
9
9
 
10
10
  declare class DiscoveryDocumentCache {
11
11
  #private;
package/dist/ViteMCP.d.ts CHANGED
@@ -4,8 +4,8 @@ import { StandardSchemaV1 } from '@standard-schema/spec';
4
4
  import { Hono } from 'hono';
5
5
  import { cors } from 'hono/cors';
6
6
  export { setTimeout as delay } from 'timers/promises';
7
- import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-DvW1SyKx.js';
8
- 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, p as OAuthProxyError, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from './OAuthProvider-DvW1SyKx.js';
7
+ import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-BaPwgWny.js';
8
+ 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, p as OAuthProxyError, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from './OAuthProvider-BaPwgWny.js';
9
9
 
10
10
  declare class DiscoveryDocumentCache {
11
11
  #private;
package/dist/ViteMCP.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  delay,
11
11
  imageContent,
12
12
  jsonSchemaAdapter
13
- } from "./chunk-UFLW3ODH.js";
13
+ } from "./chunk-DSDLJS6O.js";
14
14
  import {
15
15
  AuthProvider,
16
16
  AzureProvider,
@@ -25,7 +25,8 @@ import {
25
25
  requireAuth,
26
26
  requireRole,
27
27
  requireScopes
28
- } from "./chunk-HWSTK2ZH.js";
28
+ } from "./chunk-KKSDTVEW.js";
29
+ import "./chunk-4FH73ERY.js";
29
30
  export {
30
31
  AuthProvider,
31
32
  AzureProvider,
@@ -24,7 +24,7 @@
24
24
 
25
25
 
26
26
 
27
- var _chunkKFOTRFZScjs = require('../chunk-KFOTRFZS.cjs');
27
+ var _chunkSHPKRGNYcjs = require('../chunk-SHPKRGNY.cjs');
28
28
 
29
29
 
30
30
 
@@ -51,5 +51,5 @@ var _chunkKFOTRFZScjs = require('../chunk-KFOTRFZS.cjs');
51
51
 
52
52
 
53
53
 
54
- exports.AuthProvider = _chunkKFOTRFZScjs.AuthProvider; exports.AzureProvider = _chunkKFOTRFZScjs.AzureProvider; exports.ConsentManager = _chunkKFOTRFZScjs.ConsentManager; exports.DEFAULT_ACCESS_TOKEN_TTL = _chunkKFOTRFZScjs.DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = _chunkKFOTRFZScjs.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_AUTHORIZATION_CODE_TTL = _chunkKFOTRFZScjs.DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_REFRESH_TOKEN_TTL = _chunkKFOTRFZScjs.DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_TRANSACTION_TTL = _chunkKFOTRFZScjs.DEFAULT_TRANSACTION_TTL; exports.DiskStore = _chunkKFOTRFZScjs.DiskStore; exports.EncryptedTokenStorage = _chunkKFOTRFZScjs.EncryptedTokenStorage; exports.GitHubProvider = _chunkKFOTRFZScjs.GitHubProvider; exports.GoogleProvider = _chunkKFOTRFZScjs.GoogleProvider; exports.JWKSVerifier = _chunkKFOTRFZScjs.JWKSVerifier; exports.JWTIssuer = _chunkKFOTRFZScjs.JWTIssuer; exports.MemoryTokenStorage = _chunkKFOTRFZScjs.MemoryTokenStorage; exports.OAuthProvider = _chunkKFOTRFZScjs.OAuthProvider; exports.OAuthProxy = _chunkKFOTRFZScjs.OAuthProxy; exports.OAuthProxyError = _chunkKFOTRFZScjs.OAuthProxyError; exports.PKCEUtils = _chunkKFOTRFZScjs.PKCEUtils; exports.getAuthSession = _chunkKFOTRFZScjs.getAuthSession; exports.requireAll = _chunkKFOTRFZScjs.requireAll; exports.requireAny = _chunkKFOTRFZScjs.requireAny; exports.requireAuth = _chunkKFOTRFZScjs.requireAuth; exports.requireRole = _chunkKFOTRFZScjs.requireRole; exports.requireScopes = _chunkKFOTRFZScjs.requireScopes;
54
+ exports.AuthProvider = _chunkSHPKRGNYcjs.AuthProvider; exports.AzureProvider = _chunkSHPKRGNYcjs.AzureProvider; exports.ConsentManager = _chunkSHPKRGNYcjs.ConsentManager; exports.DEFAULT_ACCESS_TOKEN_TTL = _chunkSHPKRGNYcjs.DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = _chunkSHPKRGNYcjs.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_AUTHORIZATION_CODE_TTL = _chunkSHPKRGNYcjs.DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_REFRESH_TOKEN_TTL = _chunkSHPKRGNYcjs.DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_TRANSACTION_TTL = _chunkSHPKRGNYcjs.DEFAULT_TRANSACTION_TTL; exports.DiskStore = _chunkSHPKRGNYcjs.DiskStore; exports.EncryptedTokenStorage = _chunkSHPKRGNYcjs.EncryptedTokenStorage; exports.GitHubProvider = _chunkSHPKRGNYcjs.GitHubProvider; exports.GoogleProvider = _chunkSHPKRGNYcjs.GoogleProvider; exports.JWKSVerifier = _chunkSHPKRGNYcjs.JWKSVerifier; exports.JWTIssuer = _chunkSHPKRGNYcjs.JWTIssuer; exports.MemoryTokenStorage = _chunkSHPKRGNYcjs.MemoryTokenStorage; exports.OAuthProvider = _chunkSHPKRGNYcjs.OAuthProvider; exports.OAuthProxy = _chunkSHPKRGNYcjs.OAuthProxy; exports.OAuthProxyError = _chunkSHPKRGNYcjs.OAuthProxyError; exports.PKCEUtils = _chunkSHPKRGNYcjs.PKCEUtils; exports.getAuthSession = _chunkSHPKRGNYcjs.getAuthSession; exports.requireAll = _chunkSHPKRGNYcjs.requireAll; exports.requireAny = _chunkSHPKRGNYcjs.requireAny; exports.requireAuth = _chunkSHPKRGNYcjs.requireAuth; exports.requireRole = _chunkSHPKRGNYcjs.requireRole; exports.requireScopes = _chunkSHPKRGNYcjs.requireScopes;
55
55
  //# sourceMappingURL=index.cjs.map
@@ -1,5 +1,5 @@
1
- import { q as OAuthTransaction, C as ConsentData, T as TokenStorage, s as TokenVerifier, t as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-DvW1SyKx.cjs';
2
- export { A as AuthProvider, j as AuthProviderConfig, z as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, B as ClientCode, u as ClientIdMetadataOptions, E as CustomClaimsPassthroughConfig, F as DCRClientMetadata, H as DCRRequest, I as DCRResponse, D as DEFAULT_ACCESS_TOKEN_TTL, v as DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH, w as DEFAULT_AUTHORIZATION_CODE_TTL, x as DEFAULT_REFRESH_TOKEN_TTL, y as DEFAULT_TRANSACTION_TTL, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, J as OAuthError, d as OAuthProvider, K as OAuthProviderConfig, a as OAuthProxy, L as OAuthProxyConfig, p as OAuthProxyError, O as OAuthSession, M as ProxyDCRClient, R as RefreshRequest, S as SessionAuth, N as TokenMapping, Q as TokenRequest, U as TokenResponse, V as UpstreamTokenSet, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from '../OAuthProvider-DvW1SyKx.cjs';
1
+ import { q as OAuthTransaction, C as ConsentData, T as TokenStorage, s as TokenVerifier, t as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-BaPwgWny.cjs';
2
+ export { A as AuthProvider, j as AuthProviderConfig, z as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, B as ClientCode, u as ClientIdMetadataOptions, E as CustomClaimsPassthroughConfig, F as DCRClientMetadata, H as DCRRequest, I as DCRResponse, D as DEFAULT_ACCESS_TOKEN_TTL, v as DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH, w as DEFAULT_AUTHORIZATION_CODE_TTL, x as DEFAULT_REFRESH_TOKEN_TTL, y as DEFAULT_TRANSACTION_TTL, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, J as OAuthError, d as OAuthProvider, K as OAuthProviderConfig, a as OAuthProxy, L as OAuthProxyConfig, p as OAuthProxyError, O as OAuthSession, M as ProxyDCRClient, R as RefreshRequest, S as SessionAuth, N as TokenMapping, Q as TokenRequest, U as TokenResponse, V as UpstreamTokenSet, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from '../OAuthProvider-BaPwgWny.cjs';
3
3
 
4
4
  /**
5
5
  * Consent Management
@@ -1,5 +1,5 @@
1
- import { q as OAuthTransaction, C as ConsentData, T as TokenStorage, s as TokenVerifier, t as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-DvW1SyKx.js';
2
- export { A as AuthProvider, j as AuthProviderConfig, z as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, B as ClientCode, u as ClientIdMetadataOptions, E as CustomClaimsPassthroughConfig, F as DCRClientMetadata, H as DCRRequest, I as DCRResponse, D as DEFAULT_ACCESS_TOKEN_TTL, v as DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH, w as DEFAULT_AUTHORIZATION_CODE_TTL, x as DEFAULT_REFRESH_TOKEN_TTL, y as DEFAULT_TRANSACTION_TTL, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, J as OAuthError, d as OAuthProvider, K as OAuthProviderConfig, a as OAuthProxy, L as OAuthProxyConfig, p as OAuthProxyError, O as OAuthSession, M as ProxyDCRClient, R as RefreshRequest, S as SessionAuth, N as TokenMapping, Q as TokenRequest, U as TokenResponse, V as UpstreamTokenSet, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from '../OAuthProvider-DvW1SyKx.js';
1
+ import { q as OAuthTransaction, C as ConsentData, T as TokenStorage, s as TokenVerifier, t as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-BaPwgWny.js';
2
+ export { A as AuthProvider, j as AuthProviderConfig, z as AuthorizationParams, b as AzureProvider, k as AzureProviderConfig, l as AzureSession, B as ClientCode, u as ClientIdMetadataOptions, E as CustomClaimsPassthroughConfig, F as DCRClientMetadata, H as DCRRequest, I as DCRResponse, D as DEFAULT_ACCESS_TOKEN_TTL, v as DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH, w as DEFAULT_AUTHORIZATION_CODE_TTL, x as DEFAULT_REFRESH_TOKEN_TTL, y as DEFAULT_TRANSACTION_TTL, m as GenericOAuthProviderConfig, G as GitHubProvider, n as GitHubSession, c as GoogleProvider, o as GoogleSession, J as OAuthError, d as OAuthProvider, K as OAuthProviderConfig, a as OAuthProxy, L as OAuthProxyConfig, p as OAuthProxyError, O as OAuthSession, M as ProxyDCRClient, R as RefreshRequest, S as SessionAuth, N as TokenMapping, Q as TokenRequest, U as TokenResponse, V as UpstreamTokenSet, g as getAuthSession, r as requireAll, e as requireAny, f as requireAuth, h as requireRole, i as requireScopes } from '../OAuthProvider-BaPwgWny.js';
3
3
 
4
4
  /**
5
5
  * Consent Management
@@ -24,7 +24,7 @@ import {
24
24
  requireAuth,
25
25
  requireRole,
26
26
  requireScopes
27
- } from "../chunk-HWSTK2ZH.js";
27
+ } from "../chunk-KKSDTVEW.js";
28
28
  export {
29
29
  AuthProvider,
30
30
  AzureProvider,
@@ -0,0 +1,64 @@
1
+ // src/formatBytes.ts
2
+ var formatBytes = (bytes) => {
3
+ if (bytes >= 1024 * 1024 && bytes % (1024 * 1024) === 0) {
4
+ return `${bytes / (1024 * 1024)} MiB`;
5
+ }
6
+ if (bytes >= 1024 && bytes % 1024 === 0) {
7
+ return `${bytes / 1024} KiB`;
8
+ }
9
+ return `${bytes} bytes`;
10
+ };
11
+
12
+ // src/toSdkSchema.ts
13
+ var toSdkSchema = async (schema, io, convert) => {
14
+ if (!schema) {
15
+ return void 0;
16
+ }
17
+ const standard = schema["~standard"];
18
+ if (standard.jsonSchema) {
19
+ return schema;
20
+ }
21
+ const json = await convert(schema, io);
22
+ const advertised = io === "input" ? strictInputSchema(json) : json;
23
+ return {
24
+ "~standard": {
25
+ jsonSchema: { input: () => advertised, output: () => advertised },
26
+ validate: (value) => standard.validate(value),
27
+ vendor: standard.vendor,
28
+ version: standard.version
29
+ }
30
+ };
31
+ };
32
+ var valibotToJsonSchema = async (schema, io) => {
33
+ let converter;
34
+ try {
35
+ converter = await import("@valibot/to-json-schema");
36
+ } catch {
37
+ throw new Error(
38
+ 'The "@valibot/to-json-schema" package is required to describe Valibot schemas. Install it with: npm install @valibot/to-json-schema'
39
+ );
40
+ }
41
+ return converter.toJsonSchema(schema, {
42
+ errorMode: "ignore",
43
+ typeMode: io
44
+ });
45
+ };
46
+ var strictInputSchema = (schema) => ({
47
+ ...schema,
48
+ additionalProperties: typeof schema.additionalProperties === "object" ? schema.additionalProperties : false,
49
+ ...schema.properties && {
50
+ properties: Object.fromEntries(
51
+ Object.entries(schema.properties).map(([key, value]) => [
52
+ key,
53
+ typeof value === "object" && value.type === "object" ? strictInputSchema(value) : value
54
+ ])
55
+ )
56
+ }
57
+ });
58
+
59
+ export {
60
+ formatBytes,
61
+ toSdkSchema,
62
+ valibotToJsonSchema
63
+ };
64
+ //# sourceMappingURL=chunk-4FH73ERY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/formatBytes.ts","../src/toSdkSchema.ts"],"sourcesContent":["/** Renders a byte cap the way the error message should read (e.g. \"1 MiB\"). */\nexport const formatBytes = (bytes: number): string => {\n if (bytes >= 1024 * 1024 && bytes % (1024 * 1024) === 0) {\n return `${bytes / (1024 * 1024)} MiB`;\n }\n\n if (bytes >= 1024 && bytes % 1024 === 0) {\n return `${bytes / 1024} KiB`;\n }\n\n return `${bytes} bytes`;\n};\n","import type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport type { JsonSchema } from \"xsschema\";\n\n/**\n * Turns a Standard Schema that carries no JSON Schema into one. Which\n * libraries that can be done for depends on the runtime, so each entry point\n * supplies its own.\n */\nexport type JsonSchemaConverter = (\n schema: StandardSchemaV1,\n io: \"input\" | \"output\",\n) => Promise<JsonSchema>;\n\n/**\n * Gives the SDK a JSON Schema for a schema that has none of its own. Zod v4\n * and ArkType emit JSON Schema natively and pass through; anything else\n * (Valibot, say) is converted, and the conversion is only what `tools/list`\n * advertises. Validation stays with the library the schema was written in:\n * the conversion drops what JSON Schema cannot say — a transform, a\n * `check()` — so validating against it instead would pass `execute`\n * arguments the schema never produced.\n *\n * Advertised inputs are closed with `strictInputSchema`. Outputs are left as\n * converted, since closing them would misdescribe results the schema allows.\n *\n * Shared by `ViteMCP` and `EdgeViteMCP`, so what a tool advertises does not\n * depend on which of them serves it. Rejects when `convert` does.\n */\nexport const toSdkSchema = async (\n schema: unknown,\n io: \"input\" | \"output\",\n convert: JsonSchemaConverter,\n): Promise<unknown> => {\n if (!schema) {\n return undefined;\n }\n\n const standard = (\n schema as {\n \"~standard\": { jsonSchema?: unknown } & StandardSchemaV1.Props;\n }\n )[\"~standard\"];\n\n if (standard.jsonSchema) {\n return schema;\n }\n\n const json = await convert(schema as StandardSchemaV1, io);\n const advertised = io === \"input\" ? strictInputSchema(json) : json;\n\n return {\n \"~standard\": {\n jsonSchema: { input: () => advertised, output: () => advertised },\n validate: (value: unknown) => standard.validate(value),\n vendor: standard.vendor,\n version: standard.version,\n },\n };\n};\n\n/**\n * JSON Schema for a Valibot schema, for advertising.\n *\n * Valibot's converter is called directly so it can be told to skip what JSON\n * Schema cannot express — a transform, a `check()` — rather than refuse the\n * whole schema. Valibot still validates, so the copy only has to describe what\n * a caller sends (`typeMode: \"input\"`, which stops at the first transform) or\n * receives (`\"output\"`).\n *\n * The `import()` has to stay inside the `try`. An edge bundle is built with\n * every import resolved ahead of time, and a bundler fails the build over one\n * it cannot resolve — unless it can see the failure is handled, in which case\n * a server that never touches Valibot builds without the converter installed.\n */\nexport const valibotToJsonSchema: JsonSchemaConverter = async (schema, io) => {\n let converter;\n\n try {\n converter = await import(\"@valibot/to-json-schema\");\n } catch {\n throw new Error(\n 'The \"@valibot/to-json-schema\" package is required to describe Valibot ' +\n \"schemas. Install it with: npm install @valibot/to-json-schema\",\n );\n }\n\n return converter.toJsonSchema(schema as never, {\n errorMode: \"ignore\",\n typeMode: io,\n }) as JsonSchema;\n};\n\n/**\n * Closes an advertised input schema's objects to undeclared keys, except where\n * the schema describes those keys itself. A record's value schema, or an\n * object's rest schema, arrives as `additionalProperties`; replacing it with\n * `false` would tell clients the tool takes none of those keys, so a\n * `v.record()` argument could only ever be sent as `{}`.\n */\nconst strictInputSchema = (schema: JsonSchema): JsonSchema => ({\n ...schema,\n additionalProperties:\n typeof schema.additionalProperties === \"object\"\n ? schema.additionalProperties\n : false,\n ...(schema.properties && {\n properties: Object.fromEntries(\n Object.entries(schema.properties).map(([key, value]) => [\n key,\n typeof value === \"object\" && value.type === \"object\"\n ? strictInputSchema(value)\n : value,\n ]),\n ),\n }),\n});\n"],"mappings":";AACO,IAAM,cAAc,CAAC,UAA0B;AACpD,MAAI,SAAS,OAAO,QAAQ,SAAS,OAAO,UAAU,GAAG;AACvD,WAAO,GAAG,SAAS,OAAO,KAAK;AAAA,EACjC;AAEA,MAAI,SAAS,QAAQ,QAAQ,SAAS,GAAG;AACvC,WAAO,GAAG,QAAQ,IAAI;AAAA,EACxB;AAEA,SAAO,GAAG,KAAK;AACjB;;;ACiBO,IAAM,cAAc,OACzB,QACA,IACA,YACqB;AACrB,MAAI,CAAC,QAAQ;AACX,WAAO;AAAA,EACT;AAEA,QAAM,WACJ,OAGA,WAAW;AAEb,MAAI,SAAS,YAAY;AACvB,WAAO;AAAA,EACT;AAEA,QAAM,OAAO,MAAM,QAAQ,QAA4B,EAAE;AACzD,QAAM,aAAa,OAAO,UAAU,kBAAkB,IAAI,IAAI;AAE9D,SAAO;AAAA,IACL,aAAa;AAAA,MACX,YAAY,EAAE,OAAO,MAAM,YAAY,QAAQ,MAAM,WAAW;AAAA,MAChE,UAAU,CAAC,UAAmB,SAAS,SAAS,KAAK;AAAA,MACrD,QAAQ,SAAS;AAAA,MACjB,SAAS,SAAS;AAAA,IACpB;AAAA,EACF;AACF;AAgBO,IAAM,sBAA2C,OAAO,QAAQ,OAAO;AAC5E,MAAI;AAEJ,MAAI;AACF,gBAAY,MAAM,OAAO,yBAAyB;AAAA,EACpD,QAAQ;AACN,UAAM,IAAI;AAAA,MACR;AAAA,IAEF;AAAA,EACF;AAEA,SAAO,UAAU,aAAa,QAAiB;AAAA,IAC7C,WAAW;AAAA,IACX,UAAU;AAAA,EACZ,CAAC;AACH;AASA,IAAM,oBAAoB,CAAC,YAAoC;AAAA,EAC7D,GAAG;AAAA,EACH,sBACE,OAAO,OAAO,yBAAyB,WACnC,OAAO,uBACP;AAAA,EACN,GAAI,OAAO,cAAc;AAAA,IACvB,YAAY,OAAO;AAAA,MACjB,OAAO,QAAQ,OAAO,UAAU,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AAAA,QACtD;AAAA,QACA,OAAO,UAAU,YAAY,MAAM,SAAS,WACxC,kBAAkB,KAAK,IACvB;AAAA,MACN,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":[]}