-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathschema.ts
More file actions
347 lines (312 loc) · 11.3 KB
/
Copy pathschema.ts
File metadata and controls
347 lines (312 loc) · 11.3 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
/**
* MCP Server Cards
*
* Schema for the experimental Server Card extension. This file is the single
* source of truth for the Server Card types.
*/
/**
* A static metadata document describing a remote MCP server, suitable for
* pre-connection discovery. A Server Card may be hosted at any unreserved URI;
* MCP reserves `GET <streamable-http-url>/server-card` as the recommended
* location. Clients learn a card's URL from an [AI Catalog](https://github.com/Agent-Card/ai-catalog)
* rather than guessing it.
*
* Server Cards describe only what is needed to discover and connect to a remote server:
* identity, transport, and protocol versions.
*
* They do not enumerate primitives (tools, resources, prompts) — those remain
* subject to runtime listing via the protocol's standard list operations.
*
* The fields a Server Card does declare (identity, transport, protocol
* versions) are advisory, not authoritative: they should be consistent with
* the server's `server/discover` response, and clients must not treat them as
* authoritative for security decisions. See "Consistency with Runtime
* Behavior" in docs/discovery.md for the normative requirement.
*
* @category Server Cards
*/
export interface ServerCard {
/**
* The Server Card JSON Schema URI that this document conforms to. Required.
*
* Must be the `/v1/` Server Card schema URL under
* `static.modelcontextprotocol.io/schemas/` (i.e.,
* `https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json`).
* Schema URLs are versioned by the `vN` segment rather than by date; a
* breaking revision of the Server Card shape publishes a new `vN` family.
*
* @format uri
* @pattern ^https://static\.modelcontextprotocol\.io/schemas/v1/server-card\.schema\.json$
*/
$schema: string;
/**
* Server name in reverse-DNS format. Must contain exactly one forward slash
* separating namespace from server name.
*
* @minLength 3
* @maxLength 200
* @pattern ^[a-zA-Z0-9.-]+/[a-zA-Z0-9._-]+$
*/
name: string;
/**
* Version string for this server. SHOULD follow semantic versioning
* (e.g., '1.0.2', '2.1.0-alpha'). Equivalent of `Implementation.version`
* in the MCP specification. Non-semantic versions are allowed but may not
* sort predictably. Version ranges are rejected (e.g., '^1.2.3', '~1.2.3',
* '>=1.2.3', '1.x', '1.*').
*
* @maxLength 255
*/
version: string;
/**
* Clear human-readable explanation of server functionality. Should focus on
* capabilities, not implementation details.
*
* @minLength 1
* @maxLength 100
*/
description: string;
/**
* Optional human-readable title or display name for the MCP server.
* MCP subregistries or clients MAY choose to use this for display purposes.
*
* @minLength 1
* @maxLength 100
*/
title?: string;
/**
* Optional URL to the server's homepage, documentation, or project website.
* Provides a central link for users to learn more about the server.
* Particularly useful when the server has custom installation instructions
* or setup requirements.
*
* @format uri
*/
websiteUrl?: string;
/**
* Optional repository metadata for the MCP server source code.
* Recommended for transparency and security inspection.
*/
repository?: Repository;
/**
* 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` and `image/jpeg` (safe, universal compatibility).
* Clients SHOULD also support: `image/svg+xml` (scalable but requires security
* precautions) and `image/webp` (modern, efficient format).
*/
icons?: Icon[];
/**
* Metadata helpful for making HTTP-based connections to this MCP server.
*/
remotes?: Remote[];
/**
* Extension metadata using reverse-DNS namespacing for vendor-specific data.
*
* Follows the protocol's standard `_meta` definition.
*
* @see {@link MetaObject}
*/
_meta?: MetaObject;
}
/**
* Repository metadata for the MCP server source code. Enables users and
* security experts to inspect the code, improving transparency.
*
* @category Server Cards
*/
export interface Repository {
/**
* Repository URL for browsing source code. Should support both web browsing
* and `git clone` operations.
*
* @format uri
*/
url: string;
/**
* Repository hosting service identifier (e.g., `"github"`). Used by registries
* to determine validation and API access methods.
*/
source: string;
/**
* Optional relative path from repository root to the server location within a
* monorepo or nested package structure. Must be a clean relative path.
*/
subfolder?: string;
/**
* Repository identifier from the hosting service (e.g., GitHub repo ID).
* Owned and determined by the source forge. Should remain stable across
* repository renames and may be used to detect repository resurrection
* attacks — if a repository is deleted and recreated, the ID should change.
*/
id?: string;
}
/**
* Metadata for connecting to a remote (HTTP-based) MCP server endpoint.
*
* @category Server Cards
*/
export interface Remote {
/**
* The transport type for this remote endpoint.
*/
type: "streamable-http" | "sse";
/**
* URL template for the remote endpoint. Must start with `http://`,
* `https://`, or a `{template-variable}`. Variables in `{curly_braces}`
* are substituted from the {@link Remote.variables} map before the
* client connects.
*
* @pattern ^(https?://[^\s]+|\{[a-zA-Z_][a-zA-Z0-9_]*\}[^\s]*)$
*/
url: string;
/**
* HTTP headers required or accepted when connecting to this remote
* endpoint. Each header is described as a {@link KeyValueInput} so that
* clients can prompt users for required values, mark secrets, surface
* defaults, and constrain to a list of choices.
*/
headers?: KeyValueInput[];
/**
* Configuration variables that can be referenced as `{curly_braces}`
* placeholders in `url` (and inside header values via
* {@link KeyValueInput.variables}). The map key is the variable
* name; the value defines the variable's properties (e.g., human-readable
* description, default, whether it is required or secret).
*/
variables?: { [key: string]: Input };
/**
* MCP protocol versions actively supported by this remote endpoint. Allows
* clients to select a compatible protocol version before connecting.
*/
supportedProtocolVersions?: string[];
}
/**
* A user-supplied or pre-set input value, used for {@link Remote} URL
* variables and header values.
*
* @category Server Cards
*/
export interface Input {
/**
* Human-readable explanation of the input. Clients can use this to provide
* context to the user.
*/
description?: string;
/**
* Whether the input must be supplied for the connection to succeed.
*/
isRequired?: boolean;
/**
* Whether the input is a secret value (e.g., password, token). If true,
* clients should handle the value securely.
*/
isSecret?: boolean;
/**
* Specifies the input format. `"filepath"` should be interpreted as a file
* on the user's filesystem. When the input is converted to a string,
* booleans should be represented by `"true"`/`"false"`, and numbers by
* decimal values.
*/
format?: "string" | "number" | "boolean" | "filepath";
/**
* Default value for the input. SHOULD be a valid value for the input.
*/
default?: string;
/**
* Placeholder displayed during configuration to provide examples or
* guidance about the expected form of the input.
*/
placeholder?: string;
/**
* Pre-set value for the input. If set, the value should not be configurable
* by end users. Identifiers wrapped in `{curly_braces}` will be replaced
* with the corresponding entries from the input's `variables` map (if any).
*/
value?: string;
/**
* Allowed values for the input. If provided, the user must select one.
*/
choices?: string[];
}
/**
* A named {@link Input} — used for HTTP headers — whose `value` may reference
* variables for substitution.
*
* @category Server Cards
*/
export interface KeyValueInput extends Input {
/**
* Name of the header.
*/
name: string;
/**
* Variables referenced by `{curly_braces}` identifiers in `value`. The map
* key is the variable name; the value defines the variable's properties.
*/
variables?: { [key: string]: Input };
}
/* ---------- Inlined dependencies from the main MCP spec ---------- */
/**
* 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 (`-`).
* - Any prefix consisting of zero or more labels, followed by `modelcontextprotocol` or `mcp`, followed by any label, is **reserved** for MCP use. For example: `modelcontextprotocol.io/`, `mcp.dev/`, `api.modelcontextprotocol.org/`, and `tools.mcp.com/` are all reserved.
*
* **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`](https://modelcontextprotocol.io/specification/draft/basic#meta) for more details.
* @category Common Types
*/
export interface MetaObject {
[key: string]: unknown;
}
/**
* 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";
}