@mastra/mcp 2.5.0-alpha.1 → 2.5.0-alpha.3
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/events.d.ts +66 -0
- package/dist/client/actions/events.d.ts.map +1 -0
- package/dist/client/client.d.ts +63 -1
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/configuration.d.ts +49 -0
- package/dist/client/configuration.d.ts.map +1 -1
- package/dist/client/events/errors.d.ts +13 -0
- package/dist/client/events/errors.d.ts.map +1 -0
- package/dist/client/events/index.d.ts +3 -0
- package/dist/client/events/index.d.ts.map +1 -0
- package/dist/client/events/mode.d.ts +58 -0
- package/dist/client/events/mode.d.ts.map +1 -0
- package/dist/client/events/poll-driver.d.ts +6 -0
- package/dist/client/events/poll-driver.d.ts.map +1 -0
- package/dist/client/events/push-driver.d.ts +7 -0
- package/dist/client/events/push-driver.d.ts.map +1 -0
- package/dist/client/events/stream-router.d.ts +42 -0
- package/dist/client/events/stream-router.d.ts.map +1 -0
- package/dist/client/events/subscription.d.ts +118 -0
- package/dist/client/events/subscription.d.ts.map +1 -0
- package/dist/client/events/types.d.ts +181 -0
- package/dist/client/events/types.d.ts.map +1 -0
- package/dist/client/events/webhook-driver.d.ts +10 -0
- package/dist/client/events/webhook-driver.d.ts.map +1 -0
- package/dist/client/events/webhook-receiver.d.ts +41 -0
- package/dist/client/events/webhook-receiver.d.ts.map +1 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/types.d.ts +3 -0
- package/dist/client/types.d.ts.map +1 -1
- package/dist/docs/SKILL.md +2 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-guides-mcp-authentication-authorization.md +2 -2
- package/dist/docs/references/docs-guides-mcp-events.md +306 -0
- package/dist/docs/references/reference-tools-mcp-client.md +236 -0
- package/dist/docs/references/reference-tools-mcp-server.md +170 -0
- package/dist/index.cjs +5242 -11216
- 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 +5282 -11267
- package/dist/index.js.map +1 -1
- package/dist/integrations/events-cursor-store.d.ts +25 -0
- package/dist/integrations/events-cursor-store.d.ts.map +1 -0
- package/dist/integrations/events-signals.d.ts +99 -0
- package/dist/integrations/events-signals.d.ts.map +1 -0
- package/dist/integrations/events-tools.d.ts +24 -0
- package/dist/integrations/events-tools.d.ts.map +1 -0
- package/dist/integrations/events-utils.d.ts +18 -0
- package/dist/integrations/events-utils.d.ts.map +1 -0
- package/dist/integrations/index.d.ts +5 -0
- package/dist/integrations/index.d.ts.map +1 -0
- package/dist/server/events/actions.d.ts +35 -0
- package/dist/server/events/actions.d.ts.map +1 -0
- package/dist/server/events/define-event.d.ts +19 -0
- package/dist/server/events/define-event.d.ts.map +1 -0
- package/dist/server/events/handlers.d.ts +49 -0
- package/dist/server/events/handlers.d.ts.map +1 -0
- package/dist/server/events/index.d.ts +7 -0
- package/dist/server/events/index.d.ts.map +1 -0
- package/dist/server/events/inspector.d.ts +14 -0
- package/dist/server/events/inspector.d.ts.map +1 -0
- package/dist/server/events/registry.d.ts +59 -0
- package/dist/server/events/registry.d.ts.map +1 -0
- package/dist/server/events/ring-buffer.d.ts +56 -0
- package/dist/server/events/ring-buffer.d.ts.map +1 -0
- package/dist/server/events/stream.d.ts +56 -0
- package/dist/server/events/stream.d.ts.map +1 -0
- package/dist/server/events/types.d.ts +203 -0
- package/dist/server/events/types.d.ts.map +1 -0
- package/dist/server/events/webhook-dispatcher.d.ts +98 -0
- package/dist/server/events/webhook-dispatcher.d.ts.map +1 -0
- package/dist/server/events/webhook-store.d.ts +60 -0
- package/dist/server/events/webhook-store.d.ts.map +1 -0
- package/dist/server/events/webhook-transport.d.ts +44 -0
- package/dist/server/events/webhook-transport.d.ts.map +1 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/server.d.ts +53 -1
- package/dist/server/server.d.ts.map +1 -1
- package/dist/shared/events/capability.d.ts +25 -0
- package/dist/shared/events/capability.d.ts.map +1 -0
- package/dist/shared/events/constants.d.ts +53 -0
- package/dist/shared/events/constants.d.ts.map +1 -0
- package/dist/shared/events/index.d.ts +7 -0
- package/dist/shared/events/index.d.ts.map +1 -0
- package/dist/shared/events/schemas.d.ts +356 -0
- package/dist/shared/events/schemas.d.ts.map +1 -0
- package/dist/shared/events/types.d.ts +37 -0
- package/dist/shared/events/types.d.ts.map +1 -0
- package/dist/shared/events/webhook-url.d.ts +59 -0
- package/dist/shared/events/webhook-url.d.ts.map +1 -0
- package/dist/shared/events/webhook.d.ts +60 -0
- package/dist/shared/events/webhook.d.ts.map +1 -0
- package/package.json +8 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/shared/events/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,mCAAmC,CAAC;AAEpE,4FAA4F;AAC5F,eAAO,MAAM,+BAA+B,2CAA2C,CAAC;AAExF,eAAO,MAAM,cAAc;aACzB,IAAI,EAAE,aAAa;aACnB,IAAI,EAAE,aAAa;aACnB,MAAM,EAAE,eAAe;aACvB,SAAS,EAAE,kBAAkB;aAC7B,WAAW,EAAE,oBAAoB;CACzB,CAAC;AAEX,eAAO,MAAM,oBAAoB;aAC/B,MAAM,EAAE,6BAA6B;aACrC,KAAK,EAAE,4BAA4B;aACnC,SAAS,EAAE,gCAAgC;aAC3C,KAAK,EAAE,4BAA4B;aACnC,UAAU,EAAE,iCAAiC;aAC7C,WAAW,EAAE,mCAAmC;CACxC,CAAC;AAEX,eAAO,MAAM,oBAAoB,YAAI,MAAM,EAAE,MAAM,EAAE,SAAS,CAAU,CAAC;AAEzE;;;GAGG;AACH,eAAO,MAAM,kBAAkB;aAC7B,aAAa,EAAE,CAAC,KAAK;aACrB,QAAQ,EAAE,CAAC,KAAK;aAChB,SAAS,EAAE,CAAC,KAAK;aACjB,iBAAiB,EAAE,CAAC,KAAK;aACzB,WAAW,EAAE,CAAC,KAAK;aACnB,qBAAqB,EAAE,CAAC,KAAK;CACrB,CAAC;AAEX,sFAAsF;AACtF,eAAO,MAAM,gCAAgC,EAAE,SAAS,MAAM,EAK7D,CAAC;AAEF,kGAAkG;AAClG,eAAO,MAAM,uBAAuB,YAClC,oBAAoB,EACpB,SAAS,EACT,WAAW,EACX,UAAU,EACV,UAAU,EACV,kBAAkB,CACV,CAAC;AAEX,iGAAiG;AACjG,eAAO,MAAM,eAAe;aAC1B,EAAE,EAAE,YAAY;aAChB,SAAS,EAAE,mBAAmB;aAC9B,SAAS,EAAE,mBAAmB;aAC9B,cAAc,EAAE,uBAAuB;CAC/B,CAAC;AAEX,gEAAgE;AAChE,eAAO,MAAM,oCAAoC,QAAS,CAAC;AAE3D,sGAAsG;AACtG,eAAO,MAAM,4BAA4B,OAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/events/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,mBAAmB,SAAS,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schemas for the MCP Events extension (SEP-3415) wire format.
|
|
3
|
+
*
|
|
4
|
+
* Parsing is deliberately loose: objects tolerate unknown fields and `resultType` is optional, so that
|
|
5
|
+
* revisions of the draft SEP that add fields do not break existing peers.
|
|
6
|
+
*
|
|
7
|
+
* @experimental SEP-3415 is a draft Extensions Track proposal. Shapes may change.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod/v4';
|
|
10
|
+
/** `capabilities.extensions["io.modelcontextprotocol/events"]` settings object. */
|
|
11
|
+
export declare const EventsCapabilitySchema: z.ZodObject<{
|
|
12
|
+
listChanged: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
}, z.core.$loose>;
|
|
14
|
+
export declare const EventDeliveryModeSchema: z.ZodEnum<{
|
|
15
|
+
poll: "poll";
|
|
16
|
+
push: "push";
|
|
17
|
+
webhook: "webhook";
|
|
18
|
+
}>;
|
|
19
|
+
export declare const EventDescriptorSchema: z.ZodObject<{
|
|
20
|
+
name: z.ZodString;
|
|
21
|
+
description: z.ZodOptional<z.ZodString>;
|
|
22
|
+
delivery: z.ZodArray<z.ZodString>;
|
|
23
|
+
inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
24
|
+
payloadSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
25
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
26
|
+
}, z.core.$loose>;
|
|
27
|
+
export declare const EventOccurrenceSchema: z.ZodObject<{
|
|
28
|
+
eventId: z.ZodString;
|
|
29
|
+
name: z.ZodString;
|
|
30
|
+
timestamp: z.ZodString;
|
|
31
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
32
|
+
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
33
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
34
|
+
}, z.core.$loose>;
|
|
35
|
+
export declare const EventsErrorSchema: z.ZodObject<{
|
|
36
|
+
code: z.ZodNumber;
|
|
37
|
+
message: z.ZodString;
|
|
38
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
39
|
+
}, z.core.$loose>;
|
|
40
|
+
export declare const ListEventsRequestParamsSchema: z.ZodObject<{
|
|
41
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
42
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
43
|
+
}, z.core.$loose>;
|
|
44
|
+
export declare const ListEventsRequestSchema: z.ZodObject<{
|
|
45
|
+
method: z.ZodLiteral<"events/list">;
|
|
46
|
+
params: z.ZodOptional<z.ZodObject<{
|
|
47
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
48
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
49
|
+
}, z.core.$loose>>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
export declare const ListEventsResultSchema: z.ZodObject<{
|
|
52
|
+
resultType: z.ZodOptional<z.ZodString>;
|
|
53
|
+
events: z.ZodArray<z.ZodObject<{
|
|
54
|
+
name: z.ZodString;
|
|
55
|
+
description: z.ZodOptional<z.ZodString>;
|
|
56
|
+
delivery: z.ZodArray<z.ZodString>;
|
|
57
|
+
inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
58
|
+
payloadSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
59
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
60
|
+
}, z.core.$loose>>;
|
|
61
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
62
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
63
|
+
}, z.core.$loose>;
|
|
64
|
+
export declare const PollEventsRequestParamsSchema: z.ZodObject<{
|
|
65
|
+
name: z.ZodString;
|
|
66
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
67
|
+
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
68
|
+
maxAgeMs: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
70
|
+
maxEvents: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
}, z.core.$loose>;
|
|
72
|
+
export declare const PollEventsRequestSchema: z.ZodObject<{
|
|
73
|
+
method: z.ZodLiteral<"events/poll">;
|
|
74
|
+
params: z.ZodObject<{
|
|
75
|
+
name: z.ZodString;
|
|
76
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
77
|
+
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
78
|
+
maxAgeMs: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
80
|
+
maxEvents: z.ZodOptional<z.ZodNumber>;
|
|
81
|
+
}, z.core.$loose>;
|
|
82
|
+
}, z.core.$strip>;
|
|
83
|
+
export declare const PollEventsResultSchema: z.ZodObject<{
|
|
84
|
+
resultType: z.ZodOptional<z.ZodString>;
|
|
85
|
+
events: z.ZodArray<z.ZodObject<{
|
|
86
|
+
eventId: z.ZodString;
|
|
87
|
+
name: z.ZodString;
|
|
88
|
+
timestamp: z.ZodString;
|
|
89
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
90
|
+
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
91
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
92
|
+
}, z.core.$loose>>;
|
|
93
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
94
|
+
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
95
|
+
hasMore: z.ZodOptional<z.ZodBoolean>;
|
|
96
|
+
nextPollMs: z.ZodOptional<z.ZodNumber>;
|
|
97
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
98
|
+
}, z.core.$loose>;
|
|
99
|
+
export declare const StreamEventsRequestParamsSchema: z.ZodObject<{
|
|
100
|
+
name: z.ZodString;
|
|
101
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
102
|
+
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
103
|
+
maxAgeMs: z.ZodOptional<z.ZodNumber>;
|
|
104
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
105
|
+
}, z.core.$loose>;
|
|
106
|
+
export declare const StreamEventsRequestSchema: z.ZodObject<{
|
|
107
|
+
method: z.ZodLiteral<"events/stream">;
|
|
108
|
+
params: z.ZodObject<{
|
|
109
|
+
name: z.ZodString;
|
|
110
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
111
|
+
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
112
|
+
maxAgeMs: z.ZodOptional<z.ZodNumber>;
|
|
113
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
114
|
+
}, z.core.$loose>;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
export declare const StreamEventsResultSchema: z.ZodObject<{
|
|
117
|
+
resultType: z.ZodOptional<z.ZodString>;
|
|
118
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
119
|
+
}, z.core.$loose>;
|
|
120
|
+
/** `_meta` on every `notifications/events/*` message delivered on a push stream. */
|
|
121
|
+
export declare const StreamNotificationMetaSchema: z.ZodObject<{
|
|
122
|
+
"io.modelcontextprotocol/subscriptionId": z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
123
|
+
}, z.core.$loose>;
|
|
124
|
+
export declare const EventActiveNotificationParamsSchema: z.ZodObject<{
|
|
125
|
+
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
126
|
+
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
127
|
+
_meta: z.ZodObject<{
|
|
128
|
+
"io.modelcontextprotocol/subscriptionId": z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
129
|
+
}, z.core.$loose>;
|
|
130
|
+
}, z.core.$loose>;
|
|
131
|
+
export declare const EventNotificationParamsSchema: z.ZodObject<{
|
|
132
|
+
eventId: z.ZodString;
|
|
133
|
+
name: z.ZodString;
|
|
134
|
+
timestamp: z.ZodString;
|
|
135
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
136
|
+
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
137
|
+
_meta: z.ZodObject<{
|
|
138
|
+
"io.modelcontextprotocol/subscriptionId": z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
139
|
+
}, z.core.$loose>;
|
|
140
|
+
}, z.core.$loose>;
|
|
141
|
+
export declare const EventHeartbeatNotificationParamsSchema: z.ZodObject<{
|
|
142
|
+
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
143
|
+
_meta: z.ZodObject<{
|
|
144
|
+
"io.modelcontextprotocol/subscriptionId": z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
145
|
+
}, z.core.$loose>;
|
|
146
|
+
}, z.core.$loose>;
|
|
147
|
+
export declare const EventErrorNotificationParamsSchema: z.ZodObject<{
|
|
148
|
+
error: z.ZodObject<{
|
|
149
|
+
code: z.ZodNumber;
|
|
150
|
+
message: z.ZodString;
|
|
151
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
152
|
+
}, z.core.$loose>;
|
|
153
|
+
_meta: z.ZodObject<{
|
|
154
|
+
"io.modelcontextprotocol/subscriptionId": z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
155
|
+
}, z.core.$loose>;
|
|
156
|
+
}, z.core.$loose>;
|
|
157
|
+
export declare const EventTerminatedNotificationParamsSchema: z.ZodObject<{
|
|
158
|
+
error: z.ZodObject<{
|
|
159
|
+
code: z.ZodNumber;
|
|
160
|
+
message: z.ZodString;
|
|
161
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
162
|
+
}, z.core.$loose>;
|
|
163
|
+
_meta: z.ZodObject<{
|
|
164
|
+
"io.modelcontextprotocol/subscriptionId": z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
165
|
+
}, z.core.$loose>;
|
|
166
|
+
}, z.core.$loose>;
|
|
167
|
+
export declare const EventsListChangedNotificationParamsSchema: z.ZodOptional<z.ZodObject<{
|
|
168
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
169
|
+
}, z.core.$loose>>;
|
|
170
|
+
export declare const EventActiveNotificationSchema: z.ZodObject<{
|
|
171
|
+
method: z.ZodLiteral<"notifications/events/active">;
|
|
172
|
+
params: z.ZodObject<{
|
|
173
|
+
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
174
|
+
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
175
|
+
_meta: z.ZodObject<{
|
|
176
|
+
"io.modelcontextprotocol/subscriptionId": z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
177
|
+
}, z.core.$loose>;
|
|
178
|
+
}, z.core.$loose>;
|
|
179
|
+
}, z.core.$strip>;
|
|
180
|
+
export declare const EventNotificationSchema: z.ZodObject<{
|
|
181
|
+
method: z.ZodLiteral<"notifications/events/event">;
|
|
182
|
+
params: z.ZodObject<{
|
|
183
|
+
eventId: z.ZodString;
|
|
184
|
+
name: z.ZodString;
|
|
185
|
+
timestamp: z.ZodString;
|
|
186
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
187
|
+
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
188
|
+
_meta: z.ZodObject<{
|
|
189
|
+
"io.modelcontextprotocol/subscriptionId": z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
190
|
+
}, z.core.$loose>;
|
|
191
|
+
}, z.core.$loose>;
|
|
192
|
+
}, z.core.$strip>;
|
|
193
|
+
export declare const EventHeartbeatNotificationSchema: z.ZodObject<{
|
|
194
|
+
method: z.ZodLiteral<"notifications/events/heartbeat">;
|
|
195
|
+
params: z.ZodObject<{
|
|
196
|
+
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
197
|
+
_meta: z.ZodObject<{
|
|
198
|
+
"io.modelcontextprotocol/subscriptionId": z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
199
|
+
}, z.core.$loose>;
|
|
200
|
+
}, z.core.$loose>;
|
|
201
|
+
}, z.core.$strip>;
|
|
202
|
+
export declare const EventErrorNotificationSchema: z.ZodObject<{
|
|
203
|
+
method: z.ZodLiteral<"notifications/events/error">;
|
|
204
|
+
params: z.ZodObject<{
|
|
205
|
+
error: z.ZodObject<{
|
|
206
|
+
code: z.ZodNumber;
|
|
207
|
+
message: z.ZodString;
|
|
208
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
209
|
+
}, z.core.$loose>;
|
|
210
|
+
_meta: z.ZodObject<{
|
|
211
|
+
"io.modelcontextprotocol/subscriptionId": z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
212
|
+
}, z.core.$loose>;
|
|
213
|
+
}, z.core.$loose>;
|
|
214
|
+
}, z.core.$strip>;
|
|
215
|
+
export declare const EventTerminatedNotificationSchema: z.ZodObject<{
|
|
216
|
+
method: z.ZodLiteral<"notifications/events/terminated">;
|
|
217
|
+
params: z.ZodObject<{
|
|
218
|
+
error: z.ZodObject<{
|
|
219
|
+
code: z.ZodNumber;
|
|
220
|
+
message: z.ZodString;
|
|
221
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
222
|
+
}, z.core.$loose>;
|
|
223
|
+
_meta: z.ZodObject<{
|
|
224
|
+
"io.modelcontextprotocol/subscriptionId": z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
225
|
+
}, z.core.$loose>;
|
|
226
|
+
}, z.core.$loose>;
|
|
227
|
+
}, z.core.$strip>;
|
|
228
|
+
export declare const EventsListChangedNotificationSchema: z.ZodObject<{
|
|
229
|
+
method: z.ZodLiteral<"notifications/events/list_changed">;
|
|
230
|
+
params: z.ZodOptional<z.ZodObject<{
|
|
231
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
232
|
+
}, z.core.$loose>>;
|
|
233
|
+
}, z.core.$strip>;
|
|
234
|
+
/** Standard Webhooks symmetric secret: `whsec_` + base64 of 24 to 64 random bytes. */
|
|
235
|
+
export declare const WebhookSecretSchema: z.ZodString;
|
|
236
|
+
export declare const WebhookDeliverySchema: z.ZodObject<{
|
|
237
|
+
mode: z.ZodLiteral<"webhook">;
|
|
238
|
+
url: z.ZodString;
|
|
239
|
+
secret: z.ZodString;
|
|
240
|
+
}, z.core.$loose>;
|
|
241
|
+
export declare const SubscribeEventsRequestParamsSchema: z.ZodObject<{
|
|
242
|
+
name: z.ZodString;
|
|
243
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
244
|
+
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
245
|
+
maxAgeMs: z.ZodOptional<z.ZodNumber>;
|
|
246
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
247
|
+
delivery: z.ZodObject<{
|
|
248
|
+
mode: z.ZodLiteral<"webhook">;
|
|
249
|
+
url: z.ZodString;
|
|
250
|
+
secret: z.ZodString;
|
|
251
|
+
}, z.core.$loose>;
|
|
252
|
+
ttlMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
253
|
+
}, z.core.$loose>;
|
|
254
|
+
export declare const SubscribeEventsRequestSchema: z.ZodObject<{
|
|
255
|
+
method: z.ZodLiteral<"events/subscribe">;
|
|
256
|
+
params: z.ZodObject<{
|
|
257
|
+
name: z.ZodString;
|
|
258
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
259
|
+
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
260
|
+
maxAgeMs: z.ZodOptional<z.ZodNumber>;
|
|
261
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
262
|
+
delivery: z.ZodObject<{
|
|
263
|
+
mode: z.ZodLiteral<"webhook">;
|
|
264
|
+
url: z.ZodString;
|
|
265
|
+
secret: z.ZodString;
|
|
266
|
+
}, z.core.$loose>;
|
|
267
|
+
ttlMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
268
|
+
}, z.core.$loose>;
|
|
269
|
+
}, z.core.$strip>;
|
|
270
|
+
export declare const WebhookFailureReasonSchema: z.ZodString;
|
|
271
|
+
export declare const WebhookDeliveryStatusSchema: z.ZodObject<{
|
|
272
|
+
active: z.ZodBoolean;
|
|
273
|
+
lastDeliveryAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
274
|
+
lastError: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
275
|
+
failedSince: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
276
|
+
throttled: z.ZodOptional<z.ZodBoolean>;
|
|
277
|
+
retryAfterMs: z.ZodOptional<z.ZodNumber>;
|
|
278
|
+
}, z.core.$loose>;
|
|
279
|
+
export declare const SubscribeEventsResultSchema: z.ZodObject<{
|
|
280
|
+
resultType: z.ZodOptional<z.ZodString>;
|
|
281
|
+
id: z.ZodString;
|
|
282
|
+
refreshBefore: z.ZodNullable<z.ZodString>;
|
|
283
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
284
|
+
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
285
|
+
deliveryStatus: z.ZodOptional<z.ZodObject<{
|
|
286
|
+
active: z.ZodBoolean;
|
|
287
|
+
lastDeliveryAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
288
|
+
lastError: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
289
|
+
failedSince: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
290
|
+
throttled: z.ZodOptional<z.ZodBoolean>;
|
|
291
|
+
retryAfterMs: z.ZodOptional<z.ZodNumber>;
|
|
292
|
+
}, z.core.$loose>>;
|
|
293
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
294
|
+
}, z.core.$loose>;
|
|
295
|
+
export declare const UnsubscribeEventsRequestParamsSchema: z.ZodObject<{
|
|
296
|
+
name: z.ZodString;
|
|
297
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
298
|
+
delivery: z.ZodObject<{
|
|
299
|
+
url: z.ZodString;
|
|
300
|
+
}, z.core.$loose>;
|
|
301
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
302
|
+
}, z.core.$loose>;
|
|
303
|
+
export declare const UnsubscribeEventsRequestSchema: z.ZodObject<{
|
|
304
|
+
method: z.ZodLiteral<"events/unsubscribe">;
|
|
305
|
+
params: z.ZodObject<{
|
|
306
|
+
name: z.ZodString;
|
|
307
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
308
|
+
delivery: z.ZodObject<{
|
|
309
|
+
url: z.ZodString;
|
|
310
|
+
}, z.core.$loose>;
|
|
311
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
312
|
+
}, z.core.$loose>;
|
|
313
|
+
}, z.core.$strip>;
|
|
314
|
+
export declare const UnsubscribeEventsResultSchema: z.ZodObject<{
|
|
315
|
+
resultType: z.ZodOptional<z.ZodString>;
|
|
316
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
317
|
+
}, z.core.$loose>;
|
|
318
|
+
export declare const WebhookGapBodySchema: z.ZodObject<{
|
|
319
|
+
type: z.ZodLiteral<"gap">;
|
|
320
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
321
|
+
}, z.core.$loose>;
|
|
322
|
+
export declare const WebhookTerminatedBodySchema: z.ZodObject<{
|
|
323
|
+
type: z.ZodLiteral<"terminated">;
|
|
324
|
+
error: z.ZodObject<{
|
|
325
|
+
code: z.ZodNumber;
|
|
326
|
+
message: z.ZodString;
|
|
327
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
328
|
+
}, z.core.$loose>;
|
|
329
|
+
}, z.core.$loose>;
|
|
330
|
+
export declare const WebhookVerificationBodySchema: z.ZodObject<{
|
|
331
|
+
type: z.ZodLiteral<"verification">;
|
|
332
|
+
challenge: z.ZodString;
|
|
333
|
+
}, z.core.$loose>;
|
|
334
|
+
export declare const WebhookControlBodySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
335
|
+
type: z.ZodLiteral<"gap">;
|
|
336
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
337
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
338
|
+
type: z.ZodLiteral<"terminated">;
|
|
339
|
+
error: z.ZodObject<{
|
|
340
|
+
code: z.ZodNumber;
|
|
341
|
+
message: z.ZodString;
|
|
342
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
343
|
+
}, z.core.$loose>;
|
|
344
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
345
|
+
type: z.ZodLiteral<"verification">;
|
|
346
|
+
challenge: z.ZodString;
|
|
347
|
+
}, z.core.$loose>], "type">;
|
|
348
|
+
/** A body with a top-level `type` field is a control envelope; otherwise it is an occurrence. */
|
|
349
|
+
export declare function parseWebhookBody(body: unknown): {
|
|
350
|
+
kind: 'event';
|
|
351
|
+
event: z.infer<typeof EventOccurrenceSchema>;
|
|
352
|
+
} | {
|
|
353
|
+
kind: 'control';
|
|
354
|
+
control: z.infer<typeof WebhookControlBodySchema>;
|
|
355
|
+
};
|
|
356
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/shared/events/schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAc3B,m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5
|
+
*/
|
|
6
|
+
import type { z } from 'zod/v4';
|
|
7
|
+
import type { EVENT_DELIVERY_MODES, EVENTS_ERROR_CODES, WEBHOOK_FAILURE_REASONS } from './constants.js';
|
|
8
|
+
import type { EventActiveNotificationParamsSchema, EventDescriptorSchema, EventErrorNotificationParamsSchema, EventHeartbeatNotificationParamsSchema, EventNotificationParamsSchema, EventOccurrenceSchema, EventsCapabilitySchema, EventsErrorSchema, EventTerminatedNotificationParamsSchema, ListEventsRequestParamsSchema, ListEventsResultSchema, PollEventsRequestParamsSchema, PollEventsResultSchema, StreamEventsRequestParamsSchema, StreamEventsResultSchema, SubscribeEventsRequestParamsSchema, SubscribeEventsResultSchema, UnsubscribeEventsRequestParamsSchema, UnsubscribeEventsResultSchema, WebhookControlBodySchema, WebhookDeliveryStatusSchema } from './schemas.js';
|
|
9
|
+
export type EventDeliveryMode = (typeof EVENT_DELIVERY_MODES)[number];
|
|
10
|
+
export type EventsErrorCode = (typeof EVENTS_ERROR_CODES)[keyof typeof EVENTS_ERROR_CODES];
|
|
11
|
+
export type WebhookFailureReason = (typeof WEBHOOK_FAILURE_REASONS)[number];
|
|
12
|
+
export type EventsCapability = z.infer<typeof EventsCapabilitySchema>;
|
|
13
|
+
export type EventDescriptor = z.infer<typeof EventDescriptorSchema>;
|
|
14
|
+
export type EventOccurrence = z.infer<typeof EventOccurrenceSchema>;
|
|
15
|
+
export type EventsError = z.infer<typeof EventsErrorSchema>;
|
|
16
|
+
export type ListEventsRequestParams = z.infer<typeof ListEventsRequestParamsSchema>;
|
|
17
|
+
export type ListEventsResult = z.infer<typeof ListEventsResultSchema>;
|
|
18
|
+
export type PollEventsRequestParams = z.infer<typeof PollEventsRequestParamsSchema>;
|
|
19
|
+
export type PollEventsResult = z.infer<typeof PollEventsResultSchema>;
|
|
20
|
+
export type StreamEventsRequestParams = z.infer<typeof StreamEventsRequestParamsSchema>;
|
|
21
|
+
export type StreamEventsResult = z.infer<typeof StreamEventsResultSchema>;
|
|
22
|
+
export type SubscribeEventsRequestParams = z.infer<typeof SubscribeEventsRequestParamsSchema>;
|
|
23
|
+
export type SubscribeEventsResult = z.infer<typeof SubscribeEventsResultSchema>;
|
|
24
|
+
export type UnsubscribeEventsRequestParams = z.infer<typeof UnsubscribeEventsRequestParamsSchema>;
|
|
25
|
+
export type UnsubscribeEventsResult = z.infer<typeof UnsubscribeEventsResultSchema>;
|
|
26
|
+
export type WebhookDeliveryStatus = z.infer<typeof WebhookDeliveryStatusSchema>;
|
|
27
|
+
export type WebhookControlBody = z.infer<typeof WebhookControlBodySchema>;
|
|
28
|
+
export type EventActiveNotificationParams = z.infer<typeof EventActiveNotificationParamsSchema>;
|
|
29
|
+
export type EventNotificationParams = z.infer<typeof EventNotificationParamsSchema>;
|
|
30
|
+
export type EventHeartbeatNotificationParams = z.infer<typeof EventHeartbeatNotificationParamsSchema>;
|
|
31
|
+
export type EventErrorNotificationParams = z.infer<typeof EventErrorNotificationParamsSchema>;
|
|
32
|
+
export type EventTerminatedNotificationParams = z.infer<typeof EventTerminatedNotificationParamsSchema>;
|
|
33
|
+
/** Field this extension adds to the `subscriptions/listen` notifications filter. */
|
|
34
|
+
export interface EventsSubscriptionFilter {
|
|
35
|
+
eventsListChanged?: boolean;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/shared/events/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACrG,OAAO,KAAK,EACV,mCAAmC,EACnC,qBAAqB,EACrB,kCAAkC,EAClC,sCAAsC,EACtC,6BAA6B,EAC7B,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,uCAAuC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AAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAC9F,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAChF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAClG,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AACpF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAChF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAC;AAChG,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AACpF,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sCAAsC,CAAC,CAAC;AACtG,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAC9F,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uCAAuC,CAAC,CAAC;AAExG,oFAAoF;AACpF,MAAM,WAAW,wBAAwB;IACvC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** @experimental SEP-3415 is a draft; this API may change. */
|
|
2
|
+
export type WebhookUrlFailure = 'invalid_url' | 'insecure_scheme' | 'disallowed_address' | 'dns_failure';
|
|
3
|
+
/**
|
|
4
|
+
* Thrown when a callback URL fails the webhook URL policy.
|
|
5
|
+
*
|
|
6
|
+
* @experimental SEP-3415 is a draft; this API may change.
|
|
7
|
+
*/
|
|
8
|
+
export declare class WebhookUrlError extends Error {
|
|
9
|
+
readonly reason: WebhookUrlFailure;
|
|
10
|
+
readonly url: string;
|
|
11
|
+
constructor(reason: WebhookUrlFailure, url: string, message: string);
|
|
12
|
+
}
|
|
13
|
+
/** @experimental SEP-3415 is a draft; this API may change. */
|
|
14
|
+
export type WebhookLookup = (hostname: string) => Promise<Array<{
|
|
15
|
+
address: string;
|
|
16
|
+
family: 4 | 6;
|
|
17
|
+
}>>;
|
|
18
|
+
/** @experimental SEP-3415 is a draft; this API may change. */
|
|
19
|
+
export interface WebhookUrlPolicyOptions {
|
|
20
|
+
/** Skip address classification, allowing private and loopback targets (tests and private deployments). */
|
|
21
|
+
allowPrivate?: boolean;
|
|
22
|
+
/** Allow `http:` callback URLs. */
|
|
23
|
+
allowInsecure?: boolean;
|
|
24
|
+
/** Resolver used for hostnames. Defaults to `dns.promises.lookup` returning every address. */
|
|
25
|
+
lookup?: WebhookLookup;
|
|
26
|
+
}
|
|
27
|
+
/** @experimental SEP-3415 is a draft; this API may change. */
|
|
28
|
+
export interface ResolvedWebhookUrl {
|
|
29
|
+
url: URL;
|
|
30
|
+
/** The validated IP that delivery must connect to, so a later DNS answer cannot rebind it. */
|
|
31
|
+
address: string;
|
|
32
|
+
family: 4 | 6;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* True when a literal IP address is globally routable. Non-IP input, scoped (zone) addresses, and
|
|
36
|
+
* NAT64 / 6to4 addresses that embed a non-global IPv4 address are all treated as not routable.
|
|
37
|
+
*
|
|
38
|
+
* @experimental SEP-3415 is a draft; this API may change.
|
|
39
|
+
*/
|
|
40
|
+
export declare function isGloballyRoutableAddress(ip: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Synchronously validate a callback URL: it must parse, use `https:` (unless `allowInsecure`), carry no
|
|
43
|
+
* credentials, and, when its host is an IP literal, that IP must be globally routable (unless `allowPrivate`).
|
|
44
|
+
* Hostnames are not resolved here; use {@link resolveAndValidate} before connecting.
|
|
45
|
+
*
|
|
46
|
+
* @throws {WebhookUrlError}
|
|
47
|
+
* @experimental SEP-3415 is a draft; this API may change.
|
|
48
|
+
*/
|
|
49
|
+
export declare function validateWebhookUrl(url: string, opts?: WebhookUrlPolicyOptions): URL;
|
|
50
|
+
/**
|
|
51
|
+
* Validate a callback URL and resolve it to the IP that delivery must connect to. Every resolved address
|
|
52
|
+
* must be globally routable (a mixed answer is a DNS-rebinding vector); the first is returned as the pinned
|
|
53
|
+
* address. Delivery connects to that address and uses the URL hostname for TLS SNI and the Host header.
|
|
54
|
+
*
|
|
55
|
+
* @throws {WebhookUrlError}
|
|
56
|
+
* @experimental SEP-3415 is a draft; this API may change.
|
|
57
|
+
*/
|
|
58
|
+
export declare function resolveAndValidate(url: string, opts?: WebhookUrlPolicyOptions): Promise<ResolvedWebhookUrl>;
|
|
59
|
+
//# sourceMappingURL=webhook-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-url.d.ts","sourceRoot":"","sources":["../../../src/shared/events/webhook-url.ts"],"names":[],"mappings":"AAQA,8DAA8D;AAC9D,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,iBAAiB,GAAG,oBAAoB,GAAG,aAAa,CAAC;AAEzG;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACnC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,YAAY,MAAM,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAKlE;CACF;AAED,8DAA8D;AAC9D,MAAM,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,KAAK,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAA;CAAE,CAAC,CAAC,CAAC;AAErG,8DAA8D;AAC9D,MAAM,WAAW,uBAAuB;IACtC,0GAA0G;IAC1G,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mCAAmC;IACnC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,8FAA8F;IAC9F,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,8DAA8D;AAC9D,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,GAAG,CAAC;IACT,8FAA8F;IAC9F,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;CACf;AAqED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAyB7D;AAOD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,uBAA4B,GAAG,GAAG,CAyBvF;AAOD;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,uBAA4B,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA6BrH"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate a Standard Webhooks symmetric secret: `whsec_` + base64 of 32 CSPRNG bytes.
|
|
3
|
+
*
|
|
4
|
+
* @experimental SEP-3415 is a draft; this API may change.
|
|
5
|
+
*/
|
|
6
|
+
export declare function generateWebhookSecret(): string;
|
|
7
|
+
/** @experimental SEP-3415 is a draft; this API may change. */
|
|
8
|
+
export interface SignWebhookOptions {
|
|
9
|
+
/** One secret, or several to dual-sign during a rotation grace window. */
|
|
10
|
+
secret: string | readonly string[];
|
|
11
|
+
/** The `webhook-id` value. */
|
|
12
|
+
id: string;
|
|
13
|
+
/** The `webhook-timestamp` value, in Unix seconds. */
|
|
14
|
+
timestamp: number;
|
|
15
|
+
/** The raw request body, exactly as it will be sent. */
|
|
16
|
+
body: string | Uint8Array;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Compute the `webhook-signature` header value: `v1,<base64 HMAC-SHA256>` over
|
|
20
|
+
* `${id}.${timestamp}.` + raw body. Several secrets yield space-separated signatures.
|
|
21
|
+
*
|
|
22
|
+
* @throws {Error} when a secret is not a valid `whsec_` secret.
|
|
23
|
+
* @experimental SEP-3415 is a draft; this API may change.
|
|
24
|
+
*/
|
|
25
|
+
export declare function signWebhook({ secret, id, timestamp, body }: SignWebhookOptions): string;
|
|
26
|
+
/** @experimental SEP-3415 is a draft; this API may change. */
|
|
27
|
+
export type WebhookVerifyFailure = 'missing_headers' | 'invalid_timestamp' | 'stale_timestamp' | 'invalid_signature';
|
|
28
|
+
/** @experimental SEP-3415 is a draft; this API may change. */
|
|
29
|
+
export type WebhookVerifyResult = {
|
|
30
|
+
ok: true;
|
|
31
|
+
id: string;
|
|
32
|
+
timestamp: number;
|
|
33
|
+
/** The `X-MCP-Subscription-Id` header, when present. */
|
|
34
|
+
subscriptionId?: string;
|
|
35
|
+
/** The secret whose signature matched. */
|
|
36
|
+
secret: string;
|
|
37
|
+
} | {
|
|
38
|
+
ok: false;
|
|
39
|
+
reason: WebhookVerifyFailure;
|
|
40
|
+
};
|
|
41
|
+
/** @experimental SEP-3415 is a draft; this API may change. */
|
|
42
|
+
export type WebhookHeaders = Headers | Record<string, string | string[] | undefined>;
|
|
43
|
+
/** @experimental SEP-3415 is a draft; this API may change. */
|
|
44
|
+
export interface VerifyWebhookOptions {
|
|
45
|
+
/** The expected secret, or every candidate secret (for example those not yet associated with an `id`). */
|
|
46
|
+
secret: string | readonly string[];
|
|
47
|
+
headers: WebhookHeaders;
|
|
48
|
+
/** The raw request body bytes exactly as received, never a re-serialized object. */
|
|
49
|
+
body: string | Uint8Array;
|
|
50
|
+
/** Maximum allowed clock skew, in seconds, in either direction. Defaults to 300. */
|
|
51
|
+
toleranceSec?: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Verify a Standard Webhooks delivery. Never throws on malformed input; returns a typed failure instead.
|
|
55
|
+
* Signatures are compared in constant time, and any `v1,` signature matching any secret is accepted.
|
|
56
|
+
*
|
|
57
|
+
* @experimental SEP-3415 is a draft; this API may change.
|
|
58
|
+
*/
|
|
59
|
+
export declare function verifyWebhook({ secret, headers, body, toleranceSec, }: VerifyWebhookOptions): WebhookVerifyResult;
|
|
60
|
+
//# sourceMappingURL=webhook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../src/shared/events/webhook.ts"],"names":[],"mappings":"AAaA;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED,8DAA8D;AAC9D,MAAM,WAAW,kBAAkB;IACjC,0EAA0E;IAC1E,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;IACnC,8BAA8B;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;CAC3B;AAUD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,kBAAkB,GAAG,MAAM,CAavF;AAED,8DAA8D;AAC9D,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,GAAG,mBAAmB,GAAG,iBAAiB,GAAG,mBAAmB,CAAC;AAErH,8DAA8D;AAC9D,MAAM,MAAM,mBAAmB,GAC3B;IACE,EAAE,EAAE,IAAI,CAAC;IACT,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;CAChB,GACD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,oBAAoB,CAAA;CAAE,CAAC;AAEhD,8DAA8D;AAC9D,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;AAErF,8DAA8D;AAC9D,MAAM,WAAW,oBAAoB;IACnC,0GAA0G;IAC1G,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;IACnC,OAAO,EAAE,cAAc,CAAC;IACxB,oFAAoF;IACpF,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IAC1B,oFAAoF;IACpF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAcD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,OAAO,EACP,IAAI,EACJ,YAAoC,GACrC,EAAE,oBAAoB,GAAG,mBAAmB,CAyC5C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp",
|
|
3
|
-
"version": "2.5.0-alpha.
|
|
3
|
+
"version": "2.5.0-alpha.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -34,10 +34,11 @@
|
|
|
34
34
|
"fast-deep-equal": "^3.1.3"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@mastra/core": ">=1.
|
|
37
|
+
"@mastra/core": ">=1.79.0-0 <2.0.0-0",
|
|
38
|
+
"zod": "^4.2.0"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
|
-
"@ai-sdk/openai-v5": "npm:@ai-sdk/openai@2.0.
|
|
41
|
+
"@ai-sdk/openai-v5": "npm:@ai-sdk/openai@2.0.135",
|
|
41
42
|
"@copilotkit/aimock": "^1.29.0",
|
|
42
43
|
"@mendable/firecrawl-js": "^1.29.3",
|
|
43
44
|
"@modelcontextprotocol/conformance": "0.2.0-alpha.11",
|
|
@@ -53,13 +54,13 @@
|
|
|
53
54
|
"zod": "^4.6.7",
|
|
54
55
|
"zod-to-json-schema": "^3.25.1",
|
|
55
56
|
"@internal/ai-sdk-v5": "0.0.91",
|
|
57
|
+
"@internal/lint": "0.0.144",
|
|
56
58
|
"@internal/llm-recorder": "0.0.80",
|
|
57
|
-
"@internal/test-utils": "0.0.80",
|
|
58
59
|
"@internal/types-builder": "0.0.119",
|
|
59
|
-
"@internal/
|
|
60
|
-
"@mastra/
|
|
60
|
+
"@internal/test-utils": "0.0.80",
|
|
61
|
+
"@mastra/core": "1.79.0-alpha.12",
|
|
61
62
|
"@mastra/schema-compat": "1.3.16-alpha.0",
|
|
62
|
-
"@mastra/
|
|
63
|
+
"@mastra/observability": "1.21.0-alpha.2"
|
|
63
64
|
},
|
|
64
65
|
"homepage": "https://mastra.ai",
|
|
65
66
|
"repository": {
|