tmcp 1.20.0 → 1.20.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.
@@ -0,0 +1,6 @@
1
+ export class JsonSchemaAdapter<TSchema extends StandardSchemaV1> {
2
+ toJsonSchema(schema: TSchema): Promise<JSONSchema7>;
3
+ }
4
+ import type { StandardSchemaV1 } from "@standard-schema/spec";
5
+ import type { JSONSchema7 } from "json-schema";
6
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.js"],"names":[],"mappings":"AAUA,+BAFgC,OAAO,SAA1B,gBAAkB;IAO9B,qBAHW,OAAO,GACL,OAAO,CAAC,WAAW,CAAC,CAIhC;CACD;sCAfoC,uBAAuB;iCAC5B,aAAa"}
@@ -0,0 +1,405 @@
1
+ /**
2
+ * Check whether an error means that tmcp is waiting for client input.
3
+ *
4
+ * When there is no open connection to the client, `elicitation()` and
5
+ * `message()` ask the client to retry the original request with the answer.
6
+ * They stop the current handler by throwing a private error. A broad `catch`
7
+ * in the handler must rethrow that error, or tmcp cannot ask for the retry.
8
+ * Use this helper to distinguish it from errors your handler should process:
9
+ *
10
+ * ```js
11
+ * try {
12
+ * const answer = await server.elicitation(msg, schema);
13
+ * } catch (error) {
14
+ * if (isInputRequired(error)) throw error;
15
+ * // handle the real error
16
+ * }
17
+ * ```
18
+ */
19
+ export function isInputRequired(error: unknown): boolean;
20
+ /**
21
+ * Return the per-request protocol versions supported by tmcp.
22
+ */
23
+ export function getPerRequestProtocolVersions(): string[];
24
+ export class McpServer<StandardSchema extends StandardSchemaV1 | undefined = undefined, CustomContext extends Record<string, unknown> | undefined = undefined> {
25
+ constructor(server_info: ServerInfo, options: ServerOptions<StandardSchema>);
26
+ roots: Array<{
27
+ uri: string;
28
+ name?: string;
29
+ }>;
30
+ /**
31
+ * Utility method to specify the type of the custom context for this server instance without the need to specify the standard schema type.
32
+ * @example
33
+ * const server = new McpServer({ ... }, { ... }).withContext<{ name: string }>();
34
+ */
35
+ withContext<TCustom extends Record<string, unknown>>(): McpServer<StandardSchema, TCustom>;
36
+ /**
37
+ * The context of the current request, include the session ID, any auth information, and custom data.
38
+ */
39
+ get ctx(): Context<CustomContext>;
40
+ /**
41
+ * Get the client information (name, version, etc.) of the client that initiated the current request...useful if you want to do something different based on the client.
42
+ * @deprecated Use `server.ctx.sessionInfo.clientInfo` instead.
43
+ */
44
+ currentClientInfo(): {
45
+ icons?: {
46
+ src: string;
47
+ mimeType?: string | undefined;
48
+ sizes?: string[] | undefined;
49
+ }[] | undefined;
50
+ version: string;
51
+ websiteUrl?: string | undefined;
52
+ name: string;
53
+ title?: string | undefined;
54
+ } | undefined;
55
+ /**
56
+ * Get the client capabilities of the client that initiated the current request, you can use this to verify the client support something before invoking the respective method.
57
+ * @deprecated Use `server.ctx.sessionInfo.clientCapabilities` instead.
58
+ */
59
+ currentClientCapabilities(): ({
60
+ experimental?: ({} & {
61
+ [key: string]: unknown;
62
+ }) | undefined;
63
+ sampling?: ({} & {
64
+ [key: string]: unknown;
65
+ }) | undefined;
66
+ elicitation?: ({
67
+ form?: ({} & {
68
+ [key: string]: unknown;
69
+ }) | undefined;
70
+ url?: ({} & {
71
+ [key: string]: unknown;
72
+ }) | undefined;
73
+ } & {
74
+ [key: string]: unknown;
75
+ }) | undefined;
76
+ extensions?: {
77
+ [x: string]: {} & {
78
+ [key: string]: unknown;
79
+ };
80
+ } | undefined;
81
+ roots?: ({
82
+ listChanged?: boolean | undefined;
83
+ } & {
84
+ [key: string]: unknown;
85
+ }) | undefined;
86
+ } & {
87
+ [key: string]: unknown;
88
+ }) | undefined;
89
+ on<TEvent extends keyof McpEvents>(event: TEvent, callback: McpEvents[TEvent], options?: AddEventListenerOptions): () => void;
90
+ /**
91
+ * Use the `defineTool` utility to create a reusable tool and pass it to this method to add it to the server.
92
+ */
93
+ tools<T extends Array<CreatedTool<any, any>>, U extends T extends Array<CreatedTool<infer TSchema, infer TOutputSchema>> ? AllSame<TSchema, StandardSchema | undefined> extends true ? AllSame<TOutputSchema, StandardSchema | undefined> extends true ? T : never : never : never>(tools: T & NoInfer<U>): void;
94
+ /**
95
+ * Use the `definePrompt` utility to create a reusable tool and pass it to this method to add it to the server.
96
+ */
97
+ prompts<T extends Array<CreatedPrompt<any>>, U extends T extends Array<CreatedPrompt<infer TSchema>> ? AllSame<TSchema, StandardSchema | undefined> extends true ? T : never : never>(prompts: T & NoInfer<U>): void;
98
+ /**
99
+ * Use the `defineResource` utility to create a reusable resource and pass it to this method to add it to the server.
100
+ */
101
+ resources(resources: CreatedResource[]): void;
102
+ /**
103
+ * Use the `defineTemplate` utility to create a reusable template and pass it to this method to add it to the server.
104
+ */
105
+ templates(templates: CreatedTemplate<any>[]): void;
106
+ /**
107
+ * Add a tool to the server. If you want to receive any input you need to provide a schema. The schema needs to be a valid Standard Schema V1 schema and needs to be an Object with the properties you need,
108
+ * Use the description and title to help the LLM to understand what the tool does and when to use it. If you provide an outputSchema, you need to return a structuredContent that matches the schema.
109
+ *
110
+ * Tools will be invoked by the LLM when it thinks it needs to use them, you can use the annotations to provide additional information about the tool, like what it does, how to use it, etc.
111
+ */
112
+ tool<TSchema extends StandardSchema | undefined = undefined, TOutputSchema extends StandardSchema | undefined = undefined>(tool_or_options: CreatedTool<TSchema, TOutputSchema>): void;
113
+ /**
114
+ * Add a tool to the server. If you want to receive any input you need to provide a schema. The schema needs to be a valid Standard Schema V1 schema and needs to be an Object with the properties you need,
115
+ * Use the description and title to help the LLM to understand what the tool does and when to use it. If you provide an outputSchema, you need to return a structuredContent that matches the schema.
116
+ *
117
+ * Tools will be invoked by the LLM when it thinks it needs to use them, you can use the annotations to provide additional information about the tool, like what it does, how to use it, etc.
118
+ */
119
+ tool<TSchema extends StandardSchema | undefined = undefined, TOutputSchema extends StandardSchema | undefined = undefined>(tool_or_options: ToolOptions<TSchema, TOutputSchema>, execute: TSchema extends undefined ? (() => Promise<CallToolResult<TOutputSchema extends undefined ? undefined : StandardSchemaV1.InferInput<TOutputSchema extends undefined ? never : TOutputSchema>>> | CallToolResult<TOutputSchema extends undefined ? undefined : StandardSchemaV1.InferInput<TOutputSchema extends undefined ? never : TOutputSchema>>) : ((input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<CallToolResult<TOutputSchema extends undefined ? undefined : StandardSchemaV1.InferInput<TOutputSchema extends undefined ? never : TOutputSchema>>> | CallToolResult<TOutputSchema extends undefined ? undefined : StandardSchemaV1.InferInput<TOutputSchema extends undefined ? never : TOutputSchema>>)): void;
120
+ /**
121
+ * Run transport-specific validation against a registered tool's JSON
122
+ * Schema without enabling, validating, or executing the tool.
123
+ */
124
+ validateToolCall(name: string, args: Record<string, unknown>, validator: (input_schema: Record<string, unknown>, args: Record<string, unknown>) => void | Promise<void>): Promise<boolean>;
125
+ /**
126
+ * Add a prompt to the server. Prompts are used to provide the user with pre-defined messages that adds context to the LLM.
127
+ * Use the description and title to help the user to understand what the prompt does and when to use it.
128
+ *
129
+ * A prompt can also have a schema that defines the input it expects, the user will be prompted to enter the inputs you request. It can also have a complete function
130
+ * for each input that will be used to provide completions for the user.
131
+ */
132
+ prompt<TSchema extends StandardSchema | undefined = undefined>(prompt_or_options: CreatedPrompt<TSchema>): void;
133
+ /**
134
+ * Add a prompt to the server. Prompts are used to provide the user with pre-defined messages that adds context to the LLM.
135
+ * Use the description and title to help the user to understand what the prompt does and when to use it.
136
+ *
137
+ * A prompt can also have a schema that defines the input it expects, the user will be prompted to enter the inputs you request. It can also have a complete function
138
+ * for each input that will be used to provide completions for the user.
139
+ */
140
+ prompt<TSchema extends StandardSchema | undefined = undefined>(prompt_or_options: PromptOptions<TSchema>, execute: TSchema extends undefined ? (() => Promise<GetPromptResult> | GetPromptResult) : (input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<GetPromptResult> | GetPromptResult): void;
141
+ /**
142
+ * Add a resource to the server. Resources are added manually to the context by the user to provide the LLM with additional context.
143
+ * Use the description and title to help the user to understand what the resource is.
144
+ */
145
+ resource(resource_or_options: CreatedResource): void;
146
+ /**
147
+ * Add a resource to the server. Resources are added manually to the context by the user to provide the LLM with additional context.
148
+ * Use the description and title to help the user to understand what the resource is.
149
+ */
150
+ resource(resource_or_options: ResourceOptions, execute: (uri: string) => Promise<ReadResourceResult> | ReadResourceResult): void;
151
+ /**
152
+ * Add a resource template to the server. Resources are added manually to the context by the user to provide the LLM with additional context.
153
+ * Resource templates are used to create resources dynamically based on a URI template. The URI template should be a valid URI template as defined in RFC 6570.
154
+ * Resource templates can have a list method that returns a list of resources that match the template and a complete method that returns a list of resources given one of the template variables, this method will
155
+ * be invoked to provide completions for the template variables to the user.
156
+ * Use the description and title to help the user to understand what the resource is.
157
+ */
158
+ template<TUri extends string, TVariables extends ExtractURITemplateVariables<TUri>>(template_or_options: CreatedTemplate<TUri>): void;
159
+ /**
160
+ * Add a resource template to the server. Resources are added manually to the context by the user to provide the LLM with additional context.
161
+ * Resource templates are used to create resources dynamically based on a URI template. The URI template should be a valid URI template as defined in RFC 6570.
162
+ * Resource templates can have a list method that returns a list of resources that match the template and a complete method that returns a list of resources given one of the template variables, this method will
163
+ * be invoked to provide completions for the template variables to the user.
164
+ * Use the description and title to help the user to understand what the resource is.
165
+ */
166
+ template<TUri extends string, TVariables extends ExtractURITemplateVariables<TUri>>(template_or_options: TemplateOptions<TUri>, execute: (uri: string, params: Record<TVariables, string | string[]>) => Promise<ReadResourceResult> | ReadResourceResult): void;
167
+ /**
168
+ * Check whether a JSON-RPC method is registered without invoking it.
169
+ */
170
+ hasMethod(method: string): boolean;
171
+ /**
172
+ * The main function that receive a JSONRpc message and either dispatch a `send` event or process the request.
173
+ */
174
+ receive(message: JSONRPCMessage, ctx?: ReceiveContext<CustomContext>): any;
175
+ /**
176
+ * Lower level api to send a request to the client, mostly useful to call client methods that not yet supported by the server or
177
+ * if you want to send requests with json schema that is not expressible with your validation library.
178
+ */
179
+ request({ method, params }: {
180
+ method: string;
181
+ params?: JSONRPCParams;
182
+ }): Promise<unknown>;
183
+ /**
184
+ * Send a notification for subscriptions
185
+ */
186
+ changed<TWhat extends keyof ChangedArgs>(what: TWhat, ...args: ChangedArgs[TWhat]): void;
187
+ /**
188
+ * Refresh the roots list when the server has an open client session.
189
+ *
190
+ * This throws when handling a standalone request because roots are no
191
+ * longer supported by protocol version `2026-07-28`.
192
+ */
193
+ refreshRoots(): Promise<void>;
194
+ /**
195
+ * Save data that the handler will need when the client retries this
196
+ * request. tmcp turns it into text, sends it to the client, and restores it
197
+ * as `server.ctx.requestState` on the retry.
198
+ * Passing `undefined` clears previously set state.
199
+ *
200
+ * This does nothing when the server has an open client session or when the
201
+ * request finishes without asking for input.
202
+ *
203
+ * SECURITY: the default JSON converter lets the client read and change this
204
+ * data. Do not put secrets in it or use it for authorization. Configure a
205
+ * protected `requestStateCodec` if the server must detect changes.
206
+ */
207
+ setRequestState(state: unknown): void;
208
+ /**
209
+ * Ask the user to complete an interaction at a URL. The client will open
210
+ * the URL out of band and return the user's action without form content.
211
+ *
212
+ * @param [options] `key` names this question so tmcp can match its answer on a retry.
213
+ */
214
+ elicitation(message: string, url: string, options?: {
215
+ key?: string;
216
+ } | undefined): Promise<Omit<ElicitResult, "content">>;
217
+ /**
218
+ * Emit an elicitation request to the client. Elicitations are used to ask the user for input in a structured way, the client will show a UI to the user to fill the input.
219
+ * The schema should be a valid Standard Schema V1 schema and should be an Object with the properties you need.
220
+ * The client will return the validated input as a JSON object that matches the schema.
221
+ *
222
+ * If the client doesn't support elicitation, it will throw an error.
223
+ *
224
+ * When there is no open client session, tmcp returns the question to the
225
+ * client and asks it to retry the original request with the answer. The
226
+ * handler then starts again from the beginning, so its definition must set
227
+ * `replayable: true`. Always await this call. If a surrounding `catch`
228
+ * handles errors, use `isInputRequired()` and rethrow tmcp's private error.
229
+ *
230
+ * @param [options] `key` names this question so tmcp can match its answer on a retry. By default tmcp uses `"1"`, `"2"`, and so on. Set a name when the handler may ask different questions on different runs. When mixing named and numbered questions, use non-numeric names.
231
+ */
232
+ elicitation<TSchema extends StandardSchema extends undefined ? never : StandardSchema>(message: string, schema: TSchema, options?: {
233
+ key?: string;
234
+ } | undefined): Promise<ElicitResult & {
235
+ content?: StandardSchemaV1.InferOutput<TSchema>;
236
+ }>;
237
+ /**
238
+ * Request language model sampling from the client.
239
+ *
240
+ * When there is no open client session, tmcp returns the sampling request
241
+ * to the client and asks it to retry the original request with the answer.
242
+ * The handler then starts again from the beginning, so its definition must
243
+ * set `replayable: true`. Always await this call. If a surrounding `catch`
244
+ * handles errors, use `isInputRequired()` and rethrow tmcp's private error.
245
+ * @param [options] `key` names this request so tmcp can match its answer on a retry. By default tmcp uses `"1"`, `"2"`, and so on. Set a name when the handler may make different requests on different runs. When mixing named and numbered requests, use non-numeric names.
246
+ */
247
+ message(request: CreateMessageRequestParams, options?: {
248
+ key?: string;
249
+ }): Promise<CreateMessageResult>;
250
+ /**
251
+ * Send a progress notification to the client. This is useful for long-running operations where you want to inform the user about the progress.
252
+ *
253
+ * @param progress The current progress value, it should be between 0 and total and should always increase
254
+ * @param [total] The total value, defaults to 1
255
+ * @param [message] An optional message to accompany the progress update
256
+ */
257
+ progress(progress: number, total?: number, message?: string): void;
258
+ /**
259
+ * Log a message to the client if logging is enabled and the level is appropriate
260
+ */
261
+ log(level: LoggingLevel, data: unknown, logger?: string): void;
262
+ #private;
263
+ }
264
+ /**
265
+ * Information about a validated access token, provided to request handlers.
266
+ */
267
+ export type AuthInfo = {
268
+ /**
269
+ * - The access token.
270
+ */
271
+ token: string;
272
+ /**
273
+ * - The client ID associated with this token.
274
+ */
275
+ clientId: string;
276
+ /**
277
+ * - Scopes associated with this token.
278
+ */
279
+ scopes: string[];
280
+ /**
281
+ * - When the token expires (in seconds since epoch).
282
+ */
283
+ expiresAt?: number | undefined;
284
+ /**
285
+ * - The RFC 8707 resource server identifier for which this token is valid.
286
+ * If set, this MUST match the MCP server's resource identifier (minus hash fragment).
287
+ */
288
+ resource?: URL | undefined;
289
+ /**
290
+ * - Additional data associated with the token.
291
+ * This field should be used for any additional data that needs to be attached to the auth info.
292
+ */
293
+ extra?: Record<string, unknown> | undefined;
294
+ };
295
+ export type Context<TCustom extends Record<string, unknown> | undefined = undefined> = {
296
+ sessionId?: string | undefined;
297
+ sessionInfo?: {
298
+ clientCapabilities?: ClientCapabilitiesType;
299
+ clientInfo?: ClientInfoType;
300
+ logLevel?: LoggingLevel;
301
+ } | undefined;
302
+ /**
303
+ * The exact per-request protocol version when the current request carries per-request protocol metadata; `undefined` for session-negotiated requests.
304
+ */
305
+ protocolVersion?: string | undefined;
306
+ /**
307
+ * Data saved by the handler before asking the client for input, then returned by the client on the retry. It is `undefined` when no data was saved or when the request uses an open session. The default JSON converter lets the client read and change this value. Do not store secrets in it or use it to make authorization decisions. Configure `requestStateCodec` if the server must detect changes.
308
+ */
309
+ requestState?: unknown;
310
+ /**
311
+ * Aborted when the transport observes that the current request was cancelled.
312
+ */
313
+ signal?: AbortSignal | undefined;
314
+ auth?: AuthInfo | undefined;
315
+ custom?: TCustom | undefined;
316
+ };
317
+ /**
318
+ * Context accepted by `receive()`. Subscription routing fields are
319
+ * transport-only and are deliberately omitted from `server.ctx`.
320
+ */
321
+ export type ReceiveContext<TCustom extends Record<string, unknown> | undefined = undefined> = Context<TCustom> & {
322
+ subscriptionOrigin?: SubscriptionOriginType;
323
+ subscriptionManager?: SubscriptionManagerType;
324
+ };
325
+ export type McpEvents = McpEventsType;
326
+ /**
327
+ * The arguments of `McpServer.changed` for each kind of change.
328
+ */
329
+ export type ChangedArgs = {
330
+ resource: [id: string];
331
+ tools: [];
332
+ prompts: [];
333
+ resources: [];
334
+ };
335
+ export type SubscriptionFilter = SubscriptionFilterType;
336
+ export type SubscriptionOrigin = SubscriptionOriginType;
337
+ export type Subscription = SubscriptionType;
338
+ export type SubscriptionCallbacks = SubscriptionCallbacksType;
339
+ export type SubscriptionManager = SubscriptionManagerType;
340
+ export type SubscriptionsListenRequest = SubscriptionsListenRequestType;
341
+ export type SubscriptionsListenResult = SubscriptionsListenResultType;
342
+ export type SubscriptionsAcknowledgedNotification = SubscriptionsAcknowledgedNotificationType;
343
+ export type Icons = IconsType;
344
+ export type Subscriptions = Record<SubscriptionsKeys, string[]>;
345
+ export type CallToolResult<TStructuredContent> = CallToolResultType<TStructuredContent>;
346
+ export type ReadResourceResult = ReadResourceResultType;
347
+ export type GetPromptResult = GetPromptResultType;
348
+ export type ClientCapabilities = ClientCapabilitiesType;
349
+ export type ServerInfo = ServerInfoType;
350
+ export type CreateMessageRequestParams = CreateMessageRequestParamsType;
351
+ export type CreateMessageResult = CreateMessageResultType;
352
+ export type Resource = ResourceType;
353
+ export type LoggingLevel = LoggingLevelType;
354
+ export type ClientInfo = ClientInfoType;
355
+ export type ElicitResult = ElicitResultType;
356
+ export type InitializeResult = InitializeResultType;
357
+ export type ListToolsResult = ListToolsResultType;
358
+ export type ListPromptsResult = ListPromptsResultType;
359
+ export type ListResourceTemplatesResult = ListResourceTemplatesResultType;
360
+ export type ListResourcesResult = ListResourcesResultType;
361
+ export type CompleteResult = CompleteResultType;
362
+ import type { StandardSchemaV1 } from "@standard-schema/spec";
363
+ import type { CreatedTool } from "./tool.js";
364
+ import type { AllSame } from "./internal/internal.js";
365
+ import type { CreatedPrompt } from "./prompt.js";
366
+ import type { CreatedResource } from "./resource.js";
367
+ import type { CreatedTemplate } from "./template.js";
368
+ import type { ToolOptions } from "./internal/internal.js";
369
+ import type { PromptOptions } from "./internal/internal.js";
370
+ import type { ResourceOptions } from "./internal/internal.js";
371
+ import type { ExtractURITemplateVariables } from "./internal/uri-template.js";
372
+ import type { TemplateOptions } from "./internal/internal.js";
373
+ import type { JSONRPCMessage } from "./validation/index.js";
374
+ import type { JSONRPCParams } from "json-rpc-2.0";
375
+ import type { ServerOptions } from "./internal/internal.js";
376
+ import type { ClientCapabilities as ClientCapabilitiesType } from "./validation/index.js";
377
+ import type { ClientInfo as ClientInfoType } from "./validation/index.js";
378
+ import type { SubscriptionOrigin as SubscriptionOriginType } from "./internal/internal.js";
379
+ import type { SubscriptionManager as SubscriptionManagerType } from "./internal/internal.js";
380
+ import type { McpEvents as McpEventsType } from "./internal/internal.js";
381
+ import type { SubscriptionFilter as SubscriptionFilterType } from "./validation/index.js";
382
+ import type { Subscription as SubscriptionType } from "./internal/internal.js";
383
+ import type { SubscriptionCallbacks as SubscriptionCallbacksType } from "./internal/internal.js";
384
+ import type { SubscriptionsListenRequest as SubscriptionsListenRequestType } from "./validation/index.js";
385
+ import type { SubscriptionsListenResult as SubscriptionsListenResultType } from "./validation/index.js";
386
+ import type { SubscriptionsAcknowledgedNotification as SubscriptionsAcknowledgedNotificationType } from "./validation/index.js";
387
+ import type { Icons as IconsType } from "./validation/index.js";
388
+ import type { SubscriptionsKeys } from "./internal/internal.js";
389
+ import type { CallToolResult as CallToolResultType } from "./validation/index.js";
390
+ import type { ReadResourceResult as ReadResourceResultType } from "./validation/index.js";
391
+ import type { GetPromptResult as GetPromptResultType } from "./validation/index.js";
392
+ import type { ServerInfo as ServerInfoType } from "./validation/index.js";
393
+ import type { CreateMessageRequestParams as CreateMessageRequestParamsType } from "./validation/index.js";
394
+ import type { CreateMessageResult as CreateMessageResultType } from "./validation/index.js";
395
+ import type { Resource as ResourceType } from "./validation/index.js";
396
+ import type { LoggingLevel as LoggingLevelType } from "./validation/index.js";
397
+ import type { ElicitResult as ElicitResultType } from "./validation/index.js";
398
+ import type { InitializeResult as InitializeResultType } from "./validation/index.js";
399
+ import type { ListToolsResult as ListToolsResultType } from "./validation/index.js";
400
+ import type { ListPromptsResult as ListPromptsResultType } from "./validation/index.js";
401
+ import type { ListResourceTemplatesResult as ListResourceTemplatesResultType } from "./validation/index.js";
402
+ import type { ListResourcesResult as ListResourcesResultType } from "./validation/index.js";
403
+ import type { CompleteResult as CompleteResultType } from "./validation/index.js";
404
+ export { McpError, HEADER_MISMATCH, MISSING_REQUIRED_CLIENT_CAPABILITY, UNSUPPORTED_PROTOCOL_VERSION } from "./validation/index.js";
405
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAmHA,uCAHW,OAAO,GACL,OAAO,CAInB;;;;AAMD,iDAFa,MAAM,EAAE,CAIpB;AAwKD,uBAH6C,cAAc,SAA7C,gBAAgB,GAAG,SAAU,cACS,aAAa,SAAnD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAU;IAwDjD,yBAHW,UAAU,WACV,cAAc,cAAc,CAAC,EAoIvC;IA3JD,OAFU,KAAK,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC,CAElC;;;;;;IAoKX,YAHuC,OAAO,SAAhC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAE,KACzB,SAAS,CAAC,cAAc,EAAE,OAAO,CAAC,CAM9C;;;;IAUD,WAFU,OAAO,CAAC,aAAa,CAAC,CAkB/B;;;;;IAUD;;;;;;;;;;kBAEC;;;;;IAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAEC;IAwBD,GAL+B,MAAM,SAAxB,MAAO,SAAU,SACnB,MAAM,YACN,SAAS,CAAC,MAAM,CAAC,YACjB,uBAAuB,cAmBjC;;;;IA4qBD,MAJ4C,CAAC,SAA/B,KAAK,CAAC,YAAY,GAAG,EAAE,GAAG,CAAC,CAAE,EAC+L,CAAC,SAA7N,CAAC,SAAS,KAAK,CAAC,YAAY,MAAM,OAAO,EAAE,MAAM,aAAa,CAAC,CAAC,GAAG,QAAQ,OAAO,EAAE,cAAc,GAAG,SAAS,CAAC,SAAS,IAAI,GAAG,QAAQ,aAAa,EAAE,cAAc,GAAG,SAAS,CAAC,SAAS,IAAI,GAAG,CAAC,GAAG,KAAK,GAAG,KAAK,GAAG,K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AwB;wEAAxB,wBAAwB;kFAD4uB,uBAAuB;gFAAvB,uBAAuB;wGAAvB,uBAAuB;wCAAvB,uBAAuB;uCAC3xB,wBAAwB;0DAD4uB,uBAAuB;kEAAvB,uBAAuB;4DAAvB,uBAAuB;kDAAvB,uBAAuB;kFAAvB,uBAAuB;oEAAvB,uBAAuB;8CAAvB,uBAAuB;sDAAvB,uBAAuB;sDAAvB,uBAAuB;8DAAvB,uBAAuB;4DAAvB,uBAAuB;gEAAvB,uBAAuB;oFAAvB,uBAAuB;oEAAvB,uBAAuB;0DAAvB,uBAAuB"}
@@ -18,11 +18,16 @@ import {
18
18
  DiscoverRequestParams,
19
19
  } from '../validation/index.js';
20
20
  import { ExtractURITemplateVariables } from './uri-template.js';
21
+ import type { ChangedArgs } from '../index.js';
21
22
 
22
- declare const created_tool: unique symbol;
23
- declare const created_prompt: unique symbol;
24
- declare const created_resource: unique symbol;
25
- declare const created_template: unique symbol;
23
+ // Global, as they were with the previous bundled declarations: the
24
+ // declarations of already published libraries reference them by name.
25
+ declare global {
26
+ const created_tool: unique symbol;
27
+ const created_prompt: unique symbol;
28
+ const created_resource: unique symbol;
29
+ const created_template: unique symbol;
30
+ }
26
31
 
27
32
  export type AllSame<T, U> = [T] extends [U] ? true : false;
28
33
 
@@ -158,8 +163,7 @@ export type ResourceOptions = {
158
163
 
159
164
  export type TemplateOptions<
160
165
  TUri extends string = string,
161
- TVariables extends ExtractURITemplateVariables<TUri> =
162
- ExtractURITemplateVariables<TUri>,
166
+ TVariables extends string = ExtractURITemplateVariables<TUri>,
163
167
  > = {
164
168
  name: string;
165
169
  description: string;
@@ -176,26 +180,13 @@ export type TemplateOptions<
176
180
  } & Icons &
177
181
  Replayable;
178
182
 
179
- export type CreatedTool<
180
- TSchema extends StandardSchemaV1 | undefined = undefined,
181
- TOutputSchema extends StandardSchemaV1 | undefined = undefined,
182
- > = ToolOptions<TSchema, TOutputSchema> & { [created_tool]: created_tool };
183
- export type CreatedPrompt<
184
- TSchema extends StandardSchemaV1 | undefined = undefined,
185
- > = PromptOptions<TSchema> & { [created_prompt]: created_prompt };
186
- export type CreatedResource = ResourceOptions & {
187
- [created_resource]: created_resource;
188
- };
189
- export type CreatedTemplate<TUri extends string = string> =
190
- TemplateOptions<TUri> & { [created_template]: created_template };
191
-
192
183
  export type Tool<
193
184
  TSchema extends StandardSchemaV1 = StandardSchemaV1<any>,
194
185
  TOutputSchema extends StandardSchemaV1 = StandardSchemaV1<any>,
195
186
  > = ToolOptions<TSchema, TOutputSchema> & {
196
187
  execute: (
197
188
  input?: StandardSchemaV1.InferInput<TSchema>,
198
- ) => Promise<CallToolResult> | CallToolResult;
189
+ ) => Promise<CallToolResult<any>> | CallToolResult<any>;
199
190
  };
200
191
 
201
192
  export type Completion = (
@@ -242,7 +233,7 @@ export type CachePolicy = {
242
233
  export type ServerOptions<TSchema extends StandardSchemaV1 | undefined> = {
243
234
  capabilities?: ServerCapabilities;
244
235
  instructions?: string;
245
- adapter: JsonSchemaAdapter<TSchema> | undefined;
236
+ adapter: JsonSchemaAdapter<NonNullable<TSchema>> | undefined;
246
237
  pagination?: {
247
238
  tools?: { size?: number };
248
239
  resources?: { size?: number };
@@ -284,12 +275,6 @@ export type ServerOptions<TSchema extends StandardSchemaV1 | undefined> = {
284
275
  };
285
276
  };
286
277
 
287
- export type ChangedArgs = {
288
- resource: [id: string];
289
- tools: [];
290
- prompts: [];
291
- resources: [];
292
- };
293
278
 
294
279
  type SubscriptionsKeysObj = {
295
280
  [K in keyof ChangedArgs as ChangedArgs[K]['length'] extends 0
@@ -0,0 +1,3 @@
1
+ export function event<Key extends keyof McpEvents>(type: Key, detail: Parameters<McpEvents[Key]>[0]): CustomEvent<Parameters<McpEvents[Key]>[0]>;
2
+ import type { McpEvents } from "./internal.js";
3
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/internal/utils.js"],"names":[],"mappings":"AASA,sBAL+B,GAAG,SAArB,MAAO,SAAU,QACnB,GAAG,UACH,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,8CAKvC;+BAV2B,eAAe"}
@@ -0,0 +1,2 @@
1
+ export { is_per_request_method_allowed as isPerRequestMethodAllowed } from "./validation/method-policy.js";
2
+ //# sourceMappingURL=method-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"method-policy.d.ts","sourceRoot":"","sources":["../src/method-policy.js"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Add a tool to the server. If you want to receive any input you need to provide a schema. The schema needs to be a valid Standard Schema V1 schema and needs to be an Object with the properties you need,
3
+ * Use the description and title to help the LLM to understand what the tool does and when to use it. If you provide an outputSchema, you need to return a structuredContent that matches the schema.
4
+ */
5
+ export function definePrompt<TSchema extends StandardSchemaV1 | undefined = undefined>(options: PromptOptions<TSchema>, execute: TSchema extends undefined ? (() => Promise<GetPromptResult> | GetPromptResult) : (input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<GetPromptResult> | GetPromptResult): CreatedPrompt<TSchema>;
6
+ /**
7
+ * A prompt created with `definePrompt`.
8
+ */
9
+ export type CreatedPrompt<TSchema extends StandardSchemaV1 | undefined = undefined> = PromptOptions<TSchema> & {
10
+ [created_prompt]: typeof created_prompt;
11
+ };
12
+ import type { StandardSchemaV1 } from "@standard-schema/spec";
13
+ import type { PromptOptions } from "./internal/internal.js";
14
+ import type { GetPromptResult } from "./validation/index.js";
15
+ //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../src/prompt.js"],"names":[],"mappings":";;;;AAoBA,6BAJ6C,OAAO,SAAtC,gBAAgB,GAAG,SAAU,uBAChC,cAAc,OAAO,CAAC,WACtB,OAAO,SAAS,SAAS,GAAG,CAAC,MAAI,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC,GAAG,CAAC,KAAK,EAAE,4BAA4B,OAAO,SAAS,SAAS,GAAG,KAAK,GAAG,OAAO,CAAC,KAAK,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,GAItM,aAAa,CAAC,OAAO,CAAC,CAMxC;;;;0BApB4C,OAAO,SAAtC,gBAAgB,GAAG,SAAU,gBAC9B,cAAc,OAAO,CAAC,GAAG;IAAE,CAAC,cAAc,CAAC,EAAE,OAAO,cAAc,CAAA;CAAE;sCAR5C,uBAAuB;mCAC1B,wBAAwB;qCACtB,uBAAuB"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Add a resource to the server. Resources are added manually to the context by the user to provide the LLM with additional context.
3
+ * Use the description and title to help the user to understand what the resource is. The mimeType can be used to indicate the type of content.
4
+ */
5
+ export function defineResource(options: ResourceOptions, execute: (uri: string) => Promise<ReadResourceResult> | ReadResourceResult): CreatedResource;
6
+ /**
7
+ * A resource created with `defineResource`.
8
+ */
9
+ export type CreatedResource = ResourceOptions & {
10
+ [created_resource]: typeof created_resource;
11
+ };
12
+ import type { ResourceOptions } from "./internal/internal.js";
13
+ import type { ReadResourceResult } from "./validation/index.js";
14
+ //# sourceMappingURL=resource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.js"],"names":[],"mappings":";;;;AAiBA,wCAHW,eAAe,WACf,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,GAGzD,eAAe,CAMjC;;;;8BAjBY,eAAe,GAAG;IAAE,CAAC,gBAAgB,CAAC,EAAE,OAAO,gBAAgB,CAAA;CAAE;qCAN1C,wBAAwB;wCACrB,uBAAuB"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Add a resource template to the server. Resources are added manually to the context by the user to provide the LLM with additional context.
3
+ * Resource templates are used to create resources dynamically based on a URI template. The URI template should be a valid URI template as defined in RFC 6570.
4
+ * Resource templates can have a list method that returns a list of resources that match the template and a complete method that returns a list of resources given one of the template variables, this method will
5
+ * be invoked to provide completions for the template variables to the user.
6
+ * Use the description and title to help the user to understand what the resource is. The mimeType can be used to indicate the type of content.
7
+ */
8
+ export function defineTemplate<TUri extends string, TVariables extends ExtractURITemplateVariables<TUri>>(options: TemplateOptions<TUri>, execute: (uri: string, params: Record<TVariables, string | string[]>) => Promise<ReadResourceResult> | ReadResourceResult): CreatedTemplate<TUri>;
9
+ /**
10
+ * A resource template created with `defineTemplate`.
11
+ */
12
+ export type CreatedTemplate<TUri extends string = string> = TemplateOptions<TUri> & {
13
+ [created_template]: typeof created_template;
14
+ };
15
+ import type { ExtractURITemplateVariables } from "./internal/uri-template.js";
16
+ import type { TemplateOptions } from "./internal/internal.js";
17
+ import type { ReadResourceResult } from "./validation/index.js";
18
+ //# sourceMappingURL=template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../src/template.js"],"names":[],"mappings":";;;;;;;AAyBA,+BALsB,IAAI,SAAb,MAAQ,EAC4B,UAAU,SAA9C,4BAA6B,IAAI,CAAE,WACrC,gBAAgB,IAAI,CAAC,WACrB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,GAGxG,eAAe,CAAC,IAAI,CAAC,CAMvC;;;;4BAvBsB,IAAI,SAAd,MAAQ,aACR,gBAAgB,IAAI,CAAC,GAAG;IAAE,CAAC,gBAAgB,CAAC,EAAE,OAAO,gBAAgB,CAAA;CAAE;iDARpC,4BAA4B;qCACxC,wBAAwB;wCACrB,uBAAuB"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Add a tool to the server. If you want to receive any input you need to provide a schema. The schema needs to be a valid Standard Schema V1 schema and needs to be an Object with the properties you need,
3
+ * Use the description and title to help the LLM to understand what the tool does and when to use it. If you provide an outputSchema, you need to return a structuredContent that matches the schema.
4
+ */
5
+ export function defineTool<TSchema extends StandardSchemaV1 | undefined = undefined, TOutputSchema extends StandardSchemaV1 | undefined = undefined>(options: ToolOptions<TSchema, TOutputSchema>, execute: TSchema extends undefined ? (() => Promise<import("./index.js").CallToolResult<TOutputSchema extends undefined ? undefined : StandardSchemaV1.InferInput<TOutputSchema extends undefined ? never : TOutputSchema>>> | import("./index.js").CallToolResult<TOutputSchema extends undefined ? undefined : StandardSchemaV1.InferInput<TOutputSchema extends undefined ? never : TOutputSchema>>) : ((input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<import("./index.js").CallToolResult<TOutputSchema extends undefined ? undefined : StandardSchemaV1.InferInput<TOutputSchema extends undefined ? never : TOutputSchema>>> | import("./index.js").CallToolResult<TOutputSchema extends undefined ? undefined : StandardSchemaV1.InferInput<TOutputSchema extends undefined ? never : TOutputSchema>>)): CreatedTool<TSchema, TOutputSchema>;
6
+ /**
7
+ * A tool created with `defineTool`.
8
+ */
9
+ export type CreatedTool<TSchema extends StandardSchemaV1 | undefined = undefined, TOutputSchema extends StandardSchemaV1 | undefined = undefined> = ToolOptions<TSchema, TOutputSchema> & {
10
+ [created_tool]: typeof created_tool;
11
+ };
12
+ import type { StandardSchemaV1 } from "@standard-schema/spec";
13
+ import type { ToolOptions } from "./internal/internal.js";
14
+ //# sourceMappingURL=tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../src/tool.js"],"names":[],"mappings":";;;;AAqBA,2BAL6C,OAAO,SAAtC,gBAAgB,GAAG,SAAU,cACE,aAAa,SAA5C,gBAAgB,GAAG,SAAU,uBAChC,YAAY,OAAO,EAAE,aAAa,CAAC,WACnC,OAAO,SAAS,SAAS,GAAG,CAAC,MAAI,OAAO,CAAC,OAAO,YAAY,EAAE,cAAc,CAAC,aAAa,SAAS,SAAS,GAAG,SAAS,GAAG,4BAA4B,aAAa,SAAS,S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