Skip to content

Commit 6a2e5d1

Browse files
authored
Align the server.json schema with the YAML (modelcontextprotocol#168)
<!-- Provide a brief summary of your changes --> ## Motivation and Context This is in support of modelcontextprotocol#159, to make it easier, I hope. My team noticed some differences in the JSON schema, most notably the "choices" property was missing. I tried to write a tool to do this but slowed down since I am not experienced with Go. This is a first pass, maybe someone else can finish the tooling. I restructured the JSON schema to break out child objects like the YAML file, and brought the descriptions and example into sync. The only differences are two extra properties in the YAML which are computed by the server: - `VersionDetail.is_latest` is not present in the JSON schema, computed by the registry based on modelcontextprotocol#158 - `Server.id` is not present in the JSON schema, generated by the registry The idea is the a tool could look at ServerDetail in the YAML and then generate the schema.json with minimal fix-ups (add a root title, remove `VersionDetail.is_latest` and `Server.id`. ~Question for @tadasant - should `VersionDetail.release_date` be in the JSON schema? I think _no_ (and let it be computed) but it's there right now.~ - aligned with modelcontextprotocol#167 and removed ## How Has This Been Tested? I have tested the JSON schema against the sample server.json in the repo (files and markdown blocks). ## Breaking Changes None. ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [x] Documentation update ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [x] My code follows the repository's style guidelines - [ ] New and existing tests pass locally - [ ] I have added appropriate error handling - [x] I have added or updated documentation as needed ## Additional context <!-- Add any other context, implementation notes, or design decisions -->
1 parent f6fa98c commit 6a2e5d1

File tree

2 files changed

+282
-227
lines changed

2 files changed

+282
-227
lines changed

docs/openapi.yaml

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
openapi: 3.1.0
2+
jsonSchemaDialect: "https://json-schema.org/draft/2020-12/schema"
23
info:
34
title: MCP Server Registry API
45
summary: API for discovering and accessing MCP servers metadata
@@ -82,7 +83,6 @@ paths:
8283
example: "Server not found"
8384
components:
8485
schemas:
85-
jsonSchemaDialect: "https://json-schema.org/draft/2020-12/schema"
8686
Repository:
8787
type: object
8888
required:
@@ -116,33 +116,36 @@ components:
116116
example: "a5e8a7f0-d4e4-4a1d-b12f-2896a23fd4f1"
117117
name:
118118
type: string
119-
example: "@modelcontextprotocol/servers/src/filesystem"
119+
description: Human-readable description of the server's functionality
120+
example: "io.modelcontextprotocol/filesystem"
120121
description:
121122
type: string
122123
example: "Node.js server implementing Model Context Protocol (MCP) for filesystem operations."
123124
repository:
124125
$ref: '#/components/schemas/Repository'
125126
version_detail:
126-
type: object
127-
required:
128-
- version
129-
- release_date
130-
- is_latest
131-
properties:
132-
version:
133-
type: string
134-
example: "1.0.2"
135-
description: Equivalent of Implementation.version in MCP specification.
136-
release_date:
137-
type: string
138-
format: date-time
139-
example: "2023-06-15T10:30:00Z"
140-
description: Datetime that the MCP server version was published to the registry.
141-
is_latest:
142-
type: boolean
143-
example: true
144-
description: Whether the MCP server version is the latest version available in the registry.
145-
$schema: "https://json-schema.org/draft/2020-12/schema"
127+
$ref: '#/components/schemas/VersionDetail'
128+
129+
VersionDetail:
130+
type: object
131+
required:
132+
- version
133+
- release_date
134+
- is_latest
135+
properties:
136+
version:
137+
type: string
138+
example: "1.0.2"
139+
description: Equivalent of Implementation.version in MCP specification.
140+
release_date:
141+
type: string
142+
format: date-time
143+
example: "2023-06-15T10:30:00Z"
144+
description: Datetime that the MCP server version was published to the registry.
145+
is_latest:
146+
type: boolean
147+
example: true
148+
description: Whether the MCP server version is the latest version available in the registry.
146149

147150
ServerList:
148151
type: object
@@ -172,12 +175,15 @@ components:
172175
registry_name:
173176
type: string
174177
enum: [npm, docker, pypi, homebrew, nuget]
178+
description: Package registry type
175179
example: "npm"
176180
name:
177181
type: string
182+
description: Package name in the registry
178183
example: "io.modelcontextprotocol/filesystem"
179184
version:
180185
type: string
186+
description: Package version
181187
example: "1.0.2"
182188
runtime_hint:
183189
type: string
@@ -317,17 +323,21 @@ components:
317323
transport_type:
318324
type: string
319325
enum: [streamable, sse]
326+
description: Transport protocol type
320327
example: "sse"
321328
url:
322329
type: string
323330
format: uri
331+
description: Remote server URL
324332
example: "https://mcp-fs.example.com/sse"
325333
headers:
326334
type: array
335+
description: HTTP headers to include
327336
items:
328337
$ref: '#/components/schemas/KeyValueInput'
329338

330339
ServerDetail:
340+
description: Schema for a static representation of an MCP server. Used in various contexts related to discovery, installation, and configuration.
331341
allOf:
332342
- $ref: '#/components/schemas/Server'
333343
- type: object

0 commit comments

Comments
 (0)