Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/new_package_registry.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The MCP Registry project is a **metaregistry**, meaning that it hosts metadata f

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.

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).
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).

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.

Expand All @@ -29,7 +29,7 @@ These steps are currently very brief because the MCP Registry service is not yet
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.
- Example for NuGet: https://github.com/modelcontextprotocol/registry/issues/126
1. Open a PR with the following changes:
- Update the [`server.json` schema](server-json/schema.json)
- Update the [`server.json` schema](server-json/server.schema.json)
- Add your package registry name to the `registry_name` enum value array.
- Add the single-shot CLI command name to the `runtime_hint` example value array.
- Update the [`openapi.yaml`](openapi.yaml)
Expand Down
6 changes: 3 additions & 3 deletions docs/server-json/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ All of these scenarios (and more) would benefit from an agreed-upon, standardize
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).

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

## Validation Tools

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

### Usage
Expand Down
3 changes: 3 additions & 0 deletions docs/server-json/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ _These examples show the PublishRequest format used by the `/v0/publish` API end
```json
{
"server": {
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json",
"name": "io.modelcontextprotocol/brave-search",
"description": "MCP server for Brave Search API integration",
"status": "active",
Expand Down Expand Up @@ -91,6 +92,7 @@ This will essentially instruct the MCP client to execute `dnx Knapcode.SampleMcp
```json
{
"server": {
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json",
"name": "com.github.modelcontextprotocol/filesystem",
"description": "Node.js server implementing Model Context Protocol (MCP) for filesystem operations.",
"status": "active",
Expand Down Expand Up @@ -418,6 +420,7 @@ The `dnx` tool ships with the .NET 10 SDK, starting with Preview 6.
```json
{
"server": {
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json",
"name": "io.modelcontextprotocol.anonymous/hybrid-mcp",
"description": "MCP server available as both local package and remote service",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion docs/server-json/registry-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"$id": "https://modelcontextprotocol.io/schemas/draft/2025-07-09/registry-server.json",
"title": "MCP Server Detail - Registry Schema",
"description": "Registry-specific constraints for MCP server representation. Extends the base schema with additional validation rules.",
"$ref": "https://modelcontextprotocol.io/schemas/draft/2025-07-09/server.json",
"$ref": "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json",
"properties": {
"repository": {
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion docs/server-json/repository_references.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Repository References in server.json

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.
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be The [server.schema.json schema]?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good q - we expect people to create server.json files, but then we want a schema to describe these server.json files. Which is 'the server.json schema', or 'server.schema.json'. So this is correct :)


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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://modelcontextprotocol.io/schemas/draft/2025-07-09/server.json",
"$id": "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json",
"title": "MCP Server Detail",
"$ref": "#/$defs/ServerDetail",
"$defs": {
Expand Down Expand Up @@ -342,6 +342,12 @@
{
"type": "object",
"properties": {
"$schema": {
"type": "string",
"format": "uri",
"description": "JSON Schema URI for this server.json format",
"example": "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json"
},
"packages": {
"type": "array",
"items": {
Expand Down
5 changes: 5 additions & 0 deletions docs/server-registry-api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,11 @@ components:
- $ref: '#/components/schemas/Server'
- type: object
properties:
$schema:
type: string
format: uri
description: JSON Schema URI for this server.json format
example: "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json"
packages:
type: array
items:
Expand Down
1 change: 1 addition & 0 deletions internal/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ type VersionDetail struct {

// ServerDetail represents complete server information as defined in the MCP spec (pure, no registry metadata)
type ServerDetail struct {
Schema string `json:"$schema,omitempty" bson:"$schema,omitempty"`
Name string `json:"name" bson:"name"`
Description string `json:"description" bson:"description"`
Status ServerStatus `json:"status,omitempty" bson:"status,omitempty"`
Expand Down
2 changes: 2 additions & 0 deletions tools/publisher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type Package struct {
}

type ServerJSON struct {
Schema string `json:"$schema"`
Name string `json:"name"`
Description string `json:"description"`
Status string `json:"status,omitempty"`
Expand Down Expand Up @@ -489,6 +490,7 @@ func createServerStructure(

// Create server structure
return ServerJSON{
Schema: "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json",
Name: name,
Description: description,
Status: status,
Expand Down
1 change: 1 addition & 0 deletions tools/publisher/server.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json",
"description": "<your description here>",
"name": "io.github.<owner>/<server-name>",
"status": "active",
Expand Down
12 changes: 6 additions & 6 deletions tools/validate-examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func runValidation() error {
basePath := filepath.Join("docs", "server-json")

examplesPath := filepath.Join(basePath, "examples.md")
schemaPath := filepath.Join(basePath, "schema.json")
schemaPath := filepath.Join(basePath, "server.schema.json")
registrySchemaPath := filepath.Join(basePath, "registry-schema.json")

examples, err := extractExamples(examplesPath)
Expand All @@ -56,7 +56,7 @@ func runValidation() error {

baseSchema, err := compileSchema(schemaPath)
if err != nil {
return fmt.Errorf("failed to compile schema.json: %w", err)
return fmt.Errorf("failed to compile server.schema.json: %w", err)
}

registrySchema, err := compileSchema(registrySchemaPath)
Expand Down Expand Up @@ -94,10 +94,10 @@ func runValidation() error {
registryValid := false

if err := baseSchema.Validate(serverData); err != nil {
log.Printf(" Validating against schema.json: ❌")
log.Printf(" Validating against server.schema.json: ❌")
log.Printf(" Error: %v", err)
} else {
log.Printf(" Validating against schema.json: ✅")
log.Printf(" Validating against server.schema.json: ✅")
baseValid = true
}

Expand Down Expand Up @@ -168,14 +168,14 @@ func compileSchema(path string) (*jsonschema.Schema, error) {

// For registry-schema.json, we need to register the base schema it references
if strings.Contains(path, "registry-schema.json") {
basePath := filepath.Join(filepath.Dir(path), "schema.json")
basePath := filepath.Join(filepath.Dir(path), "server.schema.json")
baseData, err := os.ReadFile(basePath)
if err != nil {
return nil, fmt.Errorf("failed to read base schema: %w", err)
}

// Add the base schema to the compiler with the expected URL
if err := compiler.AddResource("https://modelcontextprotocol.io/schemas/draft/2025-07-09/server.json", bytes.NewReader(baseData)); err != nil {
if err := compiler.AddResource("https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json", bytes.NewReader(baseData)); err != nil {
return nil, fmt.Errorf("failed to add base schema resource: %w", err)
}
}
Expand Down
8 changes: 4 additions & 4 deletions tools/validate-schemas/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// validate-schemas validates that schema.json and registry-schema.json
// validate-schemas validates that server.schema.json and registry-schema.json
// are valid JSON Schema documents.
//
// For more information, see docs/server-json/README.md
Expand Down Expand Up @@ -31,7 +31,7 @@ func runValidation() error {
name string
path string
}{
{"schema.json", filepath.Join(basePath, "schema.json")},
{"server.schema.json", filepath.Join(basePath, "server.schema.json")},
{"registry-schema.json", filepath.Join(basePath, "registry-schema.json")},
}

Expand Down Expand Up @@ -74,14 +74,14 @@ func validateSchema(path string) error {

// For registry-schema.json, we need to register the base schema it references
if strings.Contains(path, "registry-schema.json") {
basePath := filepath.Join(filepath.Dir(path), "schema.json")
basePath := filepath.Join(filepath.Dir(path), "server.schema.json")
baseData, err := os.ReadFile(basePath)
if err != nil {
return fmt.Errorf("failed to read base schema: %w", err)
}

// Add the base schema to the compiler with the expected URL
if err := compiler.AddResource("https://modelcontextprotocol.io/schemas/draft/2025-07-09/server.json", bytes.NewReader(baseData)); err != nil {
if err := compiler.AddResource("https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json", bytes.NewReader(baseData)); err != nil {
return fmt.Errorf("failed to add base schema resource: %w", err)
}
}
Expand Down
Loading