@mastra/mcp 1.18.1-alpha.3 → 2.0.0-alpha.4
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/dist/client/actions/resource.d.ts +9 -59
- package/dist/client/actions/resource.d.ts.map +1 -1
- package/dist/client/client.d.ts +71 -124
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/configuration.d.ts +30 -120
- package/dist/client/configuration.d.ts.map +1 -1
- package/dist/client/error-utils.d.ts +9 -0
- package/dist/client/error-utils.d.ts.map +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/oauth-callback-server.d.ts +8 -4
- package/dist/client/oauth-callback-server.d.ts.map +1 -1
- package/dist/client/oauth-provider.d.ts +91 -45
- package/dist/client/oauth-provider.d.ts.map +1 -1
- package/dist/client/server-proxy.d.ts +26 -46
- package/dist/client/server-proxy.d.ts.map +1 -1
- package/dist/client/types.d.ts +106 -143
- package/dist/client/types.d.ts.map +1 -1
- package/dist/conformance/fixture.d.ts +3 -0
- package/dist/conformance/fixture.d.ts.map +1 -0
- package/dist/conformance/run.d.ts +2 -0
- package/dist/conformance/run.d.ts.map +1 -0
- package/dist/conformance/stdio-server.d.ts +2 -0
- package/dist/conformance/stdio-server.d.ts.map +1 -0
- package/dist/docs/SKILL.md +2 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-migrations-mcp-v2.md +268 -0
- package/dist/docs/references/reference-tools-mcp-client.md +36 -14
- package/dist/docs/references/reference-tools-mcp-server.md +24 -83
- package/dist/index.cjs +1561 -3323
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1564 -3327
- package/dist/index.js.map +1 -1
- package/dist/server/actions.d.ts +34 -0
- package/dist/server/actions.d.ts.map +1 -0
- package/dist/server/oauth-middleware.d.ts +1 -1
- package/dist/server/request.d.ts +54 -0
- package/dist/server/request.d.ts.map +1 -0
- package/dist/server/server.d.ts +112 -808
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/types.d.ts +82 -138
- package/dist/server/types.d.ts.map +1 -1
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/oauth-types.d.ts +3 -3
- package/dist/shared/oauth-types.d.ts.map +1 -1
- package/dist/shared/trace-context.d.ts +20 -0
- package/dist/shared/trace-context.d.ts.map +1 -0
- package/package.json +11 -16
- package/dist/_types/hono/dist/types/client/client.d.ts +0 -4
- package/dist/_types/hono/dist/types/client/fetch-result-please.d.ts +0 -35
- package/dist/_types/hono/dist/types/client/index.d.ts +0 -7
- package/dist/_types/hono/dist/types/client/types.d.ts +0 -229
- package/dist/_types/hono/dist/types/client/utils.d.ts +0 -18
- package/dist/_types/hono/dist/types/context.d.ts +0 -459
- package/dist/_types/hono/dist/types/helper/streaming/index.d.ts +0 -8
- package/dist/_types/hono/dist/types/helper/streaming/sse.d.ts +0 -13
- package/dist/_types/hono/dist/types/helper/streaming/stream.d.ts +0 -3
- package/dist/_types/hono/dist/types/helper/streaming/text.d.ts +0 -3
- package/dist/_types/hono/dist/types/hono-base.d.ts +0 -221
- package/dist/_types/hono/dist/types/hono.d.ts +0 -19
- package/dist/_types/hono/dist/types/index.d.ts +0 -37
- package/dist/_types/hono/dist/types/request/constants.d.ts +0 -1
- package/dist/_types/hono/dist/types/request.d.ts +0 -324
- package/dist/_types/hono/dist/types/router.d.ts +0 -97
- package/dist/_types/hono/dist/types/types.d.ts +0 -573
- package/dist/_types/hono/dist/types/utils/body.d.ts +0 -79
- package/dist/_types/hono/dist/types/utils/headers.d.ts +0 -8
- package/dist/_types/hono/dist/types/utils/http-status.d.ts +0 -32
- package/dist/_types/hono/dist/types/utils/mime.d.ts +0 -70
- package/dist/_types/hono/dist/types/utils/stream.d.ts +0 -31
- package/dist/_types/hono/dist/types/utils/types.d.ts +0 -74
- package/dist/_types/hono/package.json +0 -1
- package/dist/_types/hono-mcp-server-sse-transport/build/index.d.ts +0 -1
- package/dist/_types/hono-mcp-server-sse-transport/build/sse.d.ts +0 -25
- package/dist/_types/hono-mcp-server-sse-transport/package.json +0 -1
- package/dist/client/actions/elicitation.d.ts +0 -63
- package/dist/client/actions/elicitation.d.ts.map +0 -1
- package/dist/server/__tests__/mock-extra.d.ts +0 -15
- package/dist/server/__tests__/mock-extra.d.ts.map +0 -1
- package/dist/server/mrtrElicitation.d.ts +0 -39
- package/dist/server/mrtrElicitation.d.ts.map +0 -1
- package/dist/server/notificationBroadcast.d.ts +0 -24
- package/dist/server/notificationBroadcast.d.ts.map +0 -1
- package/dist/server/promptActions.d.ts +0 -49
- package/dist/server/promptActions.d.ts.map +0 -1
- package/dist/server/resourceActions.d.ts +0 -72
- package/dist/server/resourceActions.d.ts.map +0 -1
- package/dist/server/toolActions.d.ts +0 -84
- package/dist/server/toolActions.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server/server.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server/server.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EACV,eAAe,IAAI,mBAAmB,EAEtC,wBAAwB,EACxB,gBAAgB,EAChB,UAAU,EACX,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAI9D,OAAO,KAAK,EAAE,gBAAgB,EAA2B,WAAW,EAAc,MAAM,oBAAoB,CAAC;AAE7G,OAAO,KAAK,EAAkB,QAAQ,EAAE,MAA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,MAAM,GAAG,QAAQ,GAAG,SAAS,CAGhD;IAED;;;;OAIG;IACG,WAAW,CACf,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,gBAAgB,GAAE,UAAU,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAM,GACjE,OAAO,CAAC,wBAAwB,CAAC,CAgDnC;IAED,uFAAuF;IACjF,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,KAAK,CAAC;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC,CAY3G;IAED,qFAAqF;IAC/E,aAAa,IAAI,OAAO,CAAC;QAAE,SAAS,EAAE,QAAQ,EAAE,CAAA;KAAE,CAAC,CAExD;CACF;AAqBD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,CAAC"}
|
package/dist/server/types.d.ts
CHANGED
|
@@ -1,179 +1,123 @@
|
|
|
1
|
+
import type { MCPServerConfig as CoreMCPServerConfig } from '@mastra/core/mcp';
|
|
2
|
+
import type { RequestContext } from '@mastra/core/request-context';
|
|
3
|
+
import type { StandardSchemaWithJSON } from '@mastra/core/schema';
|
|
1
4
|
import type { MCPServerContext } from '@mastra/core/tools';
|
|
2
5
|
import type { McpUiResourceMeta } from '@modelcontextprotocol/ext-apps';
|
|
3
|
-
import type { CacheHint,
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* - `'2025-11-25'` — the legacy (2025) protocol era. This is the default and matches
|
|
8
|
-
* the server's behavior when the option is omitted: sessionful streamable HTTP,
|
|
9
|
-
* `initialize` handshake, server→client push notifications.
|
|
10
|
-
* - `'2026-07-28'` — the stateless protocol revision. HTTP and serverless requests are
|
|
11
|
-
* served through the SDK's dual-era handler: modern (per-request envelope) clients are
|
|
12
|
-
* served natively, and legacy clients are served through the built-in stateless
|
|
13
|
-
* fallback on the same endpoint. Stdio serves both eras via the `server/discover`
|
|
14
|
-
* probe. List-changed/resource-updated notifications additionally reach modern
|
|
15
|
-
* clients via `subscriptions/listen`, tool log emission honors the per-request
|
|
16
|
-
* `logLevel` opt-in, and configured {@link MCPServerCacheHints} are advertised.
|
|
17
|
-
*/
|
|
18
|
-
export type MCPServerProtocolVersion = '2025-11-25' | '2026-07-28';
|
|
19
|
-
/**
|
|
20
|
-
* The operations whose results are cacheable on the `2026-07-28` protocol revision.
|
|
21
|
-
*/
|
|
6
|
+
import type { CacheHint, InputRequiredResult, Prompt, PromptMessage, Resource, ResourceTemplateType } from '@modelcontextprotocol/server';
|
|
7
|
+
/** The only protocol revision `@mastra/mcp` serves. */
|
|
8
|
+
export declare const MCP_PROTOCOL_VERSION: '2026-07-28';
|
|
9
|
+
/** Operations whose results can advertise cache hints. */
|
|
22
10
|
export type MCPServerCacheableMethod = 'tools/list' | 'prompts/list' | 'resources/list' | 'resources/templates/list' | 'resources/read' | 'server/discover';
|
|
11
|
+
/** Cache hints (`ttlMs` / `cacheScope`) advertised on cacheable results, keyed by operation. */
|
|
12
|
+
export type MCPServerCacheHints = Partial<Record<MCPServerCacheableMethod, CacheHint>>;
|
|
23
13
|
/**
|
|
24
|
-
*
|
|
25
|
-
* `
|
|
26
|
-
*
|
|
27
|
-
* Only used when `protocolVersion: '2026-07-28'` is set. Absent hints keep the SDK's
|
|
28
|
-
* conservative defaults (`ttlMs: 0`, `cacheScope: 'private'`). Responses to legacy
|
|
29
|
-
* (2025-era) requests are never affected.
|
|
14
|
+
* Protocol context handed to resource and prompt callbacks: the same object tools
|
|
15
|
+
* receive as `context.mcp.extra` (cancellation signal, request id, `_meta`, auth).
|
|
30
16
|
*/
|
|
31
|
-
export type
|
|
17
|
+
export type MCPRequestHandlerExtra = MCPServerContext;
|
|
32
18
|
/**
|
|
33
|
-
*
|
|
19
|
+
* Request-scoped context handed to resource and prompt callbacks.
|
|
34
20
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
21
|
+
* `extra` carries the protocol facilities of the current request and
|
|
22
|
+
* `requestContext` the trusted application context (`authInfo`, mapped `user`).
|
|
23
|
+
* `suspend`, `resumeData` and `suspendPayload` are the same continuation vocabulary
|
|
24
|
+
* tools use: calling `suspend(payload)` ends the request as `input_required`; the
|
|
25
|
+
* continuation re-enters with the client's answer in `resumeData` and the payload it
|
|
26
|
+
* suspended with in `suspendPayload`.
|
|
39
27
|
*/
|
|
40
|
-
export
|
|
41
|
-
uri: string;
|
|
28
|
+
export interface MCPServerRequest<TSuspend = unknown, TResume = unknown> {
|
|
42
29
|
extra: MCPRequestHandlerExtra;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
30
|
+
requestContext: RequestContext;
|
|
31
|
+
suspend: (payload: TSuspend) => Promise<void>;
|
|
32
|
+
resumeData?: TResume;
|
|
33
|
+
suspendPayload?: TSuspend;
|
|
34
|
+
}
|
|
35
|
+
/** Content for an MCP resource, either text or binary (base64-encoded). */
|
|
47
36
|
export type MCPServerResourceContent = {
|
|
48
37
|
text?: string;
|
|
49
38
|
} | {
|
|
50
39
|
blob?: string;
|
|
51
40
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
*/
|
|
41
|
+
export type MCPServerResourceContentCallback = (params: {
|
|
42
|
+
uri: string;
|
|
43
|
+
} & MCPServerRequest) => Promise<MCPServerResourceContent | MCPServerResourceContent[] | void>;
|
|
44
|
+
/** Configuration for MCP server resource handling. */
|
|
57
45
|
export type MCPServerResources = {
|
|
58
|
-
|
|
59
|
-
listResources: ({ extra }: {
|
|
46
|
+
listResources: (params: {
|
|
60
47
|
extra: MCPRequestHandlerExtra;
|
|
48
|
+
requestContext: RequestContext;
|
|
61
49
|
}) => Promise<Resource[]>;
|
|
62
|
-
/** Function to get content for a specific resource */
|
|
63
50
|
getResourceContent: MCPServerResourceContentCallback;
|
|
64
|
-
|
|
65
|
-
resourceTemplates?: ({ extra }: {
|
|
51
|
+
resourceTemplates?: (params: {
|
|
66
52
|
extra: MCPRequestHandlerExtra;
|
|
53
|
+
requestContext: RequestContext;
|
|
67
54
|
}) => Promise<ResourceTemplateType[]>;
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* Extends the MCP Prompt type with an optional version field.
|
|
71
|
-
*
|
|
72
|
-
* The MCP protocol does not include `version` on prompts, so this field is
|
|
73
|
-
* only used server-side for internal prompt lookup and is not sent over the wire.
|
|
74
|
-
*
|
|
75
|
-
* @deprecated The `version` field is not part of the MCP protocol and will be removed in a future release.
|
|
76
|
-
* Use distinct prompt names instead (e.g., `explain-code-v1`, `explain-code-v2`).
|
|
77
|
-
*/
|
|
78
|
-
export type MastraPrompt = Prompt & {
|
|
79
55
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
56
|
+
* Shape of the answer a suspended `getResourceContent` expects. Required for
|
|
57
|
+
* `suspend` to be usable; it must describe a flat object of primitives because it
|
|
58
|
+
* becomes the form the client fills in.
|
|
82
59
|
*/
|
|
83
|
-
|
|
60
|
+
resumeSchema?: StandardSchemaWithJSON;
|
|
84
61
|
};
|
|
85
|
-
|
|
86
|
-
* Callback function to retrieve messages for a specific prompt.
|
|
87
|
-
*
|
|
88
|
-
* @param params - Parameters for prompt message retrieval
|
|
89
|
-
* @param params.name - Name of the prompt
|
|
90
|
-
* @param params.version - Optional version of the prompt
|
|
91
|
-
* @param params.args - Optional arguments for the prompt
|
|
92
|
-
* @param params.extra - Additional request handler context
|
|
93
|
-
* @returns Promise resolving to array of prompt messages
|
|
94
|
-
*/
|
|
95
|
-
export type MCPServerPromptMessagesCallback = ({ name, version, args, extra, }: {
|
|
62
|
+
export type MCPServerPromptMessagesCallback = (params: {
|
|
96
63
|
name: string;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
*/
|
|
101
|
-
version?: string;
|
|
102
|
-
args?: any;
|
|
103
|
-
extra: MCPRequestHandlerExtra;
|
|
104
|
-
}) => Promise<PromptMessage[]>;
|
|
105
|
-
/**
|
|
106
|
-
* Configuration for MCP server prompt handling.
|
|
107
|
-
*
|
|
108
|
-
* Defines callbacks for listing prompts and retrieving prompt messages.
|
|
109
|
-
*/
|
|
64
|
+
args?: Record<string, unknown>;
|
|
65
|
+
} & MCPServerRequest) => Promise<PromptMessage[] | void>;
|
|
66
|
+
/** Configuration for MCP server prompt handling. */
|
|
110
67
|
export type MCPServerPrompts = {
|
|
111
|
-
|
|
112
|
-
listPrompts: ({ extra }: {
|
|
68
|
+
listPrompts: (params: {
|
|
113
69
|
extra: MCPRequestHandlerExtra;
|
|
114
|
-
|
|
115
|
-
|
|
70
|
+
requestContext: RequestContext;
|
|
71
|
+
}) => Promise<Prompt[]>;
|
|
116
72
|
getPromptMessages?: MCPServerPromptMessagesCallback;
|
|
73
|
+
/** Shape of the answer a suspended `getPromptMessages` expects; see `MCPServerResources.resumeSchema`. */
|
|
74
|
+
resumeSchema?: StandardSchemaWithJSON;
|
|
117
75
|
};
|
|
118
76
|
/**
|
|
119
|
-
*
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Function to send an elicitation request to the client.
|
|
124
|
-
*
|
|
125
|
-
* @param request - The elicitation request parameters
|
|
126
|
-
* @param options - Optional request options (timeout, signal, etc.)
|
|
127
|
-
* @returns Promise resolving to the client's elicitation response
|
|
128
|
-
*/
|
|
129
|
-
sendRequest: (request: ElicitRequest['params'], options?: RequestOptions) => Promise<ElicitResult>;
|
|
130
|
-
};
|
|
131
|
-
/**
|
|
132
|
-
* Extra context passed to MCP request handlers.
|
|
133
|
-
*/
|
|
134
|
-
export type MCPRequestHandlerExtra = MCPServerContext;
|
|
135
|
-
/**
|
|
136
|
-
* Re-exported MCP types for resource handling.
|
|
77
|
+
* Integrity protection for continuation state. `requestState` round-trips through
|
|
78
|
+
* the client on every `input_required` round: the server signs it with `key` so a
|
|
79
|
+
* tampered, expired or foreign envelope is rejected before any handler runs.
|
|
137
80
|
*
|
|
138
|
-
*
|
|
139
|
-
* -
|
|
140
|
-
*
|
|
141
|
-
*/
|
|
142
|
-
export type { Resource, ResourceTemplateType as ResourceTemplate, RequestOptions };
|
|
143
|
-
/**
|
|
144
|
-
* Configuration for a single MCP App resource.
|
|
81
|
+
* Every instance that may answer a continuation must share the same key (set it from
|
|
82
|
+
* the environment in multi-instance and serverless deployments). Without a key the
|
|
83
|
+
* server generates one per process and continuations only succeed on that process.
|
|
145
84
|
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
85
|
+
* The envelope is bound to the authenticated caller. On a server without
|
|
86
|
+
* authorization every caller shares one anonymous principal, so a `requestState`
|
|
87
|
+
* acts as a bearer credential for its round until `ttlSeconds` elapse.
|
|
148
88
|
*/
|
|
89
|
+
export interface MCPServerRequestStateOptions {
|
|
90
|
+
/** HMAC key, at least 32 bytes. */
|
|
91
|
+
key?: string | Uint8Array;
|
|
92
|
+
/** How long a suspended round stays answerable. Defaults to 600 seconds. */
|
|
93
|
+
ttlSeconds?: number;
|
|
94
|
+
}
|
|
95
|
+
/** Request-security options accepted by `startHTTP`. */
|
|
96
|
+
export interface MCPServerHTTPRequestOptions {
|
|
97
|
+
/**
|
|
98
|
+
* Check the `Host` header against `allowedHosts` and the `Origin` header against
|
|
99
|
+
* `allowedOrigins` before handling the request. A check only runs when its list is
|
|
100
|
+
* non-empty; a rejected request receives a `403` JSON-RPC error.
|
|
101
|
+
*/
|
|
102
|
+
enableDnsRebindingProtection?: boolean;
|
|
103
|
+
/** Hostnames accepted in the `Host` header. Ports are ignored when matching. */
|
|
104
|
+
allowedHosts?: string[];
|
|
105
|
+
/**
|
|
106
|
+
* Origins accepted in the `Origin` header. Only the hostname is compared, and
|
|
107
|
+
* requests without an `Origin` header pass because non-browser clients don't send one.
|
|
108
|
+
*/
|
|
109
|
+
allowedOrigins?: string[];
|
|
110
|
+
}
|
|
111
|
+
export type MCPAuthInfoToUserMapper = NonNullable<CoreMCPServerConfig['mapAuthInfoToUser']>;
|
|
112
|
+
export type { Prompt, PromptMessage, Resource, ResourceTemplateType as ResourceTemplate, InputRequiredResult };
|
|
113
|
+
/** Configuration for a single MCP App resource served under the `ui://` scheme. */
|
|
149
114
|
export interface AppResource {
|
|
150
|
-
/** Display name for the UI resource */
|
|
151
115
|
name: string;
|
|
152
|
-
/** Optional description of the UI resource */
|
|
153
116
|
description?: string;
|
|
154
|
-
/** Inline HTML content for the UI */
|
|
155
117
|
html?: string;
|
|
156
|
-
/** Path to an HTML file (resolved at startup) */
|
|
157
118
|
htmlPath?: string;
|
|
158
|
-
/** UI resource metadata (CSP, permissions, rendering preferences) from the official ext-apps SDK */
|
|
159
119
|
meta?: McpUiResourceMeta;
|
|
160
120
|
}
|
|
161
|
-
/**
|
|
162
|
-
* Map of `ui://` URIs to their app resource configurations.
|
|
163
|
-
*
|
|
164
|
-
* Used as a convenience config on MCPServer to auto-register UI resources
|
|
165
|
-
* that are served via the MCP Apps extension.
|
|
166
|
-
*
|
|
167
|
-
* @example
|
|
168
|
-
* ```typescript
|
|
169
|
-
* const appResources: AppResources = {
|
|
170
|
-
* 'ui://weather/dashboard': {
|
|
171
|
-
* name: 'Weather Dashboard',
|
|
172
|
-
* html: '<html>...</html>',
|
|
173
|
-
* meta: { csp: { connectDomains: ['https://api.weather.com'] } },
|
|
174
|
-
* },
|
|
175
|
-
* };
|
|
176
|
-
* ```
|
|
177
|
-
*/
|
|
121
|
+
/** Map of `ui://` URIs to their app resource configurations. */
|
|
178
122
|
export type AppResources = Record<string, AppResource>;
|
|
179
123
|
//# 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,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;A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C,CAAC;IAC9G,iBAAiB,CAAC,EAAE,+BAA+B,CAAC;IACpD,0GAA0G;IAC1G,YAAY,CAAC,EAAE,sBAAsB,CAAC;CACvC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,4BAA4B;IAC3C,mCAAmC;IACnC,GAAG,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAC1B,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wDAAwD;AACxD,MAAM,WAAW,2BAA2B;IAC1C;;;;OAIG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,gFAAgF;IAChF,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,uBAAuB,GAAG,WAAW,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,CAAC,CAAC;AAE5F,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,oBAAoB,IAAI,gBAAgB,EAAE,mBAAmB,EAAE,CAAC;AAE/G,mFAAmF;AACnF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,iBAAiB,CAAC;CAC1B;AAED,gEAAgE;AAChE,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC"}
|
package/dist/shared/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* MCP packages, so both sides source them from `@modelcontextprotocol/client`
|
|
7
7
|
* alongside the OAuth flow helpers below.
|
|
8
8
|
*
|
|
9
|
-
* @see https://modelcontextprotocol.io/specification/
|
|
9
|
+
* @see https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization
|
|
10
10
|
*/
|
|
11
11
|
import type { OAuthProtectedResourceMetadata as SDKOAuthProtectedResourceMetadata } from '@modelcontextprotocol/client';
|
|
12
|
-
export type { OAuthMetadata, OAuthTokens, OAuthErrorResponse, OAuthClientMetadata, OAuthClientInformation,
|
|
13
|
-
export { auth, discoverOAuthProtectedResourceMetadata, discoverOAuthMetadata, discoverAuthorizationServerMetadata, startAuthorization, exchangeAuthorization, refreshAuthorization,
|
|
12
|
+
export type { OAuthMetadata, OAuthTokens, OAuthErrorResponse, OAuthClientMetadata, OAuthClientInformation, OAuthClientInformationContext, OAuthDiscoveryState, StoredOAuthTokens, OAuthTokenRevocationRequest, OAuthProtectedResourceMetadata, AuthorizationServerMetadata, } from '@modelcontextprotocol/client';
|
|
13
|
+
export { auth, discoverOAuthProtectedResourceMetadata, discoverOAuthMetadata, discoverAuthorizationServerMetadata, startAuthorization, exchangeAuthorization, refreshAuthorization, extractResourceMetadataUrl, selectResourceURL, parseErrorResponse, UnauthorizedError, buildDiscoveryUrls, } from '@modelcontextprotocol/client';
|
|
14
14
|
export type { OAuthClientProvider, AuthResult } from '@modelcontextprotocol/client';
|
|
15
15
|
/**
|
|
16
16
|
* Configuration for OAuth-protected MCP server.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-types.d.ts","sourceRoot":"","sources":["../../src/shared/oauth-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,8BAA8B,IAAI,iCAAiC,EAAE,MAAM,8BAA8B,CAAC;AAExH,YA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E,OAAO,CAAC;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C;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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* W3C trace fields carried in MCP request `_meta` (SEP-414).
|
|
3
|
+
*
|
|
4
|
+
* Mastra passes these strings through without creating spans or validating
|
|
5
|
+
* their format. Treat inbound values, especially `baggage`, as untrusted
|
|
6
|
+
* observability data: never use them for authentication or authorization.
|
|
7
|
+
*/
|
|
8
|
+
export interface MCPTraceContext {
|
|
9
|
+
traceparent: string;
|
|
10
|
+
tracestate?: string;
|
|
11
|
+
baggage?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Reads the W3C trace fields out of request metadata. Only string values are
|
|
15
|
+
* accepted; a request without a `traceparent` carries no trace context.
|
|
16
|
+
*/
|
|
17
|
+
export declare function traceContextFromMeta(meta: Record<string, unknown> | undefined): MCPTraceContext | undefined;
|
|
18
|
+
/** Projects a trace context onto the `_meta` keys the specification defines. */
|
|
19
|
+
export declare function traceContextToMeta(traceContext: MCPTraceContext): Record<string, string>;
|
|
20
|
+
//# sourceMappingURL=trace-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace-context.d.ts","sourceRoot":"","sources":["../../src/shared/trace-context.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAOD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,eAAe,GAAG,SAAS,CAU3G;AAED,gFAAgF;AAChF,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMxF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -27,30 +27,23 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@modelcontextprotocol/client": "2.0.0",
|
|
29
29
|
"@modelcontextprotocol/core": "2.0.0",
|
|
30
|
-
"@modelcontextprotocol/ext-apps": "^
|
|
30
|
+
"@modelcontextprotocol/ext-apps": "^2.0.0",
|
|
31
31
|
"@modelcontextprotocol/node": "2.0.0",
|
|
32
|
-
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
33
32
|
"@modelcontextprotocol/server": "2.0.0",
|
|
34
|
-
"@modelcontextprotocol/server-legacy": "2.0.0",
|
|
35
33
|
"exit-hook": "^5.1.0",
|
|
36
34
|
"fast-deep-equal": "^3.1.3"
|
|
37
35
|
},
|
|
38
36
|
"peerDependencies": {
|
|
39
|
-
"@mastra/core": ">=1.
|
|
37
|
+
"@mastra/core": ">=1.68.0-0 <2.0.0-0"
|
|
40
38
|
},
|
|
41
39
|
"devDependencies": {
|
|
42
|
-
"@hono/node-server": "^2.0.0",
|
|
43
40
|
"@mendable/firecrawl-js": "^1.29.3",
|
|
44
|
-
"@modelcontextprotocol/
|
|
41
|
+
"@modelcontextprotocol/conformance": "0.2.0-alpha.11",
|
|
45
42
|
"@types/node": "22.20.1",
|
|
46
43
|
"@types/semver": "^7.7.1",
|
|
47
44
|
"@vitest/coverage-v8": "4.1.11",
|
|
48
45
|
"@vitest/ui": "4.1.11",
|
|
49
|
-
"ai": "^5.0.221",
|
|
50
46
|
"eslint": "^10.7.0",
|
|
51
|
-
"get-port": "^7.1.0",
|
|
52
|
-
"hono": "^4.13.5",
|
|
53
|
-
"hono-mcp-server-sse-transport": "0.0.7",
|
|
54
47
|
"semver": "^7.8.5",
|
|
55
48
|
"tsdown": "0.22.9",
|
|
56
49
|
"tsx": "^4.23.1",
|
|
@@ -60,12 +53,12 @@
|
|
|
60
53
|
"zod-to-json-schema": "^3.25.1",
|
|
61
54
|
"@internal/ai-sdk-v5": "0.0.80",
|
|
62
55
|
"@internal/lint": "0.0.133",
|
|
63
|
-
"@internal/llm-recorder": "0.0.69",
|
|
64
|
-
"@internal/test-utils": "0.0.69",
|
|
65
56
|
"@internal/types-builder": "0.0.108",
|
|
57
|
+
"@internal/test-utils": "0.0.69",
|
|
58
|
+
"@internal/llm-recorder": "0.0.69",
|
|
59
|
+
"@mastra/core": "1.68.0-alpha.6",
|
|
66
60
|
"@mastra/observability": "1.17.9-alpha.1",
|
|
67
|
-
"@mastra/schema-compat": "1.3.11-alpha.1"
|
|
68
|
-
"@mastra/core": "1.68.0-alpha.5"
|
|
61
|
+
"@mastra/schema-compat": "1.3.11-alpha.1"
|
|
69
62
|
},
|
|
70
63
|
"homepage": "https://mastra.ai",
|
|
71
64
|
"repository": {
|
|
@@ -82,10 +75,12 @@
|
|
|
82
75
|
"scripts": {
|
|
83
76
|
"build:lib": "tsdown --silent --config tsdown.config.ts",
|
|
84
77
|
"build:watch": "pnpm build:lib --watch",
|
|
85
|
-
"test:client": "vitest run
|
|
78
|
+
"test:client": "vitest run --project unit:packages/mcp ./src/client",
|
|
79
|
+
"test:client:e2e": "vitest run --project e2e:packages/mcp ./src/client",
|
|
86
80
|
"test:server": "vitest run ./src/server",
|
|
87
81
|
"test:integration": "cd integration-tests && pnpm test:mcp",
|
|
88
82
|
"test:compat": "bash integration-tests/compat.sh",
|
|
83
|
+
"test:conformance": "tsx ./src/conformance/run.ts",
|
|
89
84
|
"test": "pnpm test:server && pnpm test:client && pnpm test:integration",
|
|
90
85
|
"lint": "oxlint . && eslint .",
|
|
91
86
|
"lint:fix": "oxlint --fix . && eslint --fix ."
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Hono } from '../hono';
|
|
2
|
-
import type { UnionToIntersection } from '../utils/types';
|
|
3
|
-
import type { Client, ClientRequestOptions } from './types';
|
|
4
|
-
export declare const hc: <T extends Hono<any, any, any>, Prefix extends string = string>(baseUrl: Prefix, options?: ClientRequestOptions) => UnionToIntersection<Client<T, Prefix>>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description This file is a modified version of `fetch-result-please` (`ofetch`), minimalized and adapted to Hono's custom needs.
|
|
3
|
-
*
|
|
4
|
-
* @link https://www.npmjs.com/package/fetch-result-please
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Smartly parses and return the consumable result from a fetch `Response`.
|
|
8
|
-
*
|
|
9
|
-
* Throwing a structured error if the response is not `ok`. ({@link DetailedError})
|
|
10
|
-
*/
|
|
11
|
-
export declare function fetchRP(fetchRes: Response | Promise<Response>): Promise<any>;
|
|
12
|
-
export declare class DetailedError extends Error {
|
|
13
|
-
/**
|
|
14
|
-
* Additional `message` that will be logged AND returned to client
|
|
15
|
-
*/
|
|
16
|
-
detail?: any;
|
|
17
|
-
/**
|
|
18
|
-
* Additional `code` that will be logged AND returned to client
|
|
19
|
-
*/
|
|
20
|
-
code?: any;
|
|
21
|
-
/**
|
|
22
|
-
* Additional value that will be logged AND NOT returned to client
|
|
23
|
-
*/
|
|
24
|
-
log?: any;
|
|
25
|
-
/**
|
|
26
|
-
* Optionally set the status code to return, in a web server context
|
|
27
|
-
*/
|
|
28
|
-
statusCode?: any;
|
|
29
|
-
constructor(message: string, options?: {
|
|
30
|
-
detail?: any;
|
|
31
|
-
code?: any;
|
|
32
|
-
statusCode?: number;
|
|
33
|
-
log?: any;
|
|
34
|
-
});
|
|
35
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module
|
|
3
|
-
* The HTTP Client for Hono.
|
|
4
|
-
*/
|
|
5
|
-
export { hc } from './client';
|
|
6
|
-
export { parseResponse, DetailedError } from './utils';
|
|
7
|
-
export type { InferResponseType, InferRequestType, Fetch, ClientRequestOptions, ClientRequest, ClientResponse, ApplyGlobalResponse, PickResponseByStatusCode, } from './types';
|