Skip to content

Commit 5fb6ee2

Browse files
authored
Add $schema to server.json specification to enable versioning, IDE autocomplete (#308)
## Summary - Add optional `$schema` property to ServerDetail specification - Update JSON Schema, OpenAPI spec, Go models, examples, and publisher template - Enable schema versioning and IDE validation support ## Changes - Added `$schema` as optional string property with URI format in specs - Updated Go ServerDetail struct with new Schema field - Added `$schema` to examples and publisher template - Copy schema file to ../static for GitHub Pages hosting Fixes #139
1 parent 923b2e0 commit 5fb6ee2

File tree

12 files changed

+36
-18
lines changed

12 files changed

+36
-18
lines changed

docs/new_package_registry.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The MCP Registry project is a **metaregistry**, meaning that it hosts metadata f
44

55
For local MCP servers, the MCP Registry has pointers in the `packages` node of the [`server.json`](server-json/README.md) schema that refer to packages in supported package managers.
66

7-
The list of supported package managers for hosting MCP servers is defined by the `properties.packages[N].properties.registry_name` string enum in the [`server.json` schema](server-json/schema.json). For example, this could be "npm" (for npmjs.com packages) or "pypi" (for PyPI packages).
7+
The list of supported package managers for hosting MCP servers is defined by the `properties.packages[N].properties.registry_name` string enum in the [`server.json` schema](server-json/server.schema.json). For example, this could be "npm" (for npmjs.com packages) or "pypi" (for PyPI packages).
88

99
For remote MCP servers, the package registry is not relevant. The MCP client consumes the server via a URL instead of by downloading and running a package. In other words, this document only applies to local MCP servers.
1010

@@ -29,7 +29,7 @@ These steps are currently very brief because the MCP Registry service is not yet
2929
1. [Create a feature request issue](https://github.com/modelcontextprotocol/registry/issues/new?template=feature_request.md) on the MCP Registry repository to begin the discussion about adding the package registry.
3030
- Example for NuGet: https://github.com/modelcontextprotocol/registry/issues/126
3131
1. Open a PR with the following changes:
32-
- Update the [`server.json` schema](server-json/schema.json)
32+
- Update the [`server.json` schema](server-json/server.schema.json)
3333
- Add your package registry name to the `registry_name` enum value array.
3434
- Add the single-shot CLI command name to the `runtime_hint` example value array.
3535
- Update the [`openapi.yaml`](openapi.yaml)

docs/server-json/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ All of these scenarios (and more) would benefit from an agreed-upon, standardize
1212
Please note: this is different from the file commonly referred to as `mcp.json`, which is _an MCP client's configuration file for **running** a specific set of MCP servers_. See [this issue](https://github.com/modelcontextprotocol/modelcontextprotocol/issues/292).
1313

1414
References:
15-
- [schema.json](./schema.json) - The official JSON schema specification for this representation
15+
- [server.schema.json](./server.schema.json) - The official JSON schema specification for this representation
1616
- [examples.md](./examples.md) - Example manifestations of the JSON schema
17-
- [registry-schema.json](./registry-schema.json) - A more constrained version of `schema.json` that the official registry supports
17+
- [registry-schema.json](./registry-schema.json) - A more constrained version of `server.schema.json` that the official registry supports
1818

1919
## Validation Tools
2020

2121
Two validation tools are provided in the repository's `tools/` directory:
22-
- **validate-schemas** - Validates that `schema.json` and `registry-schema.json` are valid JSON Schema documents
22+
- **validate-schemas** - Validates that `server.schema.json` and `registry-schema.json` are valid JSON Schema documents
2323
- **validate-examples** - Validates that all JSON examples in `examples.md` conform to both schemas
2424

2525
### Usage

docs/server-json/examples.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ _These examples show the PublishRequest format used by the `/v0/publish` API end
77
```json
88
{
99
"server": {
10+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json",
1011
"name": "io.modelcontextprotocol/brave-search",
1112
"description": "MCP server for Brave Search API integration",
1213
"status": "active",
@@ -91,6 +92,7 @@ This will essentially instruct the MCP client to execute `dnx Knapcode.SampleMcp
9192
```json
9293
{
9394
"server": {
95+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json",
9496
"name": "com.github.modelcontextprotocol/filesystem",
9597
"description": "Node.js server implementing Model Context Protocol (MCP) for filesystem operations.",
9698
"status": "active",
@@ -418,6 +420,7 @@ The `dnx` tool ships with the .NET 10 SDK, starting with Preview 6.
418420
```json
419421
{
420422
"server": {
423+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json",
421424
"name": "io.modelcontextprotocol.anonymous/hybrid-mcp",
422425
"description": "MCP server available as both local package and remote service",
423426
"repository": {

docs/server-json/registry-schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"$id": "https://modelcontextprotocol.io/schemas/draft/2025-07-09/registry-server.json",
44
"title": "MCP Server Detail - Registry Schema",
55
"description": "Registry-specific constraints for MCP server representation. Extends the base schema with additional validation rules.",
6-
"$ref": "https://modelcontextprotocol.io/schemas/draft/2025-07-09/server.json",
6+
"$ref": "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json",
77
"properties": {
88
"repository": {
99
"properties": {

docs/server-json/repository_references.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Repository References in server.json
22

3-
The [`server.json` schema](schema.json) MAY contain a `repository` property at the root of the JSON object. The `repository` object provides metadata about the MCP server's source code. This enables users and security experts to inspect the code of the MCP service, thereby improving the transparency of what the MCP server is doing at runtime.
3+
The [`server.json` schema](server.schema.json) MAY contain a `repository` property at the root of the JSON object. The `repository` object provides metadata about the MCP server's source code. This enables users and security experts to inspect the code of the MCP service, thereby improving the transparency of what the MCP server is doing at runtime.
44

55
The inclusion of the `repository` object is RECOMMENDED for both local and remote MCP servers.
66

docs/server-json/schema.json renamed to docs/server-json/server.schema.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
3-
"$id": "https://modelcontextprotocol.io/schemas/draft/2025-07-09/server.json",
3+
"$id": "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json",
44
"title": "MCP Server Detail",
55
"$ref": "#/$defs/ServerDetail",
66
"$defs": {
@@ -342,6 +342,12 @@
342342
{
343343
"type": "object",
344344
"properties": {
345+
"$schema": {
346+
"type": "string",
347+
"format": "uri",
348+
"description": "JSON Schema URI for this server.json format",
349+
"example": "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json"
350+
},
345351
"packages": {
346352
"type": "array",
347353
"items": {

docs/server-registry-api/openapi.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,11 @@ components:
450450
- $ref: '#/components/schemas/Server'
451451
- type: object
452452
properties:
453+
$schema:
454+
type: string
455+
format: uri
456+
description: JSON Schema URI for this server.json format
457+
example: "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json"
453458
packages:
454459
type: array
455460
items:

internal/model/model.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ type VersionDetail struct {
111111

112112
// ServerDetail represents complete server information as defined in the MCP spec (pure, no registry metadata)
113113
type ServerDetail struct {
114+
Schema string `json:"$schema,omitempty" bson:"$schema,omitempty"`
114115
Name string `json:"name" bson:"name"`
115116
Description string `json:"description" bson:"description"`
116117
Status ServerStatus `json:"status,omitempty" bson:"status,omitempty"`

tools/publisher/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ type Package struct {
5252
}
5353

5454
type ServerJSON struct {
55+
Schema string `json:"$schema"`
5556
Name string `json:"name"`
5657
Description string `json:"description"`
5758
Status string `json:"status,omitempty"`
@@ -489,6 +490,7 @@ func createServerStructure(
489490

490491
// Create server structure
491492
return ServerJSON{
493+
Schema: "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json",
492494
Name: name,
493495
Description: description,
494496
Status: status,

tools/publisher/server.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json",
23
"description": "<your description here>",
34
"name": "io.github.<owner>/<server-name>",
45
"status": "active",

0 commit comments

Comments
 (0)