@mastra/mcp 1.8.0 → 1.8.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 (35) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/_types/hono/dist/types/client/client.d.ts +4 -0
  3. package/dist/_types/hono/dist/types/client/fetch-result-please.d.ts +35 -0
  4. package/dist/_types/hono/dist/types/client/index.d.ts +7 -0
  5. package/dist/_types/hono/dist/types/client/types.d.ts +229 -0
  6. package/dist/_types/hono/dist/types/client/utils.d.ts +18 -0
  7. package/dist/_types/hono/dist/types/context.d.ts +455 -0
  8. package/dist/_types/hono/dist/types/helper/streaming/index.d.ts +8 -0
  9. package/dist/_types/hono/dist/types/helper/streaming/sse.d.ts +13 -0
  10. package/dist/_types/hono/dist/types/helper/streaming/stream.d.ts +3 -0
  11. package/dist/_types/hono/dist/types/helper/streaming/text.d.ts +3 -0
  12. package/dist/_types/hono/dist/types/hono-base.d.ts +220 -0
  13. package/dist/_types/hono/dist/types/hono.d.ts +19 -0
  14. package/dist/_types/hono/dist/types/index.d.ts +36 -0
  15. package/dist/_types/hono/dist/types/request/constants.d.ts +1 -0
  16. package/dist/_types/hono/dist/types/request.d.ts +311 -0
  17. package/dist/_types/hono/dist/types/router.d.ts +97 -0
  18. package/dist/_types/hono/dist/types/types.d.ts +573 -0
  19. package/dist/_types/hono/dist/types/utils/body.d.ts +79 -0
  20. package/dist/_types/hono/dist/types/utils/headers.d.ts +8 -0
  21. package/dist/_types/hono/dist/types/utils/http-status.d.ts +32 -0
  22. package/dist/_types/hono/dist/types/utils/mime.d.ts +70 -0
  23. package/dist/_types/hono/dist/types/utils/stream.d.ts +31 -0
  24. package/dist/_types/hono/dist/types/utils/types.d.ts +74 -0
  25. package/dist/_types/hono-mcp-server-sse-transport/build/index.d.ts +1 -0
  26. package/dist/_types/hono-mcp-server-sse-transport/build/sse.d.ts +25 -0
  27. package/dist/docs/SKILL.md +1 -1
  28. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  29. package/dist/docs/references/docs-mcp-mcp-apps.md +3 -3
  30. package/dist/index.cjs +2 -2
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.js +2 -2
  33. package/dist/index.js.map +1 -1
  34. package/dist/server/server.d.ts +2 -2
  35. package/package.json +8 -9
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @module
3
+ * Body utility.
4
+ */
5
+ import { HonoRequest } from '../request';
6
+ type BodyDataValueDot = {
7
+ [x: string]: string | File | BodyDataValueDot;
8
+ };
9
+ type BodyDataValueDotAll = {
10
+ [x: string]: string | File | (string | File)[] | BodyDataValueDotAll;
11
+ };
12
+ type SimplifyBodyData<T> = {
13
+ [K in keyof T]: string | File | (string | File)[] | BodyDataValueDotAll extends T[K] ? string | File | (string | File)[] | BodyDataValueDotAll : string | File | BodyDataValueDot extends T[K] ? string | File | BodyDataValueDot : string | File | (string | File)[] extends T[K] ? string | File | (string | File)[] : string | File;
14
+ } & {};
15
+ type BodyDataValueComponent<T> = string | File | (T extends {
16
+ all: false;
17
+ } ? never : T extends {
18
+ all: true;
19
+ } | {
20
+ all: boolean;
21
+ } ? (string | File)[] : never);
22
+ type BodyDataValueObject<T> = {
23
+ [key: string]: BodyDataValueComponent<T> | BodyDataValueObject<T>;
24
+ };
25
+ type BodyDataValue<T> = BodyDataValueComponent<T> | (T extends {
26
+ dot: false;
27
+ } ? never : T extends {
28
+ dot: true;
29
+ } | {
30
+ dot: boolean;
31
+ } ? BodyDataValueObject<T> : never);
32
+ export type BodyData<T extends Partial<ParseBodyOptions> = {}> = SimplifyBodyData<Record<string, BodyDataValue<T>>>;
33
+ export type ParseBodyOptions = {
34
+ /**
35
+ * Determines whether all fields with multiple values should be parsed as arrays.
36
+ * @default false
37
+ * @example
38
+ * const data = new FormData()
39
+ * data.append('file', 'aaa')
40
+ * data.append('file', 'bbb')
41
+ * data.append('message', 'hello')
42
+ *
43
+ * If all is false:
44
+ * parseBody should return { file: 'bbb', message: 'hello' }
45
+ *
46
+ * If all is true:
47
+ * parseBody should return { file: ['aaa', 'bbb'], message: 'hello' }
48
+ */
49
+ all: boolean;
50
+ /**
51
+ * Determines whether all fields with dot notation should be parsed as nested objects.
52
+ * @default false
53
+ * @example
54
+ * const data = new FormData()
55
+ * data.append('obj.key1', 'value1')
56
+ * data.append('obj.key2', 'value2')
57
+ *
58
+ * If dot is false:
59
+ * parseBody should return { 'obj.key1': 'value1', 'obj.key2': 'value2' }
60
+ *
61
+ * If dot is true:
62
+ * parseBody should return { obj: { key1: 'value1', key2: 'value2' } }
63
+ */
64
+ dot: boolean;
65
+ };
66
+ /**
67
+ * Parses the body of a request based on the provided options.
68
+ *
69
+ * @template T - The type of the parsed body data.
70
+ * @param {HonoRequest | Request} request - The request object to parse.
71
+ * @param {Partial<ParseBodyOptions>} [options] - Options for parsing the body.
72
+ * @returns {Promise<T>} The parsed body data.
73
+ */
74
+ interface ParseBody {
75
+ <Options extends Partial<ParseBodyOptions>, T extends BodyData<Options>>(request: HonoRequest | Request, options?: Options): Promise<T>;
76
+ <T extends BodyData>(request: HonoRequest | Request, options?: Partial<ParseBodyOptions>): Promise<T>;
77
+ }
78
+ export declare const parseBody: ParseBody;
79
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @module
3
+ * HTTP Headers utility.
4
+ */
5
+ export type RequestHeader = 'A-IM' | 'Accept' | 'Accept-Additions' | 'Accept-CH' | 'Accept-Charset' | 'Accept-Datetime' | 'Accept-Encoding' | 'Accept-Features' | 'Accept-Language' | 'Accept-Patch' | 'Accept-Post' | 'Accept-Ranges' | 'Accept-Signature' | 'Access-Control' | 'Access-Control-Allow-Credentials' | 'Access-Control-Allow-Headers' | 'Access-Control-Allow-Methods' | 'Access-Control-Allow-Origin' | 'Access-Control-Expose-Headers' | 'Access-Control-Max-Age' | 'Access-Control-Request-Headers' | 'Access-Control-Request-Method' | 'Age' | 'Allow' | 'ALPN' | 'Alt-Svc' | 'Alt-Used' | 'Alternates' | 'AMP-Cache-Transform' | 'Apply-To-Redirect-Ref' | 'Authentication-Control' | 'Authentication-Info' | 'Authorization' | 'Available-Dictionary' | 'C-Ext' | 'C-Man' | 'C-Opt' | 'C-PEP' | 'C-PEP-Info' | 'Cache-Control' | 'Cache-Status' | 'Cal-Managed-ID' | 'CalDAV-Timezones' | 'Capsule-Protocol' | 'CDN-Cache-Control' | 'CDN-Loop' | 'Cert-Not-After' | 'Cert-Not-Before' | 'Clear-Site-Data' | 'Client-Cert' | 'Client-Cert-Chain' | 'Close' | 'CMCD-Object' | 'CMCD-Request' | 'CMCD-Session' | 'CMCD-Status' | 'CMSD-Dynamic' | 'CMSD-Static' | 'Concealed-Auth-Export' | 'Configuration-Context' | 'Connection' | 'Content-Base' | 'Content-Digest' | 'Content-Disposition' | 'Content-Encoding' | 'Content-ID' | 'Content-Language' | 'Content-Length' | 'Content-Location' | 'Content-MD5' | 'Content-Range' | 'Content-Script-Type' | 'Content-Security-Policy' | 'Content-Security-Policy-Report-Only' | 'Content-Style-Type' | 'Content-Type' | 'Content-Version' | 'Cookie' | 'Cookie2' | 'Cross-Origin-Embedder-Policy' | 'Cross-Origin-Embedder-Policy-Report-Only' | 'Cross-Origin-Opener-Policy' | 'Cross-Origin-Opener-Policy-Report-Only' | 'Cross-Origin-Resource-Policy' | 'CTA-Common-Access-Token' | 'DASL' | 'Date' | 'DAV' | 'Default-Style' | 'Delta-Base' | 'Deprecation' | 'Depth' | 'Derived-From' | 'Destination' | 'Differential-ID' | 'Dictionary-ID' | 'Digest' | 'DPoP' | 'DPoP-Nonce' | 'Early-Data' | 'EDIINT-Features' | 'ETag' | 'Expect' | 'Expect-CT' | 'Expires' | 'Ext' | 'Forwarded' | 'From' | 'GetProfile' | 'Hobareg' | 'Host' | 'HTTP2-Settings' | 'If' | 'If-Match' | 'If-Modified-Since' | 'If-None-Match' | 'If-Range' | 'If-Schedule-Tag-Match' | 'If-Unmodified-Since' | 'IM' | 'Include-Referred-Token-Binding-ID' | 'Isolation' | 'Keep-Alive' | 'Label' | 'Last-Event-ID' | 'Last-Modified' | 'Link' | 'Link-Template' | 'Location' | 'Lock-Token' | 'Man' | 'Max-Forwards' | 'Memento-Datetime' | 'Meter' | 'Method-Check' | 'Method-Check-Expires' | 'MIME-Version' | 'Negotiate' | 'NEL' | 'OData-EntityId' | 'OData-Isolation' | 'OData-MaxVersion' | 'OData-Version' | 'Opt' | 'Optional-WWW-Authenticate' | 'Ordering-Type' | 'Origin' | 'Origin-Agent-Cluster' | 'OSCORE' | 'OSLC-Core-Version' | 'Overwrite' | 'P3P' | 'PEP' | 'PEP-Info' | 'Permissions-Policy' | 'PICS-Label' | 'Ping-From' | 'Ping-To' | 'Position' | 'Pragma' | 'Prefer' | 'Preference-Applied' | 'Priority' | 'ProfileObject' | 'Protocol' | 'Protocol-Info' | 'Protocol-Query' | 'Protocol-Request' | 'Proxy-Authenticate' | 'Proxy-Authentication-Info' | 'Proxy-Authorization' | 'Proxy-Features' | 'Proxy-Instruction' | 'Proxy-Status' | 'Public' | 'Public-Key-Pins' | 'Public-Key-Pins-Report-Only' | 'Range' | 'Redirect-Ref' | 'Referer' | 'Referer-Root' | 'Referrer-Policy' | 'Refresh' | 'Repeatability-Client-ID' | 'Repeatability-First-Sent' | 'Repeatability-Request-ID' | 'Repeatability-Result' | 'Replay-Nonce' | 'Reporting-Endpoints' | 'Repr-Digest' | 'Retry-After' | 'Safe' | 'Schedule-Reply' | 'Schedule-Tag' | 'Sec-GPC' | 'Sec-Purpose' | 'Sec-Token-Binding' | 'Sec-WebSocket-Accept' | 'Sec-WebSocket-Extensions' | 'Sec-WebSocket-Key' | 'Sec-WebSocket-Protocol' | 'Sec-WebSocket-Version' | 'Security-Scheme' | 'Server' | 'Server-Timing' | 'Set-Cookie' | 'Set-Cookie2' | 'SetProfile' | 'Signature' | 'Signature-Input' | 'SLUG' | 'SoapAction' | 'Status-URI' | 'Strict-Transport-Security' | 'Sunset' | 'Surrogate-Capability' | 'Surrogate-Control' | 'TCN' | 'TE' | 'Timeout' | 'Timing-Allow-Origin' | 'Topic' | 'Traceparent' | 'Tracestate' | 'Trailer' | 'Transfer-Encoding' | 'TTL' | 'Upgrade' | 'Urgency' | 'URI' | 'Use-As-Dictionary' | 'User-Agent' | 'Variant-Vary' | 'Vary' | 'Via' | 'Want-Content-Digest' | 'Want-Digest' | 'Want-Repr-Digest' | 'Warning' | 'WWW-Authenticate' | 'X-Content-Type-Options' | 'X-Frame-Options';
6
+ export type ResponseHeader = 'Access-Control-Allow-Credentials' | 'Access-Control-Allow-Headers' | 'Access-Control-Allow-Methods' | 'Access-Control-Allow-Origin' | 'Access-Control-Expose-Headers' | 'Access-Control-Max-Age' | 'Age' | 'Allow' | 'Cache-Control' | 'Clear-Site-Data' | 'Content-Disposition' | 'Content-Encoding' | 'Content-Language' | 'Content-Length' | 'Content-Location' | 'Content-Range' | 'Content-Security-Policy' | 'Content-Security-Policy-Report-Only' | 'Content-Type' | 'Cookie' | 'Cross-Origin-Embedder-Policy' | 'Cross-Origin-Opener-Policy' | 'Cross-Origin-Resource-Policy' | 'Date' | 'ETag' | 'Expires' | 'Last-Modified' | 'Location' | 'Permissions-Policy' | 'Pragma' | 'Retry-After' | 'Save-Data' | 'Sec-CH-Prefers-Color-Scheme' | 'Sec-CH-Prefers-Reduced-Motion' | 'Sec-CH-UA' | 'Sec-CH-UA-Arch' | 'Sec-CH-UA-Bitness' | 'Sec-CH-UA-Form-Factor' | 'Sec-CH-UA-Full-Version' | 'Sec-CH-UA-Full-Version-List' | 'Sec-CH-UA-Mobile' | 'Sec-CH-UA-Model' | 'Sec-CH-UA-Platform' | 'Sec-CH-UA-Platform-Version' | 'Sec-CH-UA-WoW64' | 'Sec-Fetch-Dest' | 'Sec-Fetch-Mode' | 'Sec-Fetch-Site' | 'Sec-Fetch-User' | 'Sec-GPC' | 'Server' | 'Server-Timing' | 'Service-Worker-Navigation-Preload' | 'Set-Cookie' | 'Strict-Transport-Security' | 'Timing-Allow-Origin' | 'Trailer' | 'Transfer-Encoding' | 'Upgrade' | 'Vary' | 'WWW-Authenticate' | 'Warning' | 'X-Content-Type-Options' | 'X-DNS-Prefetch-Control' | 'X-Frame-Options' | 'X-Permitted-Cross-Domain-Policies' | 'X-Powered-By' | 'X-Robots-Tag' | 'X-XSS-Protection';
7
+ export type AcceptHeader = 'Accept' | 'Accept-Charset' | 'Accept-Encoding' | 'Accept-Language' | 'Accept-Patch' | 'Accept-Post' | 'Accept-Ranges';
8
+ export type CustomHeader = string & {};
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @module
3
+ * HTTP Status utility.
4
+ */
5
+ export type InfoStatusCode = 100 | 101 | 102 | 103;
6
+ export type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226;
7
+ export type DeprecatedStatusCode = 305 | 306;
8
+ export type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
9
+ export type ClientErrorStatusCode = 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451;
10
+ export type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
11
+ /**
12
+ * `UnofficialStatusCode` can be used to specify an unofficial status code.
13
+ * @example
14
+ *
15
+ * ```ts
16
+ * app.get('/unknown', (c) => {
17
+ * return c.text("Unknown Error", 520 as UnofficialStatusCode)
18
+ * })
19
+ * ```
20
+ */
21
+ export type UnofficialStatusCode = -1;
22
+ /**
23
+ * @deprecated
24
+ * Use `UnofficialStatusCode` instead.
25
+ */
26
+ export type UnOfficalStatusCode = UnofficialStatusCode;
27
+ /**
28
+ * If you want to use an unofficial status, use `UnofficialStatusCode`.
29
+ */
30
+ export type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | UnofficialStatusCode;
31
+ export type ContentlessStatusCode = 101 | 204 | 205 | 304;
32
+ export type ContentfulStatusCode = Exclude<StatusCode, ContentlessStatusCode>;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @module
3
+ * MIME utility.
4
+ */
5
+ export declare const getMimeType: (filename: string, mimes?: Record<string, string>) => string | undefined;
6
+ export declare const getExtension: (mimeType: string) => string | undefined;
7
+ export { baseMimes as mimes };
8
+ /**
9
+ * Union types for BaseMime
10
+ */
11
+ export type BaseMime = (typeof _baseMimes)[keyof typeof _baseMimes];
12
+ declare const _baseMimes: {
13
+ readonly aac: "audio/aac";
14
+ readonly avi: "video/x-msvideo";
15
+ readonly avif: "image/avif";
16
+ readonly av1: "video/av1";
17
+ readonly bin: "application/octet-stream";
18
+ readonly bmp: "image/bmp";
19
+ readonly css: "text/css";
20
+ readonly csv: "text/csv";
21
+ readonly eot: "application/vnd.ms-fontobject";
22
+ readonly epub: "application/epub+zip";
23
+ readonly gif: "image/gif";
24
+ readonly gz: "application/gzip";
25
+ readonly htm: "text/html";
26
+ readonly html: "text/html";
27
+ readonly ico: "image/x-icon";
28
+ readonly ics: "text/calendar";
29
+ readonly jpeg: "image/jpeg";
30
+ readonly jpg: "image/jpeg";
31
+ readonly js: "text/javascript";
32
+ readonly json: "application/json";
33
+ readonly jsonld: "application/ld+json";
34
+ readonly map: "application/json";
35
+ readonly mid: "audio/x-midi";
36
+ readonly midi: "audio/x-midi";
37
+ readonly mjs: "text/javascript";
38
+ readonly mp3: "audio/mpeg";
39
+ readonly mp4: "video/mp4";
40
+ readonly mpeg: "video/mpeg";
41
+ readonly oga: "audio/ogg";
42
+ readonly ogv: "video/ogg";
43
+ readonly ogx: "application/ogg";
44
+ readonly opus: "audio/opus";
45
+ readonly otf: "font/otf";
46
+ readonly pdf: "application/pdf";
47
+ readonly png: "image/png";
48
+ readonly rtf: "application/rtf";
49
+ readonly svg: "image/svg+xml";
50
+ readonly tif: "image/tiff";
51
+ readonly tiff: "image/tiff";
52
+ readonly ts: "video/mp2t";
53
+ readonly ttf: "font/ttf";
54
+ readonly txt: "text/plain";
55
+ readonly wasm: "application/wasm";
56
+ readonly webm: "video/webm";
57
+ readonly weba: "audio/webm";
58
+ readonly webmanifest: "application/manifest+json";
59
+ readonly webp: "image/webp";
60
+ readonly woff: "font/woff";
61
+ readonly woff2: "font/woff2";
62
+ readonly xhtml: "application/xhtml+xml";
63
+ readonly xml: "application/xml";
64
+ readonly zip: "application/zip";
65
+ readonly '3gp': "video/3gpp";
66
+ readonly '3g2': "video/3gpp2";
67
+ readonly gltf: "model/gltf+json";
68
+ readonly glb: "model/gltf-binary";
69
+ };
70
+ declare const baseMimes: Record<string, BaseMime>;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @module
3
+ * Stream utility.
4
+ */
5
+ export declare class StreamingApi {
6
+ private writer;
7
+ private encoder;
8
+ private writable;
9
+ private abortSubscribers;
10
+ responseReadable: ReadableStream;
11
+ /**
12
+ * Whether the stream has been aborted.
13
+ */
14
+ aborted: boolean;
15
+ /**
16
+ * Whether the stream has been closed normally.
17
+ */
18
+ closed: boolean;
19
+ constructor(writable: WritableStream, _readable: ReadableStream);
20
+ write(input: Uint8Array | string): Promise<StreamingApi>;
21
+ writeln(input: string): Promise<StreamingApi>;
22
+ sleep(ms: number): Promise<unknown>;
23
+ close(): Promise<void>;
24
+ pipe(body: ReadableStream): Promise<void>;
25
+ onAbort(listener: () => void | Promise<void>): void;
26
+ /**
27
+ * Abort the stream.
28
+ * You can call this method when stream is aborted by external event.
29
+ */
30
+ abort(): void;
31
+ }
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @module
3
+ * Types utility.
4
+ */
5
+ export type Expect<T extends true> = T;
6
+ export type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false;
7
+ export type NotEqual<X, Y> = true extends Equal<X, Y> ? false : true;
8
+ export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
9
+ export type RemoveBlankRecord<T> = T extends Record<infer K, unknown> ? (K extends string ? T : never) : never;
10
+ export type IfAnyThenEmptyObject<T> = 0 extends 1 & T ? {} : T;
11
+ export type JSONPrimitive = string | boolean | number | null;
12
+ export type JSONArray = (JSONPrimitive | JSONObject | JSONArray)[];
13
+ export type JSONObject = {
14
+ [key: string]: JSONPrimitive | JSONArray | JSONObject | object | InvalidJSONValue;
15
+ };
16
+ export type InvalidJSONValue = undefined | symbol | ((...args: unknown[]) => unknown);
17
+ type InvalidToNull<T> = T extends InvalidJSONValue ? null : T;
18
+ type IsInvalid<T> = T extends InvalidJSONValue ? true : false;
19
+ /**
20
+ * symbol keys are omitted through `JSON.stringify`
21
+ */
22
+ type OmitSymbolKeys<T> = {
23
+ [K in keyof T as K extends symbol ? never : K]: T[K];
24
+ };
25
+ export type JSONValue = JSONObject | JSONArray | JSONPrimitive;
26
+ /**
27
+ * Convert a type to a JSON-compatible type.
28
+ *
29
+ * Non-JSON values such as `Date` implement `.toJSON()`,
30
+ * so they can be transformed to a value assignable to `JSONObject`
31
+ *
32
+ * `JSON.stringify()` throws a `TypeError` when it encounters a `bigint` value,
33
+ * unless a custom `replacer` function or `.toJSON()` method is provided.
34
+ *
35
+ * This behaviour can be controlled by the `TError` generic type parameter,
36
+ * which defaults to `bigint | ReadonlyArray<bigint>`.
37
+ * You can set it to `never` to disable this check.
38
+ */
39
+ export type JSONParsed<T, TError = bigint | ReadonlyArray<bigint>> = T extends {
40
+ toJSON(): infer J;
41
+ } ? (() => J) extends () => JSONPrimitive ? J : (() => J) extends () => {
42
+ toJSON(): unknown;
43
+ } ? {} : JSONParsed<J, TError> : T extends JSONPrimitive ? T : T extends InvalidJSONValue ? never : T extends ReadonlyArray<unknown> ? {
44
+ [K in keyof T]: JSONParsed<InvalidToNull<T[K]>, TError>;
45
+ } : T extends Set<unknown> | Map<unknown, unknown> | Record<string, never> ? {} : T extends object ? T[keyof T] extends TError ? never : {
46
+ [K in keyof OmitSymbolKeys<T> as IsInvalid<T[K]> extends true ? never : K]: boolean extends IsInvalid<T[K]> ? JSONParsed<T[K], TError> | undefined : JSONParsed<T[K], TError>;
47
+ } : T extends unknown ? T extends TError ? never : JSONValue : never;
48
+ /**
49
+ * Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
50
+ * @copyright from sindresorhus/type-fest
51
+ */
52
+ export type Simplify<T> = {
53
+ [KeyType in keyof T]: T[KeyType];
54
+ } & {};
55
+ /**
56
+ * A simple extension of Simplify that will deeply traverse array elements.
57
+ */
58
+ export type SimplifyDeepArray<T> = T extends any[] ? {
59
+ [E in keyof T]: SimplifyDeepArray<T[E]>;
60
+ } : Simplify<T>;
61
+ export type InterfaceToType<T> = T extends Function ? T : {
62
+ [K in keyof T]: InterfaceToType<T[K]>;
63
+ };
64
+ export type RequiredKeysOf<BaseType extends object> = Exclude<{
65
+ [Key in keyof BaseType]: BaseType extends Record<Key, BaseType[Key]> ? Key : never;
66
+ }[keyof BaseType], undefined>;
67
+ export type HasRequiredKeys<BaseType extends object> = RequiredKeysOf<BaseType> extends never ? false : true;
68
+ export type IsAny<T> = boolean extends (T extends never ? true : false) ? true : false;
69
+ /**
70
+ * String literal types with auto-completion
71
+ * @see https://github.com/Microsoft/TypeScript/issues/29729
72
+ */
73
+ export type StringLiteralUnion<T> = T | (string & Record<never, never>);
74
+ export {};
@@ -0,0 +1 @@
1
+ export * from './sse.js';
@@ -0,0 +1,25 @@
1
+ import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
2
+ import { JSONRPCMessage } from '@modelcontextprotocol/sdk/types.js';
3
+ import type { Context } from '../../hono/dist/types/index.d.ts';
4
+ import type { SSEStreamingApi } from '../../hono/dist/types/helper/streaming/index.d.ts';
5
+ export declare class SSETransport implements Transport {
6
+ private messageUrl;
7
+ private stream;
8
+ private _sessionId;
9
+ onclose?: () => void;
10
+ onerror?: (error: Error) => void;
11
+ onmessage?: (message: JSONRPCMessage) => void;
12
+ /**
13
+ * Creates a new SSETransport, which will direct the MPC client to POST messages to messageUrl
14
+ */
15
+ constructor(messageUrl: string, stream: SSEStreamingApi);
16
+ get sessionId(): string;
17
+ start(): Promise<void>;
18
+ handlePostMessage(context: Context): Promise<Response>;
19
+ /**
20
+ * Handle a client message, regardless of how it arrived. This can be used to inform the server of messages that arrive via a means different than HTTP POST.
21
+ */
22
+ handleMessage(message: unknown): Promise<void>;
23
+ close(): Promise<void>;
24
+ send(message: JSONRPCMessage): Promise<void>;
25
+ }
@@ -3,7 +3,7 @@ name: mastra-mcp
3
3
  description: Documentation for @mastra/mcp. Use when working with @mastra/mcp APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/mcp"
6
- version: "1.8.0"
6
+ version: "1.8.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.8.0",
2
+ "version": "1.8.1",
3
3
  "package": "@mastra/mcp",
4
4
  "exports": {
5
5
  "UnauthorizedError": {
@@ -93,7 +93,7 @@ export const myAgent = new Agent({
93
93
  id: 'my-agent',
94
94
  name: 'My Agent',
95
95
  instructions: 'You have access to interactive UI tools.',
96
- model: 'openai/gpt-5-mini',
96
+ model: '__OPENAI_MODEL_MINI__',
97
97
  tools: { calculatorTool },
98
98
  })
99
99
  ```
@@ -125,7 +125,7 @@ const mcpClient = new MCPClient({
125
125
  const myAgent = new Agent({
126
126
  id: 'my-agent',
127
127
  name: 'My Agent',
128
- model: 'openai/gpt-5-mini',
128
+ model: '__OPENAI_MODEL_MINI__',
129
129
  tools: await mcpClient.listTools(),
130
130
  })
131
131
 
@@ -270,7 +270,7 @@ const mcpClient = new MCPClient({
270
270
  const myAgent = new Agent({
271
271
  id: 'my-agent',
272
272
  name: 'My Agent',
273
- model: 'openai/gpt-5-mini',
273
+ model: '__OPENAI_MODEL_MINI__',
274
274
  tools: await mcpClient.listTools(),
275
275
  })
276
276
 
package/dist/index.cjs CHANGED
@@ -3158,7 +3158,7 @@ var MCPServer = class extends mcp.MCPServerBase {
3158
3158
  isError: true
3159
3159
  };
3160
3160
  }
3161
- const validation = tool.parameters.validate?.(request.params.arguments ?? {});
3161
+ const validation = await tool.parameters.validate?.(request.params.arguments ?? {});
3162
3162
  if (validation && !validation.success) {
3163
3163
  this.logger.warn("Invalid tool arguments", {
3164
3164
  tool: request.params.name,
@@ -3241,7 +3241,7 @@ Provided arguments: ${JSON.stringify(request.params.arguments, null, 2)}`
3241
3241
  } else {
3242
3242
  structuredContent = result;
3243
3243
  }
3244
- const outputValidation = tool.outputSchema.validate?.(structuredContent ?? {});
3244
+ const outputValidation = await tool.outputSchema.validate?.(structuredContent ?? {});
3245
3245
  if (outputValidation && !outputValidation.success) {
3246
3246
  this.logger.warn("Invalid structured content", {
3247
3247
  tool: request.params.name,