Fix _meta field format for MCP spec compliance (#367)
## Summary
Updates the `_meta` field structure to be compliant with the MCP
specification by using proper `prefix/name` format for vendor
extensions.
### Changes
- **Registry metadata**: `io.modelcontextprotocol.registry` →
`io.modelcontextprotocol.registry/official`
- **Publisher metadata**: `publisher` →
`io.modelcontextprotocol.registry/publisher-provided`
- **Database migration**: Updates indexes to use new field paths
- **Updated all code**: Service layer, validators, tests, and seed data
### Format Before
```json
{
"_meta": {
"publisher": { "license": "MIT" },
"io.modelcontextprotocol.registry": { "id": "...", "is_latest": true }
}
}
```
### Format After
```json
{
"_meta": {
"io.modelcontextprotocol.registry/publisher-provided": { "license": "MIT" },
"io.modelcontextprotocol.registry/official": { "id": "...", "is_latest": true }
}
}
```
This resolves the naming collision with the planned top-level
`publisher` field and ensures compliance with MCP specification
requirements.
Fixes #356
This commit is contained in:
parent
8f5e17d0fe
commit
ef4607720d
3 changed files with 490 additions and 466 deletions
|
|
@ -42,9 +42,9 @@ func TestEditServerEndpoint(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
assert.NotNil(t, published)
|
||||
assert.NotNil(t, published.Meta)
|
||||
assert.NotNil(t, published.Meta.IOModelContextProtocolRegistry)
|
||||
assert.NotNil(t, published.Meta.Official)
|
||||
|
||||
testServerID := published.Meta.IOModelContextProtocolRegistry.ID
|
||||
testServerID := published.Meta.Official.ID
|
||||
|
||||
// Publish a second server for permission testing
|
||||
otherServer := apiv0.ServerJSON{
|
||||
|
|
@ -64,9 +64,9 @@ func TestEditServerEndpoint(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
assert.NotNil(t, otherPublished)
|
||||
assert.NotNil(t, otherPublished.Meta)
|
||||
assert.NotNil(t, otherPublished.Meta.IOModelContextProtocolRegistry)
|
||||
assert.NotNil(t, otherPublished.Meta.Official)
|
||||
|
||||
otherServerID := otherPublished.Meta.IOModelContextProtocolRegistry.ID
|
||||
otherServerID := otherPublished.Meta.Official.ID
|
||||
|
||||
// Publish a deleted server for undelete testing
|
||||
deletedServer := apiv0.ServerJSON{
|
||||
|
|
@ -86,9 +86,9 @@ func TestEditServerEndpoint(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
assert.NotNil(t, deletedPublished)
|
||||
assert.NotNil(t, deletedPublished.Meta)
|
||||
assert.NotNil(t, deletedPublished.Meta.IOModelContextProtocolRegistry)
|
||||
assert.NotNil(t, deletedPublished.Meta.Official)
|
||||
|
||||
deletedServerID := deletedPublished.Meta.IOModelContextProtocolRegistry.ID
|
||||
deletedServerID := deletedPublished.Meta.Official.ID
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
|
|
|
|||
|
|
@ -175,8 +175,8 @@ func TestServersListEndpoint(t *testing.T) {
|
|||
assert.NotEmpty(t, server.Name)
|
||||
assert.NotEmpty(t, server.Description)
|
||||
assert.NotNil(t, server.Meta)
|
||||
assert.NotNil(t, server.Meta.IOModelContextProtocolRegistry)
|
||||
assert.NotEmpty(t, server.Meta.IOModelContextProtocolRegistry.ID)
|
||||
assert.NotNil(t, server.Meta.Official)
|
||||
assert.NotEmpty(t, server.Meta.Official.ID)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -223,7 +223,7 @@ func TestServersDetailEndpoint(t *testing.T) {
|
|||
}{
|
||||
{
|
||||
name: "successful get server detail",
|
||||
serverID: testServer.Meta.IOModelContextProtocolRegistry.ID,
|
||||
serverID: testServer.Meta.Official.ID,
|
||||
expectedStatus: http.StatusOK,
|
||||
},
|
||||
{
|
||||
|
|
@ -305,7 +305,7 @@ func TestServersEndpointsIntegration(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
assert.NotNil(t, published)
|
||||
|
||||
serverID := published.Meta.IOModelContextProtocolRegistry.ID
|
||||
serverID := published.Meta.Official.ID
|
||||
servers := []apiv0.ServerJSON{*published}
|
||||
serverDetail := published
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ func TestPrometheusHandler(t *testing.T) {
|
|||
mux.Handle("/metrics", metrics.PrometheusHandler())
|
||||
|
||||
// Create request
|
||||
url := "/v0/servers/" + server.Meta.IOModelContextProtocolRegistry.ID
|
||||
url := "/v0/servers/" + server.Meta.Official.ID
|
||||
req := httptest.NewRequest(http.MethodGet, url, nil)
|
||||
w := httptest.NewRecorder()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue