forked from modelcontextprotocol/modelcontextprotocol
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.ts
More file actions
3088 lines (2863 loc) · 90.1 KB
/
schema.ts
File metadata and controls
3088 lines (2863 loc) · 90.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* JSON types */
/**
* @category Common Types
*/
export type JSONValue =
| string
| number
| boolean
| null
| JSONObject
| JSONArray;
/**
* @category Common Types
*/
export type JSONObject = { [key: string]: JSONValue };
/**
* @category Common Types
*/
export type JSONArray = JSONValue[];
/* JSON-RPC types */
/**
* Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent.
*
* @category JSON-RPC
*/
export type JSONRPCMessage =
| JSONRPCRequest
| JSONRPCNotification
| JSONRPCResponse;
/** @internal */
export const LATEST_PROTOCOL_VERSION = "2026-07-28";
/** @internal */
export const JSONRPC_VERSION = "2.0";
/**
* Represents the contents of a `_meta` field, which clients and servers use to attach additional metadata to their interactions.
*
* Certain key names are reserved by MCP for protocol-level metadata; implementations MUST NOT make assumptions about values at these keys. Additionally, specific schema definitions may reserve particular names for purpose-specific metadata, as declared in those definitions.
*
* Valid keys have two segments:
*
* **Prefix:**
* - Optional — if specified, MUST be a series of _labels_ separated by dots (`.`), followed by a slash (`/`).
* - Labels MUST start with a letter and end with a letter or digit. Interior characters may be letters, digits, or hyphens (`-`).
* - Implementations SHOULD use reverse DNS notation (e.g., `com.example/` rather than `example.com/`).
* - Any prefix where the second label is `modelcontextprotocol` or `mcp` is **reserved** for MCP use. For example: `io.modelcontextprotocol/`, `dev.mcp/`, `org.modelcontextprotocol.api/`, and `com.mcp.tools/` are all reserved. However, `com.example.mcp/` is NOT reserved, as the second label is `example`.
*
* **Name:**
* - Unless empty, MUST start and end with an alphanumeric character (`[a-z0-9A-Z]`).
* - Interior characters may be alphanumeric, hyphens (`-`), underscores (`_`), or dots (`.`).
*
* @see [General fields: `_meta`](/specification/draft/basic/index#meta) for more details.
* @category Common Types
*/
export type MetaObject = Record<string, unknown>;
/**
* Extends {@link MetaObject} with additional request-specific fields. All key naming rules from `MetaObject` apply.
*
* @see {@link MetaObject} for key naming rules and reserved prefixes.
* @see [General fields: `_meta`](/specification/draft/basic/index#meta) for more details.
* @category Common Types
*/
export interface RequestMetaObject extends MetaObject {
/**
* If specified, the caller is requesting out-of-band progress notifications for this request (as represented by {@link ProgressNotification | notifications/progress}). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
*/
progressToken?: ProgressToken;
/**
* The MCP Protocol Version being used for this request. Required.
*
* For the HTTP transport, this value MUST match the `MCP-Protocol-Version`
* header; otherwise the server MUST return a `400 Bad Request`. If the
* server does not support the requested version, it MUST return an
* {@link UnsupportedProtocolVersionError}.
*/
"io.modelcontextprotocol/protocolVersion": string;
/**
* Identifies the client software making the request. Required.
*
* The {@link Implementation} schema requires `name` and `version`; other
* fields are optional.
*/
"io.modelcontextprotocol/clientInfo": Implementation;
/**
* The client's capabilities for this specific request. Required.
*
* Capabilities are declared per-request rather than once at initialization;
* an empty object means the client supports no optional capabilities.
* Servers MUST NOT infer capabilities from prior requests.
*/
"io.modelcontextprotocol/clientCapabilities": ClientCapabilities;
/**
* The desired log level for this request. Optional.
*
* If absent, the server MUST NOT send any {@link LoggingMessageNotification | notifications/message}
* notifications for this request. The client opts in to log messages by
* explicitly setting a level. Replaces the former `logging/setLevel` RPC.
*
* @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
* Remains in the specification for at least twelve months; see the
* deprecated features registry.
*/
"io.modelcontextprotocol/logLevel"?: LoggingLevel;
}
/**
* A progress token, used to associate progress notifications with the original request.
*
* @category Common Types
*/
export type ProgressToken = string | number;
/**
* An opaque token used to represent a cursor for pagination.
*
* @category Common Types
*/
export type Cursor = string;
/**
* Common params for any request.
*
* @category Common Types
*/
export interface RequestParams {
_meta: RequestMetaObject;
}
/** @internal */
export interface Request {
method: string;
// Allow unofficial extensions of `Request.params` without impacting `RequestParams`.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
params?: { [key: string]: any };
}
/**
* Common params for any notification.
*
* @category Common Types
*/
export interface NotificationParams {
_meta?: MetaObject;
}
/** @internal */
export interface Notification {
method: string;
// Allow unofficial extensions of `Notification.params` without impacting `NotificationParams`.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
params?: { [key: string]: any };
}
/**
* Indicates the type of a {@link Result} object, allowing the client to
* determine how to parse the response.
*
* complete - the request completed successfully and the result contains the final content.
* input_required - the request requires additional input and the result contains an {@link InputRequiredResult} object with instructions for the client to provide additional input before retrying the original request.
* @category Common Types
*/
export type ResultType = "complete" | "input_required" | string;
/**
* Common result fields.
*
* @category Common Types
*/
export interface Result {
_meta?: MetaObject;
/**
* Indicates the type of the result, which allows the client to determine
* how to parse the result object.
*
* Servers implementing this protocol version MUST include this field.
* For backward compatibility, when a client receives a result from a
* server implementing an earlier protocol version (which does not include
* `resultType`), the client MUST treat the absent field as `"complete"`.
*/
resultType: ResultType;
[key: string]: unknown;
}
/**
* @category Errors
*/
export interface Error {
/**
* The error type that occurred.
*/
code: number;
/**
* A short description of the error. The message SHOULD be limited to a concise single sentence.
*/
message: string;
/**
* Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
*/
data?: unknown;
}
/**
* A uniquely identifying ID for a request in JSON-RPC.
*
* @category Common Types
*/
export type RequestId = string | number;
/**
* A request that expects a response.
*
* @category JSON-RPC
*/
export interface JSONRPCRequest extends Request {
jsonrpc: typeof JSONRPC_VERSION;
id: RequestId;
}
/**
* A notification which does not expect a response.
*
* @category JSON-RPC
*/
export interface JSONRPCNotification extends Notification {
jsonrpc: typeof JSONRPC_VERSION;
}
/**
* A successful (non-error) response to a request.
*
* @category JSON-RPC
*/
export interface JSONRPCResultResponse {
jsonrpc: typeof JSONRPC_VERSION;
id: RequestId;
result: Result;
}
/**
* A response to a request that indicates an error occurred.
*
* @category JSON-RPC
*/
export interface JSONRPCErrorResponse {
jsonrpc: typeof JSONRPC_VERSION;
id?: RequestId;
error: Error;
}
/**
* A response to a request, containing either the result or error.
*
* @category JSON-RPC
*/
export type JSONRPCResponse = JSONRPCResultResponse | JSONRPCErrorResponse;
// Standard JSON-RPC error codes
export const PARSE_ERROR = -32700;
export const INVALID_REQUEST = -32600;
export const METHOD_NOT_FOUND = -32601;
export const INVALID_PARAMS = -32602;
export const INTERNAL_ERROR = -32603;
/**
* A JSON-RPC error indicating that invalid JSON was received by the server. This error is returned when the server cannot parse the JSON text of a message.
*
* @see {@link https://www.jsonrpc.org/specification#error_object | JSON-RPC 2.0 Error Object}
*
* @example Invalid JSON
* {@includeCode ./examples/ParseError/invalid-json.json}
*
* @category Errors
*/
export interface ParseError extends Error {
code: typeof PARSE_ERROR;
}
/**
* A JSON-RPC error indicating that the request is not a valid request object. This error is returned when the message structure does not conform to the JSON-RPC 2.0 specification requirements for a request (e.g., missing required fields like `jsonrpc` or `method`, or using invalid types for these fields).
*
* @see {@link https://www.jsonrpc.org/specification#error_object | JSON-RPC 2.0 Error Object}
*
* @category Errors
*/
export interface InvalidRequestError extends Error {
code: typeof INVALID_REQUEST;
}
/**
* A JSON-RPC error indicating that the requested method does not exist or is not available.
*
* In MCP, a server returns this error when a client invokes a method the server does not implement — either a genuinely unknown method, or one gated behind a server capability the server did not advertise (e.g., calling `prompts/list` when the `prompts` capability was not advertised).
*
* A request that requires a client capability the client did not declare is signalled instead by {@link MissingRequiredClientCapabilityError} (`-32003`).
*
* @see {@link https://www.jsonrpc.org/specification#error_object | JSON-RPC 2.0 Error Object}
*
* @example Prompts not supported
* {@includeCode ./examples/MethodNotFoundError/prompts-not-supported.json}
*
* @category Errors
*/
export interface MethodNotFoundError extends Error {
code: typeof METHOD_NOT_FOUND;
}
/**
* A JSON-RPC error indicating that the method parameters are invalid or malformed.
*
* In MCP, this error is returned in various contexts when request parameters fail validation:
*
* - **Tools**: Unknown tool name or invalid tool arguments
* - **Prompts**: Unknown prompt name or missing required arguments
* - **Pagination**: Invalid or expired cursor values
* - **Logging**: Invalid log level
* - **Elicitation**: Server requests an elicitation mode not declared in client capabilities
* - **Sampling**: Missing tool result or tool results mixed with other content
*
* @see {@link https://www.jsonrpc.org/specification#error_object | JSON-RPC 2.0 Error Object}
*
* @example Unknown tool
* {@includeCode ./examples/InvalidParamsError/unknown-tool.json}
*
* @example Invalid tool arguments
* {@includeCode ./examples/InvalidParamsError/invalid-tool-arguments.json}
*
* @example Unknown prompt
* {@includeCode ./examples/InvalidParamsError/unknown-prompt.json}
*
* @example Invalid cursor
* {@includeCode ./examples/InvalidParamsError/invalid-cursor.json}
*
* @category Errors
*/
export interface InvalidParamsError extends Error {
code: typeof INVALID_PARAMS;
}
/**
* A JSON-RPC error indicating that an internal error occurred on the receiver. This error is returned when the receiver encounters an unexpected condition that prevents it from fulfilling the request.
*
* @see {@link https://www.jsonrpc.org/specification#error_object | JSON-RPC 2.0 Error Object}
*
* @example Unexpected error
* {@includeCode ./examples/InternalError/unexpected-error.json}
*
* @category Errors
*/
export interface InternalError extends Error {
code: typeof INTERNAL_ERROR;
}
/**
* Error code returned when a server requires a client capability that was
* not declared in the request's `clientCapabilities`.
*
* @category Errors
*/
export const MISSING_REQUIRED_CLIENT_CAPABILITY = -32003;
/**
* Error code returned when the request's protocol version is not supported
* by the server.
*
* @category Errors
*/
export const UNSUPPORTED_PROTOCOL_VERSION = -32004;
/**
* Returned when the request's protocol version is unknown to the server or
* unsupported (e.g., a known experimental or draft version the server has
* chosen not to implement). For HTTP, the response status code MUST be
* `400 Bad Request`.
*
* @example Unsupported protocol version
* {@includeCode ./examples/UnsupportedProtocolVersionError/unsupported-version.json}
*
* @category Errors
*/
export interface UnsupportedProtocolVersionError extends Omit<
JSONRPCErrorResponse,
"error"
> {
error: Error & {
code: typeof UNSUPPORTED_PROTOCOL_VERSION;
data: {
/**
* Protocol versions the server supports. The client should choose a
* mutually supported version from this list and retry.
*/
supported: string[];
/**
* The protocol version that was requested by the client.
*/
requested: string;
};
};
}
/**
* Returned when processing a request requires a capability the client did not
* declare in `clientCapabilities`. For HTTP, the response status code MUST be
* `400 Bad Request`.
*
* @example Missing elicitation capability
* {@includeCode ./examples/MissingRequiredClientCapabilityError/missing-elicitation-capability.json}
*
* @category Errors
*/
export interface MissingRequiredClientCapabilityError extends Omit<
JSONRPCErrorResponse,
"error"
> {
error: Error & {
code: typeof MISSING_REQUIRED_CLIENT_CAPABILITY;
data: {
/**
* The capabilities the server requires from the client to process this request.
*/
requiredCapabilities: ClientCapabilities;
};
};
}
/* Empty result */
/**
* A result that indicates success but carries no data.
*
* @category Common Types
*/
export type EmptyResult = Result;
/** @internal */
export type InputRequest =
| CreateMessageRequest
| ListRootsRequest
| ElicitRequest;
/** @internal */
export type InputResponse =
| CreateMessageResult
| ListRootsResult
| ElicitResult;
/**
* A map of server-initiated requests that the client must fulfill.
* Keys are server-assigned identifiers; values are the request objects.
*
* @example Elicitation and sampling input requests
* {@includeCode ./examples/InputRequests/elicitation-and-sampling-input-requests.json}
*
* @category Multi Round-Trip
*/
export interface InputRequests {
[key: string]: InputRequest;
}
/**
* A map of client responses to server-initiated requests.
* Keys correspond to the keys in the {@link InputRequests} map;
* values are the client's result for each request.
*
* @example Elicitation and sampling input responses
* {@includeCode ./examples/InputResponses/elicitation-and-sampling-input-responses.json}
*
* @category Multi Round-Trip
*/
export interface InputResponses {
[key: string]: InputResponse;
}
/**
* An InputRequiredResult sent by the server to indicate that additional input is needed
* before the request can be completed.
*
* At least one of `inputRequests` or `requestState` MUST be present.
* @example InputRequiredResult with elicitation and sampling input requests and request state
* {@includeCode ./examples/InputRequiredResult/input-required-result-with-elicitation-and-sampling-and-request-state.json}
*
* @example InputRequiredResult with request state only (load shedding)
* {@includeCode ./examples/InputRequiredResult/input-required-result-with-request-state-only.json}
*
* @category Multi Round-Trip
*/
export interface InputRequiredResult extends Result {
/* Requests issued by the server that must be complete before the
* client can retry the original request.
*/
inputRequests?: InputRequests;
/* Request state to be passed back to the server when the client
* retries the original request.
* Note: The client must treat this as an opaque blob; it must not
* interpret it in any way.
*/
requestState?: string;
}
/* Request parameter type that includes input responses and request state.
* These parameters may be included in any client-initiated request.
*/
export interface InputResponseRequestParams extends RequestParams {
/* New field to carry the responses for the server's requests from the
* InputRequiredResult message. For each key in the response's inputRequests
* field, the same key must appear here with the associated response.
*/
inputResponses?: InputResponses;
/* Request state passed back to the server from the client.
*/
requestState?: string;
}
/* Cancellation */
/**
* Parameters for a `notifications/cancelled` notification.
*
* @example User-requested cancellation
* {@includeCode ./examples/CancelledNotificationParams/user-requested-cancellation.json}
*
* @category `notifications/cancelled`
*/
export interface CancelledNotificationParams extends NotificationParams {
/**
* The ID of the request to cancel.
*
* This MUST correspond to the ID of a request previously issued in the same direction.
*/
requestId?: RequestId;
/**
* An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.
*/
reason?: string;
}
/**
* This notification can be sent by either side to indicate that it is cancelling a previously-issued request.
*
* The request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished.
*
* This notification indicates that the result will be unused, so any associated processing SHOULD cease.
*
* @example User-requested cancellation
* {@includeCode ./examples/CancelledNotification/user-requested-cancellation.json}
*
* @category `notifications/cancelled`
*/
export interface CancelledNotification extends JSONRPCNotification {
method: "notifications/cancelled";
params: CancelledNotificationParams;
}
/* Discovery */
/**
* A request from the client asking the server to advertise its supported
* protocol versions, capabilities, and other metadata. Servers **MUST**
* implement `server/discover`. Clients **MAY** call it but are not required
* to — version negotiation can also happen inline via per-request `_meta`.
*
* @example Discover request
* {@includeCode ./examples/DiscoverRequest/server-discover-request.json}
*
* @category `server/discover`
*/
export interface DiscoverRequest extends JSONRPCRequest {
method: "server/discover";
params: RequestParams;
}
/**
* The result returned by the server for a {@link DiscoverRequest | server/discover} request.
*
* @example Server capabilities discovery
* {@includeCode ./examples/DiscoverResult/server-capabilities-discovery.json}
*
* @category `server/discover`
*/
export interface DiscoverResult extends CacheableResult {
/**
* MCP Protocol Versions this server supports. The client should choose a
* version from this list for use in subsequent requests.
*/
supportedVersions: string[];
/**
* The capabilities of the server.
*/
capabilities: ServerCapabilities;
/**
* Information about the server software implementation.
*/
serverInfo: Implementation;
/**
* Natural-language guidance describing the server and its features.
*
* This can be used by clients to improve an LLM's understanding of
* available tools (e.g., by including it in a system prompt). It should
* focus on information that helps the model use the server effectively
* and should not duplicate information already in tool descriptions.
*/
instructions?: string;
}
/**
* A successful response from the server for a {@link DiscoverRequest | server/discover} request.
*
* @example Discover result response
* {@includeCode ./examples/DiscoverResultResponse/discover-result-response.json}
*
* @category `server/discover`
*/
export interface DiscoverResultResponse extends JSONRPCResultResponse {
result: DiscoverResult;
}
/**
* Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.
*
* @category `server/discover`
*/
export interface ClientCapabilities {
/**
* Experimental, non-standard capabilities that the client supports.
*/
experimental?: { [key: string]: JSONObject };
/**
* Present if the client supports listing roots.
*
* @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
* Remains in the specification for at least twelve months; see the
* deprecated features registry.
*
* @example Roots — minimum baseline support
* {@includeCode ./examples/ClientCapabilities/roots-minimum-baseline-support.json}
*/
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
roots?: {};
/**
* Present if the client supports sampling from an LLM.
*
* @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
* Remains in the specification for at least twelve months; see the
* deprecated features registry.
*
* @example Sampling — minimum baseline support
* {@includeCode ./examples/ClientCapabilities/sampling-minimum-baseline-support.json}
*
* @example Sampling — tool use support
* {@includeCode ./examples/ClientCapabilities/sampling-tool-use-support.json}
*
* @example Sampling — context inclusion support (deprecated)
* {@includeCode ./examples/ClientCapabilities/sampling-context-inclusion-support-deprecated.json}
*/
sampling?: {
/**
* Whether the client supports context inclusion via `includeContext` parameter.
* If not declared, servers SHOULD only use `includeContext: "none"` (or omit it).
*/
context?: JSONObject;
/**
* Whether the client supports tool use via `tools` and `toolChoice` parameters.
*/
tools?: JSONObject;
};
/**
* Present if the client supports elicitation from the server.
*
* @example Elicitation — form and URL mode support
* {@includeCode ./examples/ClientCapabilities/elicitation-form-and-url-mode-support.json}
*
* @example Elicitation — form mode only (implicit)
* {@includeCode ./examples/ClientCapabilities/elicitation-form-only-implicit.json}
*/
elicitation?: {
form?: JSONObject;
url?: JSONObject;
};
/**
* Optional MCP extensions that the client supports. Keys are extension identifiers
* (e.g., "io.modelcontextprotocol/oauth-client-credentials"), and values are
* per-extension settings objects. An empty object indicates support with no settings.
*
* Keys MUST follow the {@link MetaObject | `_meta` key naming rules}, with a
* mandatory prefix.
*
* @example Extensions — MCP Apps (UI) extension with MIME type support
* {@includeCode ./examples/ClientCapabilities/extensions-ui-mime-types.json}
*/
extensions?: { [key: string]: JSONObject };
}
/**
* Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.
*
* @category `server/discover`
*/
export interface ServerCapabilities {
/**
* Experimental, non-standard capabilities that the server supports.
*/
experimental?: { [key: string]: JSONObject };
/**
* Present if the server supports sending log messages to the client.
*
* @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
* Remains in the specification for at least twelve months; see the
* deprecated features registry.
*
* @example Logging — minimum baseline support
* {@includeCode ./examples/ServerCapabilities/logging-minimum-baseline-support.json}
*/
logging?: JSONObject;
/**
* Present if the server supports argument autocompletion suggestions.
*
* @example Completions — minimum baseline support
* {@includeCode ./examples/ServerCapabilities/completions-minimum-baseline-support.json}
*/
completions?: JSONObject;
/**
* Present if the server offers any prompt templates.
*
* @example Prompts — minimum baseline support
* {@includeCode ./examples/ServerCapabilities/prompts-minimum-baseline-support.json}
*
* @example Prompts — list changed notifications
* {@includeCode ./examples/ServerCapabilities/prompts-list-changed-notifications.json}
*/
prompts?: {
/**
* Whether this server supports notifications for changes to the prompt list.
*/
listChanged?: boolean;
};
/**
* Present if the server offers any resources to read.
*
* @example Resources — minimum baseline support
* {@includeCode ./examples/ServerCapabilities/resources-minimum-baseline-support.json}
*
* @example Resources — subscription to individual resource updates (only)
* {@includeCode ./examples/ServerCapabilities/resources-subscription-to-individual-resource-updates-only.json}
*
* @example Resources — list changed notifications (only)
* {@includeCode ./examples/ServerCapabilities/resources-list-changed-notifications-only.json}
*
* @example Resources — all notifications
* {@includeCode ./examples/ServerCapabilities/resources-all-notifications.json}
*/
resources?: {
/**
* Whether this server supports subscribing to resource updates.
*/
subscribe?: boolean;
/**
* Whether this server supports notifications for changes to the resource list.
*/
listChanged?: boolean;
};
/**
* Present if the server offers any tools to call.
*
* @example Tools — minimum baseline support
* {@includeCode ./examples/ServerCapabilities/tools-minimum-baseline-support.json}
*
* @example Tools — list changed notifications
* {@includeCode ./examples/ServerCapabilities/tools-list-changed-notifications.json}
*/
tools?: {
/**
* Whether this server supports notifications for changes to the tool list.
*/
listChanged?: boolean;
};
/**
* Optional MCP extensions that the server supports. Keys are extension identifiers
* (e.g., "io.modelcontextprotocol/tasks"), and values are per-extension settings
* objects. An empty object indicates support with no settings.
*
* Keys MUST follow the {@link MetaObject | `_meta` key naming rules}, with a
* mandatory prefix.
*
* @example Extensions — Tasks extension support
* {@includeCode ./examples/ServerCapabilities/extensions-tasks.json}
*/
extensions?: { [key: string]: JSONObject };
}
/**
* An optionally-sized icon that can be displayed in a user interface.
*
* @category Common Types
*/
export interface Icon {
/**
* A standard URI pointing to an icon resource. May be an HTTP/HTTPS URL or a
* `data:` URI with Base64-encoded image data.
*
* Consumers SHOULD take steps to ensure URLs serving icons are from the
* same domain as the client/server or a trusted domain.
*
* Consumers SHOULD take appropriate precautions when consuming SVGs as they can contain
* executable JavaScript.
*
* @format uri
*/
src: string;
/**
* Optional MIME type override if the source MIME type is missing or generic.
* For example: `"image/png"`, `"image/jpeg"`, or `"image/svg+xml"`.
*/
mimeType?: string;
/**
* Optional array of strings that specify sizes at which the icon can be used.
* Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG.
*
* If not provided, the client should assume that the icon can be used at any size.
*/
sizes?: string[];
/**
* Optional specifier for the theme this icon is designed for. `"light"` indicates
* the icon is designed to be used with a light background, and `"dark"` indicates
* the icon is designed to be used with a dark background.
*
* If not provided, the client should assume the icon can be used with any theme.
*/
theme?: "light" | "dark";
}
/**
* Base interface to add `icons` property.
*
* @internal
*/
export interface Icons {
/**
* Optional set of sized icons that the client can display in a user interface.
*
* Clients that support rendering icons MUST support at least the following MIME types:
* - `image/png` - PNG images (safe, universal compatibility)
* - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility)
*
* Clients that support rendering icons SHOULD also support:
* - `image/svg+xml` - SVG images (scalable but requires security precautions)
* - `image/webp` - WebP images (modern, efficient format)
*/
icons?: Icon[];
}
/**
* Base interface for metadata with name (identifier) and title (display name) properties.
*
* @internal
*/
export interface BaseMetadata {
/**
* Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).
*/
name: string;
/**
* Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
* even by those unfamiliar with domain-specific terminology.
*
* If not provided, the name should be used for display (except for {@link Tool},
* where `annotations.title` should be given precedence over using `name`,
* if present).
*/
title?: string;
}
/**
* Describes the MCP implementation.
*
* @category `server/discover`
*/
export interface Implementation extends BaseMetadata, Icons {
/**
* The version of this implementation.
*/
version: string;
/**
* An optional human-readable description of what this implementation does.
*
* This can be used by clients or servers to provide context about their purpose
* and capabilities. For example, a server might describe the types of resources
* or tools it provides, while a client might describe its intended use case.
*/
description?: string;
/**
* An optional URL of the website for this implementation.
*
* @format uri
*/
websiteUrl?: string;
}
/* Progress notifications */
/**
* Parameters for a {@link ProgressNotification | notifications/progress} notification.
*
* @example Progress message
* {@includeCode ./examples/ProgressNotificationParams/progress-message.json}
*
* @category `notifications/progress`
*/
export interface ProgressNotificationParams extends NotificationParams {
/**
* The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
*/
progressToken: ProgressToken;
/**
* The progress thus far. This should increase every time progress is made, even if the total is unknown.
*
* @TJS-type number
*/
progress: number;
/**
* Total number of items to process (or total progress required), if known.
*
* @TJS-type number
*/
total?: number;
/**
* An optional message describing the current progress.
*/
message?: string;
}
/**
* An out-of-band notification used to inform the receiver of a progress update for a long-running request.
*
* @example Progress message
* {@includeCode ./examples/ProgressNotification/progress-message.json}
*
* @category `notifications/progress`
*/
export interface ProgressNotification extends JSONRPCNotification {
method: "notifications/progress";
params: ProgressNotificationParams;
}
/* Pagination */
/**
* Common params for paginated requests.
*
* @example List request with cursor
* {@includeCode ./examples/PaginatedRequestParams/list-with-cursor.json}
*
* @category Common Types
*/
export interface PaginatedRequestParams extends RequestParams {
/**
* An opaque token representing the current pagination position.
* If provided, the server should return results starting after this cursor.
*/
cursor?: Cursor;
}
/** @internal */
export interface PaginatedRequest extends JSONRPCRequest {
params: PaginatedRequestParams;
}
/** @internal */
export interface PaginatedResult extends Result {
/**
* An opaque token representing the pagination position after the last returned result.
* If present, there may be more results available.
*/
nextCursor?: Cursor;
}
/**
* A result that supports a time-to-live (TTL) hint for client-side caching.
*
* @internal
*/
export interface CacheableResult extends Result {
/**
* A hint from the server indicating how long (in milliseconds) the
* client MAY cache this response before re-fetching. Semantics are
* analogous to HTTP Cache-Control max-age.
*
* - If 0, The response SHOULD be considered immediately stale,
* The client MAY re-fetch every time the result is needed.
* - If positive, the client SHOULD consider the result fresh for this many
* milliseconds after receiving the response.