@mastra/mcp 1.0.0-beta.1 → 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +292 -0
- package/README.md +250 -24
- package/dist/__fixtures__/tools.d.ts +8 -5
- package/dist/__fixtures__/tools.d.ts.map +1 -1
- package/dist/client/{elicitationActions.d.ts → actions/elicitation.d.ts} +2 -2
- package/dist/client/actions/elicitation.d.ts.map +1 -0
- package/dist/client/actions/progress.d.ts +23 -0
- package/dist/client/actions/progress.d.ts.map +1 -0
- package/dist/client/{promptActions.d.ts → actions/prompt.d.ts} +2 -2
- package/dist/client/actions/prompt.d.ts.map +1 -0
- package/dist/client/{resourceActions.d.ts → actions/resource.d.ts} +2 -2
- package/dist/client/actions/resource.d.ts.map +1 -0
- package/dist/client/client.d.ts +79 -132
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/configuration.d.ts +23 -1
- package/dist/client/configuration.d.ts.map +1 -1
- package/dist/client/index.d.ts +3 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/oauth-provider.d.ts +230 -0
- package/dist/client/oauth-provider.d.ts.map +1 -0
- package/dist/client/types.d.ts +237 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/docs/README.md +33 -0
- package/dist/docs/SKILL.md +46 -0
- package/dist/docs/SOURCE_MAP.json +59 -0
- package/dist/docs/mcp/01-overview.md +372 -0
- package/dist/docs/mcp/02-publishing-mcp-server.md +111 -0
- package/dist/docs/tools/01-reference.md +2306 -0
- package/dist/docs/tools-mcp/01-mcp-overview.md +384 -0
- package/dist/index.cjs +844 -107
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +767 -92
- package/dist/index.js.map +1 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/oauth-middleware.d.ts +142 -0
- package/dist/server/oauth-middleware.d.ts.map +1 -0
- package/dist/server/server.d.ts +20 -4
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/types.d.ts +11 -4
- package/dist/server/types.d.ts.map +1 -1
- package/dist/shared/index.d.ts +2 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/oauth-types.d.ts +137 -0
- package/dist/shared/oauth-types.d.ts.map +1 -0
- package/package.json +17 -14
- package/dist/client/elicitationActions.d.ts.map +0 -1
- package/dist/client/promptActions.d.ts.map +0 -1
- package/dist/client/resourceActions.d.ts.map +0 -1
package/dist/server/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth Middleware for MCP Server
|
|
3
|
+
*
|
|
4
|
+
* Implements OAuth 2.0 Protected Resource support per RFC 9728 for MCP servers.
|
|
5
|
+
* This allows MCP servers to require OAuth authentication from clients.
|
|
6
|
+
*
|
|
7
|
+
* @see https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization
|
|
8
|
+
* @see https://www.rfc-editor.org/rfc/rfc9728.html
|
|
9
|
+
*/
|
|
10
|
+
import type * as http from 'node:http';
|
|
11
|
+
import type { MCPServerOAuthConfig, TokenValidationResult } from '../shared/oauth-types.js';
|
|
12
|
+
/**
|
|
13
|
+
* Simple logger interface for OAuth middleware.
|
|
14
|
+
*/
|
|
15
|
+
interface OAuthMiddlewareLogger {
|
|
16
|
+
debug?: (message: string, ...args: unknown[]) => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Options for the OAuth middleware.
|
|
20
|
+
*/
|
|
21
|
+
export interface OAuthMiddlewareOptions {
|
|
22
|
+
/**
|
|
23
|
+
* OAuth configuration for the MCP server.
|
|
24
|
+
*/
|
|
25
|
+
oauth: MCPServerOAuthConfig;
|
|
26
|
+
/**
|
|
27
|
+
* Path where the MCP endpoint is served.
|
|
28
|
+
* @default '/mcp'
|
|
29
|
+
*/
|
|
30
|
+
mcpPath?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Logger instance for debugging.
|
|
33
|
+
*/
|
|
34
|
+
logger?: OAuthMiddlewareLogger;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Result of the middleware check.
|
|
38
|
+
*/
|
|
39
|
+
export interface OAuthMiddlewareResult {
|
|
40
|
+
/**
|
|
41
|
+
* Whether the request should proceed.
|
|
42
|
+
*/
|
|
43
|
+
proceed: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* If false, the response has already been sent.
|
|
46
|
+
*/
|
|
47
|
+
handled: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Token validation result if authentication was attempted.
|
|
50
|
+
*/
|
|
51
|
+
tokenValidation?: TokenValidationResult;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Creates an OAuth middleware function for protecting MCP server endpoints.
|
|
55
|
+
*
|
|
56
|
+
* This middleware:
|
|
57
|
+
* 1. Serves Protected Resource Metadata at `/.well-known/oauth-protected-resource`
|
|
58
|
+
* 2. Validates bearer tokens on protected endpoints
|
|
59
|
+
* 3. Returns proper 401 responses with WWW-Authenticate headers
|
|
60
|
+
*
|
|
61
|
+
* @param options - Middleware configuration
|
|
62
|
+
* @returns Middleware function that returns whether request should proceed
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* import http from 'node:http';
|
|
67
|
+
* import { MCPServer, createOAuthMiddleware } from '@mastra/mcp';
|
|
68
|
+
*
|
|
69
|
+
* const server = new MCPServer({ name: 'Protected Server', version: '1.0.0', tools: {} });
|
|
70
|
+
*
|
|
71
|
+
* const oauthMiddleware = createOAuthMiddleware({
|
|
72
|
+
* oauth: {
|
|
73
|
+
* resource: 'https://mcp.example.com/mcp',
|
|
74
|
+
* authorizationServers: ['https://auth.example.com'],
|
|
75
|
+
* validateToken: async (token, resource) => {
|
|
76
|
+
* // Your token validation logic here
|
|
77
|
+
* return { valid: true, scopes: ['mcp:read', 'mcp:write'] };
|
|
78
|
+
* },
|
|
79
|
+
* },
|
|
80
|
+
* });
|
|
81
|
+
*
|
|
82
|
+
* const httpServer = http.createServer(async (req, res) => {
|
|
83
|
+
* const url = new URL(req.url || '', 'http://localhost:3000');
|
|
84
|
+
*
|
|
85
|
+
* // Apply OAuth middleware first
|
|
86
|
+
* const result = await oauthMiddleware(req, res, url);
|
|
87
|
+
* if (!result.proceed) return; // Middleware handled the response
|
|
88
|
+
*
|
|
89
|
+
* // Continue to MCP handler
|
|
90
|
+
* await server.startHTTP({ url, httpPath: '/mcp', req, res });
|
|
91
|
+
* });
|
|
92
|
+
*
|
|
93
|
+
* httpServer.listen(3000);
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export declare function createOAuthMiddleware(options: OAuthMiddlewareOptions): (req: http.IncomingMessage, res: http.ServerResponse, url: URL) => Promise<OAuthMiddlewareResult>;
|
|
97
|
+
/**
|
|
98
|
+
* Helper to create a simple token validator that checks against a list of valid tokens.
|
|
99
|
+
*
|
|
100
|
+
* Useful for testing and development. For production, use a proper JWT validator
|
|
101
|
+
* or call your authorization server's introspection endpoint.
|
|
102
|
+
*
|
|
103
|
+
* @param validTokens - Array of valid token strings
|
|
104
|
+
* @returns Token validation function
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* const validateToken = createStaticTokenValidator(['secret-token-1', 'secret-token-2']);
|
|
109
|
+
*
|
|
110
|
+
* const middleware = createOAuthMiddleware({
|
|
111
|
+
* oauth: {
|
|
112
|
+
* resource: 'https://mcp.example.com/mcp',
|
|
113
|
+
* authorizationServers: ['https://auth.example.com'],
|
|
114
|
+
* validateToken,
|
|
115
|
+
* },
|
|
116
|
+
* });
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
export declare function createStaticTokenValidator(validTokens: string[]): MCPServerOAuthConfig['validateToken'];
|
|
120
|
+
/**
|
|
121
|
+
* Creates a token validator that calls an introspection endpoint.
|
|
122
|
+
*
|
|
123
|
+
* Per RFC 7662, the introspection endpoint returns token metadata.
|
|
124
|
+
*
|
|
125
|
+
* @param introspectionEndpoint - URL of the token introspection endpoint
|
|
126
|
+
* @param clientCredentials - Optional client credentials for authenticated introspection
|
|
127
|
+
* @returns Token validation function
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```typescript
|
|
131
|
+
* const validateToken = createIntrospectionValidator(
|
|
132
|
+
* 'https://auth.example.com/oauth/introspect',
|
|
133
|
+
* { clientId: 'mcp-server', clientSecret: 'secret' }
|
|
134
|
+
* );
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
export declare function createIntrospectionValidator(introspectionEndpoint: string, clientCredentials?: {
|
|
138
|
+
clientId: string;
|
|
139
|
+
clientSecret: string;
|
|
140
|
+
}): MCPServerOAuthConfig['validateToken'];
|
|
141
|
+
export {};
|
|
142
|
+
//# sourceMappingURL=oauth-middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-middleware.d.ts","sourceRoot":"","sources":["../../src/server/oauth-middleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAC;AAEvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAO5F;;GAEG;AACH,UAAU,qBAAqB;IAC7B,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CACvD;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,KAAK,EAAE,oBAAoB,CAAC;IAE5B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,MAAM,CAAC,EAAE,qBAAqB,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,eAAe,CAAC,EAAE,qBAAqB,CAAC;CACzC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,IASjE,KAAK,IAAI,CAAC,eAAe,EACzB,KAAK,IAAI,CAAC,cAAc,EACxB,KAAK,GAAG,KACP,OAAO,CAAC,qBAAqB,CAAC,CA4FlC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,oBAAoB,CAAC,eAAe,CAAC,CAYvG;AAqBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,4BAA4B,CAC1C,qBAAqB,EAAE,MAAM,EAC7B,iBAAiB,CAAC,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAC7D,oBAAoB,CAAC,eAAe,CAAC,CAgFvC"}
|
package/dist/server/server.d.ts
CHANGED
|
@@ -187,9 +187,25 @@ export declare class MCPServer extends MCPServerBase {
|
|
|
187
187
|
*
|
|
188
188
|
* @param request - The elicitation request containing message and schema
|
|
189
189
|
* @param serverInstance - Optional server instance to use; defaults to main server for backward compatibility
|
|
190
|
+
* @param options - Optional request options (timeout, signal, etc.)
|
|
190
191
|
* @returns Promise that resolves to the client's response
|
|
191
192
|
*/
|
|
192
193
|
private handleElicitationRequest;
|
|
194
|
+
/**
|
|
195
|
+
* Reads and parses the JSON body from an HTTP request.
|
|
196
|
+
* If the request body was already parsed by middleware (e.g., express.json()),
|
|
197
|
+
* it uses the pre-parsed body from req.body. Otherwise, it reads from the stream.
|
|
198
|
+
*
|
|
199
|
+
* This allows the MCP server to work with Express apps that use express.json()
|
|
200
|
+
* globally without requiring special route exclusions.
|
|
201
|
+
*
|
|
202
|
+
* @param req - The incoming HTTP request
|
|
203
|
+
* @param options - Optional configuration
|
|
204
|
+
* @param options.preParsedOnly - If true, only return pre-parsed body from middleware,
|
|
205
|
+
* returning undefined if not available. This allows the caller to fall back to
|
|
206
|
+
* their own body reading logic (e.g., SDK's getRawBody with size limits).
|
|
207
|
+
*/
|
|
208
|
+
private readJsonBody;
|
|
193
209
|
/**
|
|
194
210
|
* Creates a new Server instance configured with all handlers for HTTP sessions.
|
|
195
211
|
* Each HTTP client connection gets its own Server instance to avoid routing conflicts.
|
|
@@ -256,7 +272,7 @@ export declare class MCPServer extends MCPServerBase {
|
|
|
256
272
|
*
|
|
257
273
|
* @example
|
|
258
274
|
* ```typescript
|
|
259
|
-
* import http from 'http';
|
|
275
|
+
* import http from 'node:http';
|
|
260
276
|
*
|
|
261
277
|
* const httpServer = http.createServer(async (req, res) => {
|
|
262
278
|
* await server.startSSE({
|
|
@@ -330,8 +346,8 @@ export declare class MCPServer extends MCPServerBase {
|
|
|
330
346
|
*
|
|
331
347
|
* @example
|
|
332
348
|
* ```typescript
|
|
333
|
-
* import http from 'http';
|
|
334
|
-
* import { randomUUID } from 'crypto';
|
|
349
|
+
* import http from 'node:http';
|
|
350
|
+
* import { randomUUID } from 'node:crypto';
|
|
335
351
|
*
|
|
336
352
|
* const httpServer = http.createServer(async (req, res) => {
|
|
337
353
|
* await server.startHTTP({
|
|
@@ -375,7 +391,7 @@ export declare class MCPServer extends MCPServerBase {
|
|
|
375
391
|
httpPath: string;
|
|
376
392
|
req: http.IncomingMessage;
|
|
377
393
|
res: http.ServerResponse<http.IncomingMessage>;
|
|
378
|
-
options?: StreamableHTTPServerTransportOptions & {
|
|
394
|
+
options?: Partial<StreamableHTTPServerTransportOptions> & {
|
|
379
395
|
serverless?: boolean;
|
|
380
396
|
};
|
|
381
397
|
}): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server/server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAA+B,MAAM,oBAAoB,CAAC;AAErG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,oDAAoD,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server/server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,uBAAuB,E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ACI,aAAa,IAAI,UAAU;IAclC;;;;;;;;;;;;;;OAcG;IACI,eAAe,IAAI,gBAAgB;IAS1C;;;;;;;;;;;;;;;;OAgBG;IACI,eAAe,IAAI;QACxB,KAAK,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,WAAW,CAAC,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,GAAG,CAAC;YAAC,YAAY,CAAC,EAAE,GAAG,CAAC;YAAC,QAAQ,CAAC,EAAE,WAAW,CAAA;SAAE,CAAC,CAAC;KACpH;IAcD;;;;;;;;;;;;;;;;;OAiBG;IACI,WAAW,CAChB,MAAM,EAAE,MAAM,GACb;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,GAAG,CAAC;QAAC,YAAY,CAAC,EAAE,GAAG,CAAC;QAAC,QAAQ,CAAC,EAAE,WAAW,CAAA;KAAE,GAAG,SAAS;IAgBnH;;;;;;;;;;;;;;;;;;;;;OAqBG;IACU,WAAW,CACtB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,GAAG,EACT,gBAAgB,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GAC3D,OAAO,CAAC,GAAG,CAAC;CAiFhB"}
|
package/dist/server/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
1
|
+
import type { RequestHandlerExtra, RequestOptions } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
2
2
|
import type { ElicitRequest, ElicitResult, Prompt, PromptMessage, Resource, ResourceTemplate } from '@modelcontextprotocol/sdk/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Callback function to retrieve content for a specific resource.
|
|
@@ -70,8 +70,14 @@ export type MCPServerPrompts = {
|
|
|
70
70
|
* Actions for handling elicitation requests (interactive user input collection).
|
|
71
71
|
*/
|
|
72
72
|
export type ElicitationActions = {
|
|
73
|
-
/**
|
|
74
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Function to send an elicitation request to the client.
|
|
75
|
+
*
|
|
76
|
+
* @param request - The elicitation request parameters
|
|
77
|
+
* @param options - Optional request options (timeout, signal, etc.)
|
|
78
|
+
* @returns Promise resolving to the client's elicitation response
|
|
79
|
+
*/
|
|
80
|
+
sendRequest: (request: ElicitRequest['params'], options?: RequestOptions) => Promise<ElicitResult>;
|
|
75
81
|
};
|
|
76
82
|
/**
|
|
77
83
|
* Extra context passed to MCP request handlers.
|
|
@@ -82,6 +88,7 @@ export type MCPRequestHandlerExtra = RequestHandlerExtra<any, any>;
|
|
|
82
88
|
*
|
|
83
89
|
* - `Resource`: Represents a data resource exposed by the server
|
|
84
90
|
* - `ResourceTemplate`: URI template for dynamic resource generation
|
|
91
|
+
* - `RequestOptions`: Options for MCP requests (timeout, signal, etc.)
|
|
85
92
|
*/
|
|
86
|
-
export type { Resource, ResourceTemplate };
|
|
93
|
+
export type { Resource, ResourceTemplate, RequestOptions };
|
|
87
94
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/server/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/server/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AACxG,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,MAAM,EACN,aAAa,EACb,QAAQ,EACR,gBAAgB,EACjB,MAAM,oCAAoC,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,MAAM,gCAAgC,GAAG,CAAC,EAC9C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C,EAAE,+BAA+B,CAAC;CACrD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;;;;OAMG;IACH,WAAW,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;CACpG,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAEnE;;;;;;GAMG;AACH,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth Types for MCP Authentication
|
|
3
|
+
*
|
|
4
|
+
* Re-exports and extends OAuth types from the MCP SDK for use in Mastra's
|
|
5
|
+
* MCP client and server implementations.
|
|
6
|
+
*
|
|
7
|
+
* @see https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization
|
|
8
|
+
*/
|
|
9
|
+
import type { OAuthProtectedResourceMetadata as SDKOAuthProtectedResourceMetadata } from '@modelcontextprotocol/sdk/shared/auth.js';
|
|
10
|
+
export type { OAuthMetadata, OAuthTokens, OAuthErrorResponse, OAuthClientMetadata, OAuthClientInformation, OAuthClientInformationFull, OAuthClientRegistrationError, OAuthTokenRevocationRequest, OAuthProtectedResourceMetadata, AuthorizationServerMetadata, } from '@modelcontextprotocol/sdk/shared/auth.js';
|
|
11
|
+
export { auth, discoverOAuthProtectedResourceMetadata, discoverOAuthMetadata, discoverAuthorizationServerMetadata, startAuthorization, exchangeAuthorization, refreshAuthorization, registerClient, extractResourceMetadataUrl, selectResourceURL, parseErrorResponse, UnauthorizedError, buildDiscoveryUrls, } from '@modelcontextprotocol/sdk/client/auth.js';
|
|
12
|
+
export type { OAuthClientProvider, AuthResult } from '@modelcontextprotocol/sdk/client/auth.js';
|
|
13
|
+
/**
|
|
14
|
+
* Configuration for OAuth-protected MCP server.
|
|
15
|
+
*
|
|
16
|
+
* Used to configure Protected Resource Metadata (RFC 9728) and
|
|
17
|
+
* token validation for MCP servers that require OAuth authentication.
|
|
18
|
+
*/
|
|
19
|
+
export interface MCPServerOAuthConfig {
|
|
20
|
+
/**
|
|
21
|
+
* The resource identifier URI for this MCP server.
|
|
22
|
+
* This MUST be the canonical URL of the MCP server.
|
|
23
|
+
*
|
|
24
|
+
* @example 'https://mcp.example.com/mcp'
|
|
25
|
+
*/
|
|
26
|
+
resource: string;
|
|
27
|
+
/**
|
|
28
|
+
* URLs of authorization servers that can issue tokens for this resource.
|
|
29
|
+
* At least one authorization server should be specified.
|
|
30
|
+
*
|
|
31
|
+
* @example ['https://auth.example.com']
|
|
32
|
+
*/
|
|
33
|
+
authorizationServers: string[];
|
|
34
|
+
/**
|
|
35
|
+
* Scopes supported by this MCP server.
|
|
36
|
+
*
|
|
37
|
+
* @default ['mcp:read', 'mcp:write']
|
|
38
|
+
*/
|
|
39
|
+
scopesSupported?: string[];
|
|
40
|
+
/**
|
|
41
|
+
* Human-readable name of this resource server.
|
|
42
|
+
*/
|
|
43
|
+
resourceName?: string;
|
|
44
|
+
/**
|
|
45
|
+
* URL to documentation about this resource server.
|
|
46
|
+
*/
|
|
47
|
+
resourceDocumentation?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Custom function to validate access tokens.
|
|
50
|
+
*
|
|
51
|
+
* If not provided, tokens are accepted without validation
|
|
52
|
+
* (useful for testing but NOT recommended for production).
|
|
53
|
+
*
|
|
54
|
+
* @param token - The bearer token from the Authorization header
|
|
55
|
+
* @param resource - The resource URI this server represents
|
|
56
|
+
* @returns Promise resolving to validation result
|
|
57
|
+
*/
|
|
58
|
+
validateToken?: (token: string, resource: string) => Promise<TokenValidationResult>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Result of token validation.
|
|
62
|
+
*/
|
|
63
|
+
export interface TokenValidationResult {
|
|
64
|
+
/**
|
|
65
|
+
* Whether the token is valid.
|
|
66
|
+
*/
|
|
67
|
+
valid: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* If invalid, the reason for rejection.
|
|
70
|
+
*/
|
|
71
|
+
error?: string;
|
|
72
|
+
/**
|
|
73
|
+
* If invalid, a more detailed error description.
|
|
74
|
+
*/
|
|
75
|
+
errorDescription?: string;
|
|
76
|
+
/**
|
|
77
|
+
* The scopes granted by this token.
|
|
78
|
+
*/
|
|
79
|
+
scopes?: string[];
|
|
80
|
+
/**
|
|
81
|
+
* The subject (user) identifier from the token.
|
|
82
|
+
*/
|
|
83
|
+
subject?: string;
|
|
84
|
+
/**
|
|
85
|
+
* When the token expires (Unix timestamp).
|
|
86
|
+
*/
|
|
87
|
+
expiresAt?: number;
|
|
88
|
+
/**
|
|
89
|
+
* Additional claims from the token.
|
|
90
|
+
*/
|
|
91
|
+
claims?: Record<string, unknown>;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Options for OAuth-related HTTP responses.
|
|
95
|
+
*/
|
|
96
|
+
export interface OAuthResponseOptions {
|
|
97
|
+
/**
|
|
98
|
+
* URL to the Protected Resource Metadata endpoint.
|
|
99
|
+
*/
|
|
100
|
+
resourceMetadataUrl?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Additional WWW-Authenticate parameters.
|
|
103
|
+
*/
|
|
104
|
+
additionalParams?: Record<string, string>;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Generates a WWW-Authenticate header value for OAuth 401 responses.
|
|
108
|
+
*
|
|
109
|
+
* @param options - Options for generating the header
|
|
110
|
+
* @returns The WWW-Authenticate header value
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* const header = generateWWWAuthenticateHeader({
|
|
115
|
+
* resourceMetadataUrl: 'https://mcp.example.com/.well-known/oauth-protected-resource',
|
|
116
|
+
* });
|
|
117
|
+
* // Returns: 'Bearer resource_metadata="https://mcp.example.com/.well-known/oauth-protected-resource"'
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
export declare function generateWWWAuthenticateHeader(options?: OAuthResponseOptions): string;
|
|
121
|
+
/**
|
|
122
|
+
* Generates Protected Resource Metadata (RFC 9728) JSON response.
|
|
123
|
+
*
|
|
124
|
+
* @param config - OAuth configuration for the MCP server
|
|
125
|
+
* @returns The Protected Resource Metadata object
|
|
126
|
+
*
|
|
127
|
+
* @see https://www.rfc-editor.org/rfc/rfc9728.html
|
|
128
|
+
*/
|
|
129
|
+
export declare function generateProtectedResourceMetadata(config: MCPServerOAuthConfig): SDKOAuthProtectedResourceMetadata;
|
|
130
|
+
/**
|
|
131
|
+
* Extracts the bearer token from an Authorization header.
|
|
132
|
+
*
|
|
133
|
+
* @param authHeader - The Authorization header value
|
|
134
|
+
* @returns The bearer token, or undefined if not present
|
|
135
|
+
*/
|
|
136
|
+
export declare function extractBearerToken(authHeader: string | null | undefined): string | undefined;
|
|
137
|
+
//# sourceMappingURL=oauth-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-types.d.ts","sourceRoot":"","sources":["../../src/shared/oauth-types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,8BAA8B,IAAI,iCAAiC,EAAE,MAAM,0CAA0C,CAAC;AAGpI,YAAY,EACV,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,0BAA0B,EAC1B,4BAA4B,EAC5B,2BAA2B,EAC3B,8BAA8B,EAC9B,2BAA2B,GAC5B,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EACL,IAAI,EACJ,sCAAsC,EACtC,qBAAqB,EACrB,mCAAmC,EACnC,kBAAkB,EACl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AC3C;AASD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,GAAE,oBAAyB,GAAG,MAAM,CAkBxF;AAED;;;;;;;GAOG;AACH,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,oBAAoB,GAAG,iCAAiC,CAWjH;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAU5F"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,10 +28,9 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@apidevtools/json-schema-ref-parser": "^14.2.1",
|
|
30
30
|
"@modelcontextprotocol/sdk": "^1.17.5",
|
|
31
|
-
"
|
|
32
|
-
"exit-hook": "^4.0.0",
|
|
31
|
+
"exit-hook": "^5.0.1",
|
|
33
32
|
"fast-deep-equal": "^3.1.3",
|
|
34
|
-
"uuid": "^
|
|
33
|
+
"uuid": "^13.0.0",
|
|
35
34
|
"zod-from-json-schema": "^0.5.0",
|
|
36
35
|
"zod-from-json-schema-v3": "npm:zod-from-json-schema@^0.0.5"
|
|
37
36
|
},
|
|
@@ -42,21 +41,22 @@
|
|
|
42
41
|
"devDependencies": {
|
|
43
42
|
"@hono/node-server": "^1.19.6",
|
|
44
43
|
"@mendable/firecrawl-js": "^1.29.3",
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
44
|
+
"@types/node": "22.13.17",
|
|
45
|
+
"@vitest/coverage-v8": "4.0.12",
|
|
46
|
+
"@vitest/ui": "4.0.12",
|
|
47
47
|
"ai": "^5.0.60",
|
|
48
48
|
"eslint": "^9.37.0",
|
|
49
|
+
"hono": "^4.11.3",
|
|
49
50
|
"hono-mcp-server-sse-transport": "0.0.7",
|
|
50
|
-
"hono": "^4.9.7",
|
|
51
51
|
"tsup": "^8.5.0",
|
|
52
52
|
"tsx": "^4.19.4",
|
|
53
|
-
"typescript": "^5.
|
|
54
|
-
"vitest": "
|
|
53
|
+
"typescript": "^5.9.3",
|
|
54
|
+
"vitest": "4.0.16",
|
|
55
55
|
"zod": "^3.25.76",
|
|
56
56
|
"zod-to-json-schema": "^3.24.6",
|
|
57
57
|
"@internal/types-builder": "0.0.28",
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
58
|
+
"@mastra/core": "1.0.0-beta.22",
|
|
59
|
+
"@internal/lint": "0.0.53"
|
|
60
60
|
},
|
|
61
61
|
"homepage": "https://mastra.ai",
|
|
62
62
|
"repository": {
|
|
@@ -71,10 +71,13 @@
|
|
|
71
71
|
"node": ">=22.13.0"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
|
-
"build": "tsup --silent --config tsup.config.ts",
|
|
75
|
-
"build:
|
|
74
|
+
"build:lib": "tsup --silent --config tsup.config.ts",
|
|
75
|
+
"build:docs": "pnpx tsx ../../scripts/generate-package-docs.ts packages/mcp",
|
|
76
|
+
"build:watch": "pnpm build:lib --watch",
|
|
77
|
+
"test:client": "vitest run ./src/client/client.test.ts",
|
|
78
|
+
"test:server": "vitest run ./src/server/server.test.ts",
|
|
76
79
|
"test:integration": "cd integration-tests && pnpm test:mcp",
|
|
77
|
-
"test": "pnpm test:
|
|
80
|
+
"test": "pnpm test:server && pnpm test:client && pnpm test:integration",
|
|
78
81
|
"lint": "eslint ."
|
|
79
82
|
}
|
|
80
83
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"elicitationActions.d.ts","sourceRoot":"","sources":["../../src/client/elicitationActions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,K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