Skip to content

Commit 0ef5b90

Browse files
authored
Clarify the docs around _meta publisher extensions (#695)
1 parent 12b5b0f commit 0ef5b90

File tree

2 files changed

+100
-3
lines changed

2 files changed

+100
-3
lines changed

docs/reference/server-json/generic-server-json.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@ The schema contains all field definitions, validation rules, examples, and detai
1414

1515
The official registry has some more restrictions on top of this. See the [official registry requirements](./official-registry-requirements.md) for details.
1616

17+
## Extension Metadata with `_meta`
18+
19+
The optional `_meta` field allows publishers to include custom metadata alongside their server definitions using reverse DNS namespacing.
20+
21+
```jsonc
22+
{
23+
"_meta": {
24+
"io.modelcontextprotocol.registry/publisher-provided": {
25+
// Your custom metadata here
26+
}
27+
}
28+
}
29+
```
30+
31+
When publishing to the official registry, custom metadata must be placed under the key `io.modelcontextprotocol.registry/publisher-provided`. See the [official registry requirements](./official-registry-requirements.md) for detailed restrictions and examples.
32+
1733
## Examples
1834

1935
<!-- As a heads up, these are used as part of tests/integration/main.go -->

docs/reference/server-json/official-registry-requirements.md

Lines changed: 84 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,87 @@ Only trusted public registries are supported. Private registries and alternative
4343

4444
## `_meta` Namespace Restrictions
4545

46-
The `_meta` field is restricted to the `publisher` key only during publishing. This `_meta.publisher` extension is currently limited to 4KB.
47-
48-
Registry metadata is added automatically and cannot be overridden.
46+
The `_meta` field in `server.json` allows publishers to include custom metadata alongside their server definitions.
47+
48+
### Publisher-Provided Metadata
49+
50+
When publishing to the official registry, **only data under the specific key `io.modelcontextprotocol.registry/publisher-provided` will be preserved**. Any other keys in the `_meta` object are silently dropped during publishing and will not be stored or returned by the registry.
51+
52+
**Example:**
53+
54+
```jsonc
55+
{
56+
"_meta": {
57+
"io.modelcontextprotocol.registry/publisher-provided": {
58+
"tool": "ci-publisher",
59+
"version": "1.0.0",
60+
"custom_data": "your data here"
61+
},
62+
"some.other.key": {
63+
// This will be dropped and not preserved
64+
}
65+
}
66+
}
67+
```
68+
69+
**Size limit:** The publisher-provided extension is limited to 4KB (4096 bytes) of JSON. If the marshaled JSON exceeds this limit, publishing will fail with an error indicating the actual size.
70+
71+
### Registry API Metadata vs server.json Metadata
72+
73+
The `_meta` field in `server.json` is **different** from the `_meta` field returned in registry API responses:
74+
75+
- **In `server.json`**: The `_meta` field contains publisher-provided custom metadata under `io.modelcontextprotocol.registry/publisher-provided`
76+
- **In API responses**: The `_meta` field is returned as a separate property at the response level (not inside `server.json`) and contains registry-managed metadata like:
77+
- `status`: Server lifecycle status (active, deprecated, deleted)
78+
- `publishedAt`: When the server was first published
79+
- `updatedAt`: When the server was last updated
80+
- `isLatest`: Whether this is the latest version
81+
82+
**Example: What you publish (server.json)**
83+
84+
```jsonc
85+
{
86+
"name": "io.github.example/my-server",
87+
"version": "1.0.0",
88+
"description": "My MCP server",
89+
// ... other fields ...
90+
"_meta": {
91+
"io.modelcontextprotocol.registry/publisher-provided": {
92+
"tool": "ci-publisher",
93+
"version": "2.0.0"
94+
}
95+
}
96+
}
97+
```
98+
99+
**Example: What the registry API returns**
100+
101+
```jsonc
102+
{
103+
"server": {
104+
"name": "io.github.example/my-server",
105+
"version": "1.0.0",
106+
"description": "My MCP server",
107+
// ... other fields ...
108+
"_meta": {
109+
"io.modelcontextprotocol.registry/publisher-provided": {
110+
"tool": "ci-publisher",
111+
"version": "2.0.0"
112+
}
113+
}
114+
},
115+
"_meta": {
116+
// Registry-managed metadata at response level
117+
"status": "active",
118+
"publishedAt": "2024-01-15T10:30:00Z",
119+
"updatedAt": "2024-01-15T10:30:00Z",
120+
"isLatest": true
121+
}
122+
}
123+
```
124+
125+
Notice how the registry API response has **two** `_meta` fields:
126+
1. Inside the `server` object: Your publisher-provided metadata (preserved from server.json)
127+
2. At the response level: Registry-managed metadata (automatically added by the registry)
128+
129+
Registry-managed metadata cannot be set or overridden by publishers. See the [API documentation](../api/generic-registry-api.md) for the complete response structure.

0 commit comments

Comments
 (0)