@vitemcp/server 1.8.8 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +9 -3
  2. package/dist/{OAuthProvider-COBBSCMI.d.cts → OAuthProvider-BaPwgWny.d.cts} +23 -2
  3. package/dist/{OAuthProvider-COBBSCMI.d.ts → OAuthProvider-BaPwgWny.d.ts} +23 -2
  4. package/dist/ViteMCP.cjs +4 -3
  5. package/dist/ViteMCP.cjs.map +1 -1
  6. package/dist/ViteMCP.d.cts +5 -4
  7. package/dist/ViteMCP.d.ts +5 -4
  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-FEM6LNS4.cjs +64 -0
  16. package/dist/chunk-FEM6LNS4.cjs.map +1 -0
  17. package/dist/{chunk-M22UTH2Z.js → chunk-IHX3AXKW.js} +204 -137
  18. package/dist/chunk-IHX3AXKW.js.map +1 -0
  19. package/dist/{chunk-5KNSU2F3.js → chunk-KKSDTVEW.js} +87 -18
  20. package/dist/chunk-KKSDTVEW.js.map +1 -0
  21. package/dist/{chunk-Y3GRHB77.cjs → chunk-SHPKRGNY.cjs} +101 -32
  22. package/dist/chunk-SHPKRGNY.cjs.map +1 -0
  23. package/dist/{chunk-7UCE3YTY.cjs → chunk-Y52P2PCS.cjs} +216 -149
  24. package/dist/chunk-Y52P2PCS.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 +36 -18
  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 +28 -10
  36. package/dist/openapi/index.js.map +1 -1
  37. package/package.json +1 -1
  38. package/dist/chunk-5KNSU2F3.js.map +0 -1
  39. package/dist/chunk-7UCE3YTY.cjs.map +0 -1
  40. package/dist/chunk-M22UTH2Z.js.map +0 -1
  41. package/dist/chunk-Y3GRHB77.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
@@ -1512,7 +1515,8 @@ Tools can log messages to the client using the `log` object in the context objec
1512
1515
  > setting `io.modelcontextprotocol/logLevel` in the request's `_meta`. The
1513
1516
  > revision forbids servers from sending `notifications/message` for a request
1514
1517
  > that did not opt in, so `log.*` is a no-op otherwise — that is expected
1515
- > behaviour, not a bug.
1518
+ > behaviour, not a bug. The level is a floor: a request that asks for
1519
+ > `warning` receives `log.warn` and `log.error`, not `log.info` or `log.debug`.
1516
1520
  >
1517
1521
  > Logging is also deprecated as of 2026-07-28. For diagnostics that always
1518
1522
  > reach you, write to `stderr` (stdio servers) or use OpenTelemetry; for
@@ -2008,6 +2012,8 @@ When running on edge runtimes:
2008
2012
  - **No filesystem access**: Use fetch APIs for external data
2009
2013
  - **V8 Isolates**: Fast cold starts and efficient resource usage
2010
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
2011
2017
 
2012
2018
  #### Custom Routes on Edge
2013
2019
 
@@ -2136,7 +2142,7 @@ Follow the guide https://modelcontextprotocol.io/quickstart/user and add the fol
2136
2142
 
2137
2143
  ### How to run ViteMCP behind a proxy?
2138
2144
 
2139
- 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.
2140
2146
 
2141
2147
  ## Showcase
2142
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
@@ -801,10 +811,21 @@ interface AuthProviderConfig {
801
811
  * SECURITY advisory before loosening this.
802
812
  */
803
813
  allowedRedirectUriPatterns?: string[];
804
- /** Base URL where the MCP server is accessible */
814
+ /**
815
+ * Accept PKCE `plain` as well as `S256` (default: false), for the rare
816
+ * client that cannot hash. See `OAuthProxyConfig.allowPlainPkce` first.
817
+ */
818
+ allowPlainPkce?: boolean;
819
+ /** Base URL where the MCP server is accessible. A trailing slash is ignored. */
805
820
  baseUrl: string;
806
821
  /** OAuth client ID */
807
822
  clientId: string;
823
+ /**
824
+ * Client ID Metadata Document support, on by default. Set `allowedDomains`
825
+ * to limit which hosts client metadata is fetched from, or `enabled: false`
826
+ * to turn it off.
827
+ */
828
+ clientIdMetadata?: ClientIdMetadataOptions;
808
829
  /** OAuth client secret */
809
830
  clientSecret: string;
810
831
  /** Require user consent screen (default: true) */
@@ -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
@@ -801,10 +811,21 @@ interface AuthProviderConfig {
801
811
  * SECURITY advisory before loosening this.
802
812
  */
803
813
  allowedRedirectUriPatterns?: string[];
804
- /** Base URL where the MCP server is accessible */
814
+ /**
815
+ * Accept PKCE `plain` as well as `S256` (default: false), for the rare
816
+ * client that cannot hash. See `OAuthProxyConfig.allowPlainPkce` first.
817
+ */
818
+ allowPlainPkce?: boolean;
819
+ /** Base URL where the MCP server is accessible. A trailing slash is ignored. */
805
820
  baseUrl: string;
806
821
  /** OAuth client ID */
807
822
  clientId: string;
823
+ /**
824
+ * Client ID Metadata Document support, on by default. Set `allowedDomains`
825
+ * to limit which hosts client metadata is fetched from, or `enabled: false`
826
+ * to turn it off.
827
+ */
828
+ clientIdMetadata?: ClientIdMetadataOptions;
808
829
  /** OAuth client secret */
809
830
  clientSecret: string;
810
831
  /** Require user consent screen (default: true) */
package/dist/ViteMCP.cjs CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
 
12
12
 
13
- var _chunk7UCE3YTYcjs = require('./chunk-7UCE3YTY.cjs');
13
+ var _chunkY52P2PCScjs = require('./chunk-Y52P2PCS.cjs');
14
14
 
15
15
 
16
16
 
@@ -25,7 +25,8 @@ var _chunk7UCE3YTYcjs = require('./chunk-7UCE3YTY.cjs');
25
25
 
26
26
 
27
27
 
28
- var _chunkY3GRHB77cjs = require('./chunk-Y3GRHB77.cjs');
28
+ var _chunkSHPKRGNYcjs = require('./chunk-SHPKRGNY.cjs');
29
+ require('./chunk-FEM6LNS4.cjs');
29
30
 
30
31
 
31
32
 
@@ -51,5 +52,5 @@ var _chunkY3GRHB77cjs = require('./chunk-Y3GRHB77.cjs');
51
52
 
52
53
 
53
54
 
54
- exports.AuthProvider = _chunkY3GRHB77cjs.AuthProvider; exports.AzureProvider = _chunkY3GRHB77cjs.AzureProvider; exports.DiscoveryDocumentCache = _chunk7UCE3YTYcjs.DiscoveryDocumentCache; exports.GitHubProvider = _chunkY3GRHB77cjs.GitHubProvider; exports.GoogleProvider = _chunkY3GRHB77cjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunk7UCE3YTYcjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunkY3GRHB77cjs.OAuthProvider; exports.OAuthProxy = _chunkY3GRHB77cjs.OAuthProxy; exports.OAuthProxyError = _chunkY3GRHB77cjs.OAuthProxyError; exports.ServerState = _chunk7UCE3YTYcjs.ServerState; exports.UnexpectedStateError = _chunk7UCE3YTYcjs.UnexpectedStateError; exports.UserError = _chunk7UCE3YTYcjs.UserError; exports.ViteMCP = _chunk7UCE3YTYcjs.ViteMCP; exports.ViteMCPError = _chunk7UCE3YTYcjs.ViteMCPError; exports.audioContent = _chunk7UCE3YTYcjs.audioContent; exports.delay = _chunk7UCE3YTYcjs.delay; exports.getAuthSession = _chunkY3GRHB77cjs.getAuthSession; exports.imageContent = _chunk7UCE3YTYcjs.imageContent; exports.jsonSchemaAdapter = _chunk7UCE3YTYcjs.jsonSchemaAdapter; exports.requireAll = _chunkY3GRHB77cjs.requireAll; exports.requireAny = _chunkY3GRHB77cjs.requireAny; exports.requireAuth = _chunkY3GRHB77cjs.requireAuth; exports.requireRole = _chunkY3GRHB77cjs.requireRole; exports.requireScopes = _chunkY3GRHB77cjs.requireScopes;
55
+ exports.AuthProvider = _chunkSHPKRGNYcjs.AuthProvider; exports.AzureProvider = _chunkSHPKRGNYcjs.AzureProvider; exports.DiscoveryDocumentCache = _chunkY52P2PCScjs.DiscoveryDocumentCache; exports.GitHubProvider = _chunkSHPKRGNYcjs.GitHubProvider; exports.GoogleProvider = _chunkSHPKRGNYcjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunkY52P2PCScjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunkSHPKRGNYcjs.OAuthProvider; exports.OAuthProxy = _chunkSHPKRGNYcjs.OAuthProxy; exports.OAuthProxyError = _chunkSHPKRGNYcjs.OAuthProxyError; exports.ServerState = _chunkY52P2PCScjs.ServerState; exports.UnexpectedStateError = _chunkY52P2PCScjs.UnexpectedStateError; exports.UserError = _chunkY52P2PCScjs.UserError; exports.ViteMCP = _chunkY52P2PCScjs.ViteMCP; exports.ViteMCPError = _chunkY52P2PCScjs.ViteMCPError; exports.audioContent = _chunkY52P2PCScjs.audioContent; exports.delay = _chunkY52P2PCScjs.delay; exports.getAuthSession = _chunkSHPKRGNYcjs.getAuthSession; exports.imageContent = _chunkY52P2PCScjs.imageContent; exports.jsonSchemaAdapter = _chunkY52P2PCScjs.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-COBBSCMI.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-COBBSCMI.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;
@@ -207,7 +207,7 @@ type Context<T extends ViteMCPAuth> = {
207
207
  /**
208
208
  * Emits `notifications/message`. The spec forbids emitting these unless the
209
209
  * request opted in via `_meta` log level, so these are dropped when the
210
- * client did not ask for logs.
210
+ * client did not ask for logs, and below the level it asked for.
211
211
  */
212
212
  log: {
213
213
  debug: (message: string, data?: SerializableValue) => void;
@@ -461,7 +461,8 @@ declare class ViteMCP<T extends ViteMCPAuth = ViteMCPAuth> {
461
461
  getApp(): Hono;
462
462
  /**
463
463
  * Publishes `notifications/resources/updated` for a URI to any subscription
464
- * that opted in to it.
464
+ * that opted in to it and whose caller may read it. HTTP only: a stdio
465
+ * client is never reached.
465
466
  */
466
467
  notifyResourceUpdated(uri: string): void;
467
468
  removePrompt(name: string): void;
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-COBBSCMI.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-COBBSCMI.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;
@@ -207,7 +207,7 @@ type Context<T extends ViteMCPAuth> = {
207
207
  /**
208
208
  * Emits `notifications/message`. The spec forbids emitting these unless the
209
209
  * request opted in via `_meta` log level, so these are dropped when the
210
- * client did not ask for logs.
210
+ * client did not ask for logs, and below the level it asked for.
211
211
  */
212
212
  log: {
213
213
  debug: (message: string, data?: SerializableValue) => void;
@@ -461,7 +461,8 @@ declare class ViteMCP<T extends ViteMCPAuth = ViteMCPAuth> {
461
461
  getApp(): Hono;
462
462
  /**
463
463
  * Publishes `notifications/resources/updated` for a URI to any subscription
464
- * that opted in to it.
464
+ * that opted in to it and whose caller may read it. HTTP only: a stdio
465
+ * client is never reached.
465
466
  */
466
467
  notifyResourceUpdated(uri: string): void;
467
468
  removePrompt(name: string): void;
package/dist/ViteMCP.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  delay,
11
11
  imageContent,
12
12
  jsonSchemaAdapter
13
- } from "./chunk-M22UTH2Z.js";
13
+ } from "./chunk-IHX3AXKW.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-5KNSU2F3.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 _chunkY3GRHB77cjs = require('../chunk-Y3GRHB77.cjs');
27
+ var _chunkSHPKRGNYcjs = require('../chunk-SHPKRGNY.cjs');
28
28
 
29
29
 
30
30
 
@@ -51,5 +51,5 @@ var _chunkY3GRHB77cjs = require('../chunk-Y3GRHB77.cjs');
51
51
 
52
52
 
53
53
 
54
- exports.AuthProvider = _chunkY3GRHB77cjs.AuthProvider; exports.AzureProvider = _chunkY3GRHB77cjs.AzureProvider; exports.ConsentManager = _chunkY3GRHB77cjs.ConsentManager; exports.DEFAULT_ACCESS_TOKEN_TTL = _chunkY3GRHB77cjs.DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = _chunkY3GRHB77cjs.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_AUTHORIZATION_CODE_TTL = _chunkY3GRHB77cjs.DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_REFRESH_TOKEN_TTL = _chunkY3GRHB77cjs.DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_TRANSACTION_TTL = _chunkY3GRHB77cjs.DEFAULT_TRANSACTION_TTL; exports.DiskStore = _chunkY3GRHB77cjs.DiskStore; exports.EncryptedTokenStorage = _chunkY3GRHB77cjs.EncryptedTokenStorage; exports.GitHubProvider = _chunkY3GRHB77cjs.GitHubProvider; exports.GoogleProvider = _chunkY3GRHB77cjs.GoogleProvider; exports.JWKSVerifier = _chunkY3GRHB77cjs.JWKSVerifier; exports.JWTIssuer = _chunkY3GRHB77cjs.JWTIssuer; exports.MemoryTokenStorage = _chunkY3GRHB77cjs.MemoryTokenStorage; exports.OAuthProvider = _chunkY3GRHB77cjs.OAuthProvider; exports.OAuthProxy = _chunkY3GRHB77cjs.OAuthProxy; exports.OAuthProxyError = _chunkY3GRHB77cjs.OAuthProxyError; exports.PKCEUtils = _chunkY3GRHB77cjs.PKCEUtils; exports.getAuthSession = _chunkY3GRHB77cjs.getAuthSession; exports.requireAll = _chunkY3GRHB77cjs.requireAll; exports.requireAny = _chunkY3GRHB77cjs.requireAny; exports.requireAuth = _chunkY3GRHB77cjs.requireAuth; exports.requireRole = _chunkY3GRHB77cjs.requireRole; exports.requireScopes = _chunkY3GRHB77cjs.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-COBBSCMI.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-COBBSCMI.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-COBBSCMI.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-COBBSCMI.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-5KNSU2F3.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":[]}
@@ -0,0 +1,64 @@
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; } }// 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 Promise.resolve().then(() => _interopRequireWildcard(require("@valibot/to-json-schema")));
36
+ } catch (e) {
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
+
60
+
61
+
62
+
63
+ exports.formatBytes = formatBytes; exports.toSdkSchema = toSdkSchema; exports.valibotToJsonSchema = valibotToJsonSchema;
64
+ //# sourceMappingURL=chunk-FEM6LNS4.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/server/server/dist/chunk-FEM6LNS4.cjs","../src/formatBytes.ts","../src/toSdkSchema.ts"],"names":[],"mappings":"AAAA;ACCO,IAAM,YAAA,EAAc,CAAC,KAAA,EAAA,GAA0B;AACpD,EAAA,GAAA,CAAI,MAAA,GAAS,KAAA,EAAO,KAAA,GAAQ,MAAA,EAAA,CAAS,KAAA,EAAO,IAAA,EAAA,IAAU,CAAA,EAAG;AACvD,IAAA,OAAO,CAAA,EAAA;AACT,EAAA;AAEI,EAAA;AACK,IAAA;AACT,EAAA;AAEU,EAAA;AACZ;ADDY;AACA;AEiBC;AAKN,EAAA;AACI,IAAA;AACT,EAAA;AAEM,EAAA;AAMF,EAAA;AACK,IAAA;AACT,EAAA;AAEM,EAAA;AACA,EAAA;AAEC,EAAA;AACL,IAAA;AACE,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACF,IAAA;AACF,EAAA;AACF;AAgBa;AACP,EAAA;AAEA,EAAA;AACF,IAAA;AACM,EAAA;AACA,IAAA;AACJ,MAAA;AAEF,IAAA;AACF,EAAA;AAEO,EAAA;AACL,IAAA;AACA,IAAA;AACD,EAAA;AACH;AASM;AACD,EAAA;AACH,EAAA;AAIW,EAAA;AACT,IAAA;AACE,MAAA;AACE,QAAA;AACA,QAAA;AAGD,MAAA;AACH,IAAA;AACF,EAAA;AACF;AF1DY;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/server/server/dist/chunk-FEM6LNS4.cjs","sourcesContent":[null,"/** 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"]}