Bootstrap repo with TypeScript source-of-truth and generated JSON Schema
Tracks SEP-2127 (MCP Server Cards) as an experimental extension while the SEP
itself is under review. The schema.ts is structured to be lifted directly into
schema/draft/schema.ts of the main spec when Server Cards graduate -- only the
inlined MetaObject and Icon definitions need to be removed during migration.
- schema.ts: ServerCard, Server, Repository, Remote, Package, Argument, Input,
KeyValueInput, etc. plus inlined MetaObject and Icon
- scripts/generate-schema.ts: typescript-json-schema with 2020-12 transforms
- scripts/validate-examples.ts: ajv validator over examples/{ServerCard,Server}/
- examples/: 2 valid + 4 invalid Server Card cases, 1 valid Server case
- README: status, layout, schema URL conventions, graduation plan
- CI workflow: check + validate + format on every PR
This commit is contained in:
parent
bca85e53ca
commit
7a3ff5d452
7 changed files with 2789 additions and 1 deletions
27
examples/Server/valid/with-package.json
Normal file
27
examples/Server/valid/with-package.json
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"$schema": "https://static.modelcontextprotocol.io/schemas/v1/server.schema.json",
|
||||
"name": "example-org/with-package",
|
||||
"version": "0.4.2",
|
||||
"description": "Server document with a locally-runnable npm package.",
|
||||
"repository": {
|
||||
"url": "https://github.com/example-org/with-package",
|
||||
"source": "github"
|
||||
},
|
||||
"packages": [
|
||||
{
|
||||
"registryType": "npm",
|
||||
"identifier": "@example-org/with-package",
|
||||
"version": "0.4.2",
|
||||
"runtimeHint": "npx",
|
||||
"transport": { "type": "stdio" },
|
||||
"environmentVariables": [
|
||||
{
|
||||
"name": "EXAMPLE_API_KEY",
|
||||
"description": "Example API key.",
|
||||
"isRequired": true,
|
||||
"isSecret": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
6
examples/ServerCard/invalid/bad-name-pattern.json
Normal file
6
examples/ServerCard/invalid/bad-name-pattern.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"$schema": "https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",
|
||||
"name": "no-slash-in-name",
|
||||
"version": "1.0.0",
|
||||
"description": "Name must contain exactly one slash separating namespace and server name."
|
||||
}
|
||||
6
examples/ServerCard/invalid/date-versioned-schema.json
Normal file
6
examples/ServerCard/invalid/date-versioned-schema.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-11-25/server-card.schema.json",
|
||||
"name": "example-org/wrong-schema-url",
|
||||
"version": "1.0.0",
|
||||
"description": "Uses date-versioned schema URL; only /v1/ URLs are valid."
|
||||
}
|
||||
5
examples/ServerCard/invalid/missing-name.json
Normal file
5
examples/ServerCard/invalid/missing-name.json
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"$schema": "https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",
|
||||
"version": "1.0.0",
|
||||
"description": "Missing required `name` field."
|
||||
}
|
||||
5
examples/ServerCard/invalid/missing-schema.json
Normal file
5
examples/ServerCard/invalid/missing-schema.json
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "example-org/no-schema",
|
||||
"version": "1.0.0",
|
||||
"description": "Missing the required `$schema` field."
|
||||
}
|
||||
6
examples/ServerCard/valid/minimal.json
Normal file
6
examples/ServerCard/valid/minimal.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"$schema": "https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",
|
||||
"name": "example-org/minimal",
|
||||
"version": "1.0.0",
|
||||
"description": "Smallest valid Server Card."
|
||||
}
|
||||
38
examples/ServerCard/valid/templated-remote.json
Normal file
38
examples/ServerCard/valid/templated-remote.json
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"$schema": "https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",
|
||||
"name": "example-org/with-remote",
|
||||
"version": "2.1.0",
|
||||
"description": "Server Card with a templated remote endpoint and headers.",
|
||||
"title": "Example Remote Server",
|
||||
"websiteUrl": "https://example.com",
|
||||
"remotes": [
|
||||
{
|
||||
"type": "streamable-http",
|
||||
"url": "https://{tenant}.example.com/mcp",
|
||||
"headers": [
|
||||
{
|
||||
"name": "Authorization",
|
||||
"description": "Bearer token for the remote endpoint.",
|
||||
"isRequired": true,
|
||||
"isSecret": true,
|
||||
"value": "Bearer {token}",
|
||||
"variables": {
|
||||
"token": {
|
||||
"description": "API token issued by Example Inc.",
|
||||
"isRequired": true,
|
||||
"isSecret": true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"tenant": {
|
||||
"description": "Tenant subdomain.",
|
||||
"isRequired": true,
|
||||
"default": "default"
|
||||
}
|
||||
},
|
||||
"supportedProtocolVersions": ["2025-06-18", "2025-11-25"]
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Reference in a new issue