@vitemcp/server 1.9.16 → 1.10.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/README.md +60 -1
- package/dist/{OAuthProvider-DNKBMBPU.d.cts → OAuthProvider-STkC4R2N.d.cts} +39 -1
- package/dist/{OAuthProvider-DNKBMBPU.d.ts → OAuthProvider-STkC4R2N.d.ts} +39 -1
- package/dist/ViteMCP.cjs +4 -4
- package/dist/ViteMCP.d.cts +20 -3
- package/dist/ViteMCP.d.ts +20 -3
- package/dist/ViteMCP.js +3 -3
- package/dist/auth/index.cjs +2 -2
- package/dist/auth/index.d.cts +17 -3
- package/dist/auth/index.d.ts +17 -3
- package/dist/auth/index.js +1 -1
- package/dist/{chunk-PXH56Q3F.js → chunk-AOZIQIXA.js} +143 -18
- package/dist/chunk-AOZIQIXA.js.map +1 -0
- package/dist/{chunk-JMDI672G.js → chunk-BLXUZUZ4.js} +16 -1
- package/dist/chunk-BLXUZUZ4.js.map +1 -0
- package/dist/{chunk-LZTRZ62V.js → chunk-BMW6BWBO.js} +33 -12
- package/dist/chunk-BMW6BWBO.js.map +1 -0
- package/dist/{chunk-HDJEH7NK.cjs → chunk-CJLWQH7G.cjs} +38 -17
- package/dist/chunk-CJLWQH7G.cjs.map +1 -0
- package/dist/{chunk-QPVEGWOL.cjs → chunk-NZGRSB2D.cjs} +17 -2
- package/dist/chunk-NZGRSB2D.cjs.map +1 -0
- package/dist/{chunk-TWYBLPRQ.cjs → chunk-R3JUTGZL.cjs} +162 -37
- package/dist/chunk-R3JUTGZL.cjs.map +1 -0
- package/dist/edge/index.cjs +23 -10
- package/dist/edge/index.cjs.map +1 -1
- package/dist/edge/index.d.cts +11 -0
- package/dist/edge/index.d.ts +11 -0
- package/dist/edge/index.js +19 -6
- package/dist/edge/index.js.map +1 -1
- package/dist/openapi/index.cjs +43 -43
- package/dist/openapi/index.cjs.map +1 -1
- package/dist/openapi/index.d.cts +1 -1
- package/dist/openapi/index.d.ts +1 -1
- package/dist/openapi/index.js +33 -33
- package/dist/openapi/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-HDJEH7NK.cjs.map +0 -1
- package/dist/chunk-JMDI672G.js.map +0 -1
- package/dist/chunk-LZTRZ62V.js.map +0 -1
- package/dist/chunk-PXH56Q3F.js.map +0 -1
- package/dist/chunk-QPVEGWOL.cjs.map +0 -1
- package/dist/chunk-TWYBLPRQ.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -748,6 +748,35 @@ server.addTool({
|
|
|
748
748
|
});
|
|
749
749
|
```
|
|
750
750
|
|
|
751
|
+
#### Passing the caller's context
|
|
752
|
+
|
|
753
|
+
`embedded()` runs a loader outside any request, so by default its
|
|
754
|
+
`context.auth` is `undefined` and `canAccess` is not consulted. Pass the tool's
|
|
755
|
+
`context` to resolve the URI as `resources/read` would for that caller: the
|
|
756
|
+
loader receives that context, `auth` included, and a resource or template whose
|
|
757
|
+
`canAccess` refuses the caller is not found.
|
|
758
|
+
|
|
759
|
+
```js
|
|
760
|
+
server.addTool({
|
|
761
|
+
name: "get_my_profile",
|
|
762
|
+
description: "Retrieve the caller's own profile",
|
|
763
|
+
parameters: z.object({}),
|
|
764
|
+
execute: async (args, context) => {
|
|
765
|
+
return {
|
|
766
|
+
content: [
|
|
767
|
+
{
|
|
768
|
+
type: "resource",
|
|
769
|
+
resource: await server.embedded("user://me", context),
|
|
770
|
+
},
|
|
771
|
+
],
|
|
772
|
+
};
|
|
773
|
+
},
|
|
774
|
+
});
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
Pass it whenever the URI comes from the tool's arguments, so the tool cannot
|
|
778
|
+
reach a resource its caller could not read directly.
|
|
779
|
+
|
|
751
780
|
### Prompts
|
|
752
781
|
|
|
753
782
|
[Prompts](https://modelcontextprotocol.io/docs/concepts/prompts) enable servers to define reusable prompt templates and workflows that clients can easily surface to users and LLMs. They provide a powerful way to standardize and share common LLM interactions.
|
|
@@ -1768,6 +1797,36 @@ const transport = new StreamableHTTPClientTransport(
|
|
|
1768
1797
|
await client.connect(transport);
|
|
1769
1798
|
```
|
|
1770
1799
|
|
|
1800
|
+
#### Request limits
|
|
1801
|
+
|
|
1802
|
+
Two limits bound what one request can make the server do:
|
|
1803
|
+
|
|
1804
|
+
- `httpStream.maxBodySize` caps the MCP endpoint's request body, in bytes
|
|
1805
|
+
(default: 1 MiB). A larger body is refused with a `400`, without being held
|
|
1806
|
+
in memory.
|
|
1807
|
+
- `maxToolInputElements` caps how many array elements and object members,
|
|
1808
|
+
counted together, one `tools/call` may carry in its arguments (default:
|
|
1809
|
+
10,000). A call over it gets an error result before any schema validates it.
|
|
1810
|
+
The body cap alone does not bound what validation costs: half a million
|
|
1811
|
+
invalid elements fit in 1 MiB.
|
|
1812
|
+
|
|
1813
|
+
```ts
|
|
1814
|
+
const server = new ViteMCP({
|
|
1815
|
+
name: "Bulk importer",
|
|
1816
|
+
version: "1.0.0",
|
|
1817
|
+
// Its tools take arrays of up to 50,000 numbers.
|
|
1818
|
+
maxToolInputElements: 60_000,
|
|
1819
|
+
});
|
|
1820
|
+
|
|
1821
|
+
server.start({
|
|
1822
|
+
transportType: "httpStream",
|
|
1823
|
+
httpStream: { port: 8080, maxBodySize: 4 * 1024 * 1024 },
|
|
1824
|
+
});
|
|
1825
|
+
```
|
|
1826
|
+
|
|
1827
|
+
`maxToolInputElements` applies on every transport, stdio included. Pass
|
|
1828
|
+
`Infinity` to lift it.
|
|
1829
|
+
|
|
1771
1830
|
#### HTTPS Support
|
|
1772
1831
|
|
|
1773
1832
|
Pass SSL certificates to terminate TLS directly:
|
|
@@ -2030,7 +2089,7 @@ When running on edge runtimes:
|
|
|
2030
2089
|
- **No filesystem access**: Use fetch APIs for external data
|
|
2031
2090
|
- **V8 Isolates**: Fast cold starts and efficient resource usage
|
|
2032
2091
|
- **Global deployment**: Automatic distribution to edge locations
|
|
2033
|
-
- **Request size**: The MCP endpoint refuses a body over `maxBodySize` (1 MiB by default, as on Node). Routes added through `getApp()` are not covered
|
|
2092
|
+
- **Request size**: The MCP endpoint refuses a body over `maxBodySize` (1 MiB by default, as on Node), and a tool call whose arguments hold more than `maxToolInputElements` elements (10,000 by default, as on Node). Routes added through `getApp()` are not covered
|
|
2034
2093
|
- **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
|
|
2035
2094
|
|
|
2036
2095
|
#### Custom Routes on Edge
|
|
@@ -77,6 +77,8 @@ interface ClientCode {
|
|
|
77
77
|
interface ConsentData {
|
|
78
78
|
clientName: string;
|
|
79
79
|
provider: string;
|
|
80
|
+
/** Where the client is sent once the user approves. */
|
|
81
|
+
redirectUri?: string;
|
|
80
82
|
scope: string[];
|
|
81
83
|
timestamp: number;
|
|
82
84
|
transactionId: string;
|
|
@@ -346,6 +348,11 @@ interface OAuthTransaction {
|
|
|
346
348
|
clientCodeChallengeMethod: string;
|
|
347
349
|
/** Client ID from registration */
|
|
348
350
|
clientId: string;
|
|
351
|
+
/**
|
|
352
|
+
* Digest of the cookie held by the browser the consent screen was shown to.
|
|
353
|
+
* Approving the request and finishing it both take that cookie.
|
|
354
|
+
*/
|
|
355
|
+
consentBinding?: string;
|
|
349
356
|
/** Whether user consent was given */
|
|
350
357
|
consentGiven?: boolean;
|
|
351
358
|
/** Transaction creation timestamp */
|
|
@@ -578,8 +585,13 @@ declare class OAuthProxy {
|
|
|
578
585
|
constructor(config: OAuthProxyConfig);
|
|
579
586
|
/**
|
|
580
587
|
* OAuth authorization endpoint
|
|
588
|
+
*
|
|
589
|
+
* With consent required the response is the consent screen, and it sets the
|
|
590
|
+
* cookie that the request is approved and finished with: return its headers
|
|
591
|
+
* to the browser. Pass that browser's `request` as well, so that one with
|
|
592
|
+
* several authorization requests open keeps a single cookie for all of them.
|
|
581
593
|
*/
|
|
582
|
-
authorize(params: AuthorizationParams): Promise<Response>;
|
|
594
|
+
authorize(params: AuthorizationParams, request?: Request): Promise<Response>;
|
|
583
595
|
/**
|
|
584
596
|
* Stop cleanup interval and destroy resources
|
|
585
597
|
*/
|
|
@@ -663,6 +675,24 @@ declare class OAuthProxy {
|
|
|
663
675
|
* Periodic maintenance hook. Expiry is enforced by the token storage.
|
|
664
676
|
*/
|
|
665
677
|
private cleanup;
|
|
678
|
+
/**
|
|
679
|
+
* The cookie that ties consent requests to the browser they were shown to.
|
|
680
|
+
* A browser holds one, shared by every request it has open, and it lasts as
|
|
681
|
+
* long as a request does. `Lax` lets it travel with the provider's redirect
|
|
682
|
+
* back to the callback, which is a cross-site navigation. Over HTTPS the
|
|
683
|
+
* `__Host-` prefix keeps another host on the same site from setting it.
|
|
684
|
+
*/
|
|
685
|
+
private consentCookie;
|
|
686
|
+
private consentCookieName;
|
|
687
|
+
/**
|
|
688
|
+
* The consent cookie `request` carries, if it carries a well-formed one.
|
|
689
|
+
*
|
|
690
|
+
* Only the spaces and tabs that may surround a cookie are dropped. Trimming
|
|
691
|
+
* all white space would take a cookie whose name begins with, say, a
|
|
692
|
+
* no-break space for this one, and a browser does not hold such a name to
|
|
693
|
+
* the `__Host-` rules.
|
|
694
|
+
*/
|
|
695
|
+
private consentCookieValue;
|
|
666
696
|
/**
|
|
667
697
|
* Create a new OAuth transaction
|
|
668
698
|
*/
|
|
@@ -725,6 +755,14 @@ declare class OAuthProxy {
|
|
|
725
755
|
* Handle swap mode refresh - verify ViteMCP JWT and issue new tokens
|
|
726
756
|
*/
|
|
727
757
|
private handleSwapModeRefresh;
|
|
758
|
+
/**
|
|
759
|
+
* Whether `request` comes from the browser the transaction's consent screen
|
|
760
|
+
* was shown to: it carries the cookie that screen set. A transaction that
|
|
761
|
+
* never had a consent screen is bound to no browser.
|
|
762
|
+
*/
|
|
763
|
+
private isConsentBoundTo;
|
|
764
|
+
/** Whether browsers reach this proxy over HTTPS, going by its `baseUrl`. */
|
|
765
|
+
private isServedOverHttps;
|
|
728
766
|
/**
|
|
729
767
|
* Issue swapped tokens (JWT pattern)
|
|
730
768
|
* Issues short-lived ViteMCP JWTs and stores upstream tokens securely
|
|
@@ -77,6 +77,8 @@ interface ClientCode {
|
|
|
77
77
|
interface ConsentData {
|
|
78
78
|
clientName: string;
|
|
79
79
|
provider: string;
|
|
80
|
+
/** Where the client is sent once the user approves. */
|
|
81
|
+
redirectUri?: string;
|
|
80
82
|
scope: string[];
|
|
81
83
|
timestamp: number;
|
|
82
84
|
transactionId: string;
|
|
@@ -346,6 +348,11 @@ interface OAuthTransaction {
|
|
|
346
348
|
clientCodeChallengeMethod: string;
|
|
347
349
|
/** Client ID from registration */
|
|
348
350
|
clientId: string;
|
|
351
|
+
/**
|
|
352
|
+
* Digest of the cookie held by the browser the consent screen was shown to.
|
|
353
|
+
* Approving the request and finishing it both take that cookie.
|
|
354
|
+
*/
|
|
355
|
+
consentBinding?: string;
|
|
349
356
|
/** Whether user consent was given */
|
|
350
357
|
consentGiven?: boolean;
|
|
351
358
|
/** Transaction creation timestamp */
|
|
@@ -578,8 +585,13 @@ declare class OAuthProxy {
|
|
|
578
585
|
constructor(config: OAuthProxyConfig);
|
|
579
586
|
/**
|
|
580
587
|
* OAuth authorization endpoint
|
|
588
|
+
*
|
|
589
|
+
* With consent required the response is the consent screen, and it sets the
|
|
590
|
+
* cookie that the request is approved and finished with: return its headers
|
|
591
|
+
* to the browser. Pass that browser's `request` as well, so that one with
|
|
592
|
+
* several authorization requests open keeps a single cookie for all of them.
|
|
581
593
|
*/
|
|
582
|
-
authorize(params: AuthorizationParams): Promise<Response>;
|
|
594
|
+
authorize(params: AuthorizationParams, request?: Request): Promise<Response>;
|
|
583
595
|
/**
|
|
584
596
|
* Stop cleanup interval and destroy resources
|
|
585
597
|
*/
|
|
@@ -663,6 +675,24 @@ declare class OAuthProxy {
|
|
|
663
675
|
* Periodic maintenance hook. Expiry is enforced by the token storage.
|
|
664
676
|
*/
|
|
665
677
|
private cleanup;
|
|
678
|
+
/**
|
|
679
|
+
* The cookie that ties consent requests to the browser they were shown to.
|
|
680
|
+
* A browser holds one, shared by every request it has open, and it lasts as
|
|
681
|
+
* long as a request does. `Lax` lets it travel with the provider's redirect
|
|
682
|
+
* back to the callback, which is a cross-site navigation. Over HTTPS the
|
|
683
|
+
* `__Host-` prefix keeps another host on the same site from setting it.
|
|
684
|
+
*/
|
|
685
|
+
private consentCookie;
|
|
686
|
+
private consentCookieName;
|
|
687
|
+
/**
|
|
688
|
+
* The consent cookie `request` carries, if it carries a well-formed one.
|
|
689
|
+
*
|
|
690
|
+
* Only the spaces and tabs that may surround a cookie are dropped. Trimming
|
|
691
|
+
* all white space would take a cookie whose name begins with, say, a
|
|
692
|
+
* no-break space for this one, and a browser does not hold such a name to
|
|
693
|
+
* the `__Host-` rules.
|
|
694
|
+
*/
|
|
695
|
+
private consentCookieValue;
|
|
666
696
|
/**
|
|
667
697
|
* Create a new OAuth transaction
|
|
668
698
|
*/
|
|
@@ -725,6 +755,14 @@ declare class OAuthProxy {
|
|
|
725
755
|
* Handle swap mode refresh - verify ViteMCP JWT and issue new tokens
|
|
726
756
|
*/
|
|
727
757
|
private handleSwapModeRefresh;
|
|
758
|
+
/**
|
|
759
|
+
* Whether `request` comes from the browser the transaction's consent screen
|
|
760
|
+
* was shown to: it carries the cookie that screen set. A transaction that
|
|
761
|
+
* never had a consent screen is bound to no browser.
|
|
762
|
+
*/
|
|
763
|
+
private isConsentBoundTo;
|
|
764
|
+
/** Whether browsers reach this proxy over HTTPS, going by its `baseUrl`. */
|
|
765
|
+
private isServedOverHttps;
|
|
728
766
|
/**
|
|
729
767
|
* Issue swapped tokens (JWT pattern)
|
|
730
768
|
* Issues short-lived ViteMCP JWTs and stores upstream tokens securely
|
package/dist/ViteMCP.cjs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkCJLWQH7Gcjs = require('./chunk-CJLWQH7G.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
@@ -25,8 +25,8 @@ var _chunkHDJEH7NKcjs = require('./chunk-HDJEH7NK.cjs');
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
var
|
|
29
|
-
require('./chunk-
|
|
28
|
+
var _chunkR3JUTGZLcjs = require('./chunk-R3JUTGZL.cjs');
|
|
29
|
+
require('./chunk-NZGRSB2D.cjs');
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
@@ -52,5 +52,5 @@ require('./chunk-QPVEGWOL.cjs');
|
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
exports.AuthProvider =
|
|
55
|
+
exports.AuthProvider = _chunkR3JUTGZLcjs.AuthProvider; exports.AzureProvider = _chunkR3JUTGZLcjs.AzureProvider; exports.DiscoveryDocumentCache = _chunkCJLWQH7Gcjs.DiscoveryDocumentCache; exports.GitHubProvider = _chunkR3JUTGZLcjs.GitHubProvider; exports.GoogleProvider = _chunkR3JUTGZLcjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunkCJLWQH7Gcjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunkR3JUTGZLcjs.OAuthProvider; exports.OAuthProxy = _chunkR3JUTGZLcjs.OAuthProxy; exports.OAuthProxyError = _chunkR3JUTGZLcjs.OAuthProxyError; exports.ServerState = _chunkCJLWQH7Gcjs.ServerState; exports.UnexpectedStateError = _chunkCJLWQH7Gcjs.UnexpectedStateError; exports.UserError = _chunkCJLWQH7Gcjs.UserError; exports.ViteMCP = _chunkCJLWQH7Gcjs.ViteMCP; exports.ViteMCPError = _chunkCJLWQH7Gcjs.ViteMCPError; exports.audioContent = _chunkCJLWQH7Gcjs.audioContent; exports.delay = _chunkCJLWQH7Gcjs.delay; exports.getAuthSession = _chunkR3JUTGZLcjs.getAuthSession; exports.imageContent = _chunkCJLWQH7Gcjs.imageContent; exports.jsonSchemaAdapter = _chunkCJLWQH7Gcjs.jsonSchemaAdapter; exports.requireAll = _chunkR3JUTGZLcjs.requireAll; exports.requireAny = _chunkR3JUTGZLcjs.requireAny; exports.requireAuth = _chunkR3JUTGZLcjs.requireAuth; exports.requireRole = _chunkR3JUTGZLcjs.requireRole; exports.requireScopes = _chunkR3JUTGZLcjs.requireScopes;
|
|
56
56
|
//# sourceMappingURL=ViteMCP.cjs.map
|
package/dist/ViteMCP.d.cts
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-
|
|
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-
|
|
7
|
+
import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-STkC4R2N.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-STkC4R2N.cjs';
|
|
9
9
|
|
|
10
10
|
declare class DiscoveryDocumentCache {
|
|
11
11
|
#private;
|
|
@@ -364,6 +364,17 @@ type ServerOptions<T extends ViteMCPAuth> = {
|
|
|
364
364
|
icons?: Icon[];
|
|
365
365
|
instructions?: string;
|
|
366
366
|
logger?: Logger;
|
|
367
|
+
/**
|
|
368
|
+
* Most array elements and object members, counted together, that one
|
|
369
|
+
* `tools/call` may carry in its arguments (default: 10,000). A call over it
|
|
370
|
+
* gets an error result before any schema sees it. Pass `Infinity` to lift
|
|
371
|
+
* the limit.
|
|
372
|
+
*
|
|
373
|
+
* `httpStream.maxBodySize` alone does not bound the cost of validating a
|
|
374
|
+
* call: half a million invalid elements fit in 1 MiB, and Zod kept half a
|
|
375
|
+
* gigabyte of issues reporting them.
|
|
376
|
+
*/
|
|
377
|
+
maxToolInputElements?: number;
|
|
367
378
|
name: string;
|
|
368
379
|
oauth?: {
|
|
369
380
|
authorizationServer?: Record<string, unknown>;
|
|
@@ -457,8 +468,14 @@ declare class ViteMCP<T extends ViteMCPAuth = ViteMCPAuth> {
|
|
|
457
468
|
/**
|
|
458
469
|
* Resolves a resource (or resource template) URI to an embeddable resource
|
|
459
470
|
* body, for returning inline from a tool.
|
|
471
|
+
*
|
|
472
|
+
* Pass the calling tool's `context` to resolve the URI as `resources/read`
|
|
473
|
+
* would for that caller: the loader receives that context, `auth` included,
|
|
474
|
+
* and a resource or template whose `canAccess` refuses the caller is not
|
|
475
|
+
* found. Without one, the loader runs outside any request, with `auth`
|
|
476
|
+
* undefined, and `canAccess` is not consulted.
|
|
460
477
|
*/
|
|
461
|
-
embedded(uri: string): Promise<LoadedResource>;
|
|
478
|
+
embedded(uri: string, context?: LoadContext<T>): Promise<LoadedResource>;
|
|
462
479
|
/** The Hono app serving the HTTP transport, for mounting custom routes. */
|
|
463
480
|
getApp(): Hono;
|
|
464
481
|
/**
|
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-
|
|
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-
|
|
7
|
+
import { A as AuthProvider, O as OAuthSession, a as OAuthProxy } from './OAuthProvider-STkC4R2N.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-STkC4R2N.js';
|
|
9
9
|
|
|
10
10
|
declare class DiscoveryDocumentCache {
|
|
11
11
|
#private;
|
|
@@ -364,6 +364,17 @@ type ServerOptions<T extends ViteMCPAuth> = {
|
|
|
364
364
|
icons?: Icon[];
|
|
365
365
|
instructions?: string;
|
|
366
366
|
logger?: Logger;
|
|
367
|
+
/**
|
|
368
|
+
* Most array elements and object members, counted together, that one
|
|
369
|
+
* `tools/call` may carry in its arguments (default: 10,000). A call over it
|
|
370
|
+
* gets an error result before any schema sees it. Pass `Infinity` to lift
|
|
371
|
+
* the limit.
|
|
372
|
+
*
|
|
373
|
+
* `httpStream.maxBodySize` alone does not bound the cost of validating a
|
|
374
|
+
* call: half a million invalid elements fit in 1 MiB, and Zod kept half a
|
|
375
|
+
* gigabyte of issues reporting them.
|
|
376
|
+
*/
|
|
377
|
+
maxToolInputElements?: number;
|
|
367
378
|
name: string;
|
|
368
379
|
oauth?: {
|
|
369
380
|
authorizationServer?: Record<string, unknown>;
|
|
@@ -457,8 +468,14 @@ declare class ViteMCP<T extends ViteMCPAuth = ViteMCPAuth> {
|
|
|
457
468
|
/**
|
|
458
469
|
* Resolves a resource (or resource template) URI to an embeddable resource
|
|
459
470
|
* body, for returning inline from a tool.
|
|
471
|
+
*
|
|
472
|
+
* Pass the calling tool's `context` to resolve the URI as `resources/read`
|
|
473
|
+
* would for that caller: the loader receives that context, `auth` included,
|
|
474
|
+
* and a resource or template whose `canAccess` refuses the caller is not
|
|
475
|
+
* found. Without one, the loader runs outside any request, with `auth`
|
|
476
|
+
* undefined, and `canAccess` is not consulted.
|
|
460
477
|
*/
|
|
461
|
-
embedded(uri: string): Promise<LoadedResource>;
|
|
478
|
+
embedded(uri: string, context?: LoadContext<T>): Promise<LoadedResource>;
|
|
462
479
|
/** The Hono app serving the HTTP transport, for mounting custom routes. */
|
|
463
480
|
getApp(): Hono;
|
|
464
481
|
/**
|
package/dist/ViteMCP.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
delay,
|
|
11
11
|
imageContent,
|
|
12
12
|
jsonSchemaAdapter
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-BMW6BWBO.js";
|
|
14
14
|
import {
|
|
15
15
|
AuthProvider,
|
|
16
16
|
AzureProvider,
|
|
@@ -25,8 +25,8 @@ import {
|
|
|
25
25
|
requireAuth,
|
|
26
26
|
requireRole,
|
|
27
27
|
requireScopes
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import "./chunk-
|
|
28
|
+
} from "./chunk-AOZIQIXA.js";
|
|
29
|
+
import "./chunk-BLXUZUZ4.js";
|
|
30
30
|
export {
|
|
31
31
|
AuthProvider,
|
|
32
32
|
AzureProvider,
|
package/dist/auth/index.cjs
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var _chunkR3JUTGZLcjs = require('../chunk-R3JUTGZL.cjs');
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
@@ -51,5 +51,5 @@ var _chunkTWYBLPRQcjs = require('../chunk-TWYBLPRQ.cjs');
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
exports.AuthProvider =
|
|
54
|
+
exports.AuthProvider = _chunkR3JUTGZLcjs.AuthProvider; exports.AzureProvider = _chunkR3JUTGZLcjs.AzureProvider; exports.ConsentManager = _chunkR3JUTGZLcjs.ConsentManager; exports.DEFAULT_ACCESS_TOKEN_TTL = _chunkR3JUTGZLcjs.DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = _chunkR3JUTGZLcjs.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_AUTHORIZATION_CODE_TTL = _chunkR3JUTGZLcjs.DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_REFRESH_TOKEN_TTL = _chunkR3JUTGZLcjs.DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_TRANSACTION_TTL = _chunkR3JUTGZLcjs.DEFAULT_TRANSACTION_TTL; exports.DiskStore = _chunkR3JUTGZLcjs.DiskStore; exports.EncryptedTokenStorage = _chunkR3JUTGZLcjs.EncryptedTokenStorage; exports.GitHubProvider = _chunkR3JUTGZLcjs.GitHubProvider; exports.GoogleProvider = _chunkR3JUTGZLcjs.GoogleProvider; exports.JWKSVerifier = _chunkR3JUTGZLcjs.JWKSVerifier; exports.JWTIssuer = _chunkR3JUTGZLcjs.JWTIssuer; exports.MemoryTokenStorage = _chunkR3JUTGZLcjs.MemoryTokenStorage; exports.OAuthProvider = _chunkR3JUTGZLcjs.OAuthProvider; exports.OAuthProxy = _chunkR3JUTGZLcjs.OAuthProxy; exports.OAuthProxyError = _chunkR3JUTGZLcjs.OAuthProxyError; exports.PKCEUtils = _chunkR3JUTGZLcjs.PKCEUtils; exports.getAuthSession = _chunkR3JUTGZLcjs.getAuthSession; exports.requireAll = _chunkR3JUTGZLcjs.requireAll; exports.requireAny = _chunkR3JUTGZLcjs.requireAny; exports.requireAuth = _chunkR3JUTGZLcjs.requireAuth; exports.requireRole = _chunkR3JUTGZLcjs.requireRole; exports.requireScopes = _chunkR3JUTGZLcjs.requireScopes;
|
|
55
55
|
//# sourceMappingURL=index.cjs.map
|
package/dist/auth/index.d.cts
CHANGED
|
@@ -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-
|
|
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-
|
|
1
|
+
import { q as OAuthTransaction, C as ConsentData, T as TokenStorage, s as TokenVerifier, t as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-STkC4R2N.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-STkC4R2N.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Consent Management
|
|
@@ -14,8 +14,15 @@ declare class ConsentManager {
|
|
|
14
14
|
constructor(signingKey: string);
|
|
15
15
|
/**
|
|
16
16
|
* Create HTTP response with consent screen
|
|
17
|
+
*
|
|
18
|
+
* `cookie` is a `Set-Cookie` value that ties the request to the browser the
|
|
19
|
+
* screen is shown to. The screen may not be framed: a page that embeds it
|
|
20
|
+
* could have the user approve without seeing what they are approving.
|
|
17
21
|
*/
|
|
18
|
-
createConsentResponse(transaction: OAuthTransaction, provider: string
|
|
22
|
+
createConsentResponse(transaction: OAuthTransaction, provider: string, options?: {
|
|
23
|
+
clientName?: string;
|
|
24
|
+
cookie?: string;
|
|
25
|
+
}): Response;
|
|
19
26
|
/**
|
|
20
27
|
* Generate HTML for consent screen
|
|
21
28
|
*
|
|
@@ -33,6 +40,13 @@ declare class ConsentManager {
|
|
|
33
40
|
* Validate and parse consent cookie
|
|
34
41
|
*/
|
|
35
42
|
validateConsentCookie(cookie: string): ConsentData | null;
|
|
43
|
+
/**
|
|
44
|
+
* Where a redirect URI leads, as the browser will read it rather than as it
|
|
45
|
+
* was typed: the parsed host, so that a look-alike character, a tab or a
|
|
46
|
+
* backslash shows for what it does. A long host keeps its end, which is the
|
|
47
|
+
* part that says whose it is.
|
|
48
|
+
*/
|
|
49
|
+
private describeDestination;
|
|
36
50
|
/**
|
|
37
51
|
* Escape HTML to prevent XSS
|
|
38
52
|
*/
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -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-
|
|
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-
|
|
1
|
+
import { q as OAuthTransaction, C as ConsentData, T as TokenStorage, s as TokenVerifier, t as TokenVerificationResult, P as PKCEPair } from '../OAuthProvider-STkC4R2N.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-STkC4R2N.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Consent Management
|
|
@@ -14,8 +14,15 @@ declare class ConsentManager {
|
|
|
14
14
|
constructor(signingKey: string);
|
|
15
15
|
/**
|
|
16
16
|
* Create HTTP response with consent screen
|
|
17
|
+
*
|
|
18
|
+
* `cookie` is a `Set-Cookie` value that ties the request to the browser the
|
|
19
|
+
* screen is shown to. The screen may not be framed: a page that embeds it
|
|
20
|
+
* could have the user approve without seeing what they are approving.
|
|
17
21
|
*/
|
|
18
|
-
createConsentResponse(transaction: OAuthTransaction, provider: string
|
|
22
|
+
createConsentResponse(transaction: OAuthTransaction, provider: string, options?: {
|
|
23
|
+
clientName?: string;
|
|
24
|
+
cookie?: string;
|
|
25
|
+
}): Response;
|
|
19
26
|
/**
|
|
20
27
|
* Generate HTML for consent screen
|
|
21
28
|
*
|
|
@@ -33,6 +40,13 @@ declare class ConsentManager {
|
|
|
33
40
|
* Validate and parse consent cookie
|
|
34
41
|
*/
|
|
35
42
|
validateConsentCookie(cookie: string): ConsentData | null;
|
|
43
|
+
/**
|
|
44
|
+
* Where a redirect URI leads, as the browser will read it rather than as it
|
|
45
|
+
* was typed: the parsed host, so that a look-alike character, a tab or a
|
|
46
|
+
* backslash shows for what it does. A long host keeps its end, which is the
|
|
47
|
+
* part that says whose it is.
|
|
48
|
+
*/
|
|
49
|
+
private describeDestination;
|
|
36
50
|
/**
|
|
37
51
|
* Escape HTML to prevent XSS
|
|
38
52
|
*/
|