Skip to content

Commit f2383c3

Browse files
authored
Extend MCP schemas to support resources (#874)
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent 02ef2bf commit f2383c3

115 files changed

Lines changed: 14771 additions & 5948 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

enterprise/e2e/html/hurl/list.all.hurl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ header "Last-Modified" exists
1212
jsonpath "$.path" == "/"
1313
jsonpath "$.url" == "{{base}}"
1414
jsonpath "$.breadcrumb" count == 0
15-
jsonpath "$.schemas" == 23
15+
jsonpath "$.schemas" == 29
1616
jsonpath "$.entries" count == 2
1717
jsonpath "$.entries[0].name" == "self"
1818
jsonpath "$.entries[0].title" == "Self"
1919
jsonpath "$.entries[0].description" == "The schemas that define the current version of this instance"
2020
jsonpath "$.entries[0].type" == "directory"
2121
jsonpath "$.entries[0].health" == 100
22-
jsonpath "$.entries[0].schemas" == 22
22+
jsonpath "$.entries[0].schemas" == 28
2323
jsonpath "$.entries[0].path" == "/self/"
2424
jsonpath "$.entries[1].name" == "test"
2525
jsonpath "$.entries[1].type" == "directory"

enterprise/e2e/html/hurl/mcp-lifecycle.all.hurl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ schema_path: header "Link" regex "<([^>]+)>"
2323
jsonpath "$.jsonrpc" == "2.0"
2424
jsonpath "$.id" == 1
2525
jsonpath "$.result.protocolVersion" == "2025-11-25"
26-
jsonpath "$.result.capabilities" isObject
27-
jsonpath "$.result.capabilities" isEmpty
26+
jsonpath "$.result.capabilities.resources" isObject
27+
jsonpath "$.result.capabilities.resources" isEmpty
2828
jsonpath "$.result.serverInfo.name" == "sourcemeta-one-enterprise"
2929
jsonpath "$.result.serverInfo.title" == "Sourcemeta One Enterprise"
3030
jsonpath "$.result.serverInfo.version" matches "^.+$"

enterprise/e2e/path/hurl/mcp-lifecycle.all.hurl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ schema_path: header "Link" regex "</v1/catalog([^>]+)>"
2323
jsonpath "$.jsonrpc" == "2.0"
2424
jsonpath "$.id" == 1
2525
jsonpath "$.result.protocolVersion" == "2025-11-25"
26-
jsonpath "$.result.capabilities" isObject
27-
jsonpath "$.result.capabilities" isEmpty
26+
jsonpath "$.result.capabilities.resources" isObject
27+
jsonpath "$.result.capabilities.resources" isEmpty
2828
jsonpath "$.result.serverInfo.name" == "sourcemeta-one-enterprise"
2929
jsonpath "$.result.serverInfo.title" == "Sourcemeta One Enterprise"
3030
jsonpath "$.result.serverInfo.version" matches "^.+$"

enterprise/server/action_mcp_v1.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ auto handle_initialize(const sourcemeta::core::JSON &request_json)
9595
auto result{sourcemeta::core::JSON::make_object()};
9696
result.assign("protocolVersion",
9797
sourcemeta::core::JSON{std::string{MCP_PROTOCOL_VERSION}});
98-
result.assign("capabilities", sourcemeta::core::JSON::make_object());
98+
auto capabilities{sourcemeta::core::JSON::make_object()};
99+
capabilities.assign("resources", sourcemeta::core::JSON::make_object());
100+
result.assign("capabilities", std::move(capabilities));
99101
auto server_info{sourcemeta::core::JSON::make_object()};
100102
server_info.assign("name",
101103
sourcemeta::core::JSON{std::string{MCP_SERVER_NAME}});

src/self/v1/schemas/mcp/error.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@
4747
"code": 4,
4848
"message": "Method not allowed"
4949
}
50+
},
51+
{
52+
"jsonrpc": "2.0",
53+
"id": 20,
54+
"error": {
55+
"code": -32002,
56+
"message": "Resource not found",
57+
"data": "https://example.com/v1/foo/v1/example"
58+
}
5059
}
5160
],
5261
"type": "object",
@@ -64,6 +73,22 @@
6473
{
6574
"$ref": "#/$defs/reserved"
6675
},
76+
{
77+
"type": "object",
78+
"required": [ "code", "message", "data" ],
79+
"properties": {
80+
"code": {
81+
"const": -32002
82+
},
83+
"message": {
84+
"const": "Resource not found"
85+
},
86+
"data": {
87+
"type": "string"
88+
}
89+
},
90+
"additionalProperties": false
91+
},
6792
{
6893
"type": "object",
6994
"required": [ "code", "message", "data" ],

src/self/v1/schemas/mcp/initialize/response.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
"id": 1,
99
"result": {
1010
"protocolVersion": "2025-11-25",
11-
"capabilities": {},
11+
"capabilities": {
12+
"resources": {}
13+
},
1214
"serverInfo": {
1315
"name": "sourcemeta-one-enterprise",
1416
"title": "Sourcemeta One Enterprise",
@@ -35,6 +37,13 @@
3537
},
3638
"capabilities": {
3739
"type": "object",
40+
"required": [ "resources" ],
41+
"properties": {
42+
"resources": {
43+
"type": "object",
44+
"additionalProperties": false
45+
}
46+
},
3847
"additionalProperties": false
3948
},
4049
"serverInfo": {

src/self/v1/schemas/mcp/request.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,24 @@
2424
"jsonrpc": "2.0",
2525
"id": 2,
2626
"method": "ping"
27+
},
28+
{
29+
"jsonrpc": "2.0",
30+
"id": 10,
31+
"method": "resources/list"
32+
},
33+
{
34+
"jsonrpc": "2.0",
35+
"id": 12,
36+
"method": "resources/templates/list"
37+
},
38+
{
39+
"jsonrpc": "2.0",
40+
"id": 20,
41+
"method": "resources/read",
42+
"params": {
43+
"uri": "https://example.com/v1/foo/v1/example"
44+
}
2745
}
2846
],
2947
"anyOf": [
@@ -38,6 +56,15 @@
3856
},
3957
{
4058
"$ref": "./ping/request.json"
59+
},
60+
{
61+
"$ref": "./resources/list/request.json"
62+
},
63+
{
64+
"$ref": "./resources/templates/list/request.json"
65+
},
66+
{
67+
"$ref": "./resources/read/request.json"
4168
}
4269
]
4370
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "Sourcemeta One MCP Resources List Request",
4+
"description": "Request from a client to list MCP resources",
5+
"examples": [
6+
{
7+
"jsonrpc": "2.0",
8+
"id": 10,
9+
"method": "resources/list"
10+
},
11+
{
12+
"jsonrpc": "2.0",
13+
"id": 11,
14+
"method": "resources/list",
15+
"params": {
16+
"cursor": "page-2"
17+
}
18+
}
19+
],
20+
"type": "object",
21+
"required": [ "jsonrpc", "id", "method" ],
22+
"properties": {
23+
"jsonrpc": {
24+
"const": "2.0"
25+
},
26+
"id": {
27+
"type": [ "string", "integer" ]
28+
},
29+
"method": {
30+
"const": "resources/list"
31+
},
32+
"params": {
33+
"type": "object",
34+
"properties": {
35+
"cursor": {
36+
"type": "string"
37+
},
38+
"_meta": {
39+
"type": "object",
40+
"properties": {
41+
"progressToken": {
42+
"type": [ "string", "integer" ]
43+
}
44+
}
45+
}
46+
}
47+
}
48+
}
49+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "Sourcemeta One MCP Resources List Response",
4+
"description": "Sourcemeta One's list of MCP resources",
5+
"examples": [
6+
{
7+
"jsonrpc": "2.0",
8+
"id": 10,
9+
"result": {
10+
"resources": []
11+
}
12+
}
13+
],
14+
"type": "object",
15+
"required": [ "jsonrpc", "id", "result" ],
16+
"properties": {
17+
"jsonrpc": {
18+
"const": "2.0"
19+
},
20+
"id": {
21+
"type": [ "string", "integer" ]
22+
},
23+
"result": {
24+
"type": "object",
25+
"required": [ "resources" ],
26+
"properties": {
27+
"resources": {
28+
"const": []
29+
}
30+
},
31+
"additionalProperties": false
32+
}
33+
},
34+
"additionalProperties": false
35+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "Sourcemeta One MCP Resources Read Request",
4+
"description": "Request from a client to read an MCP resource",
5+
"examples": [
6+
{
7+
"jsonrpc": "2.0",
8+
"id": 20,
9+
"method": "resources/read",
10+
"params": {
11+
"uri": "https://example.com/v1/foo/v1/example"
12+
}
13+
},
14+
{
15+
"jsonrpc": "2.0",
16+
"id": 21,
17+
"method": "resources/read",
18+
"params": {
19+
"uri": "https://example.com/v1/foo/v1/example?bundle=1"
20+
}
21+
}
22+
],
23+
"type": "object",
24+
"required": [ "jsonrpc", "id", "method", "params" ],
25+
"properties": {
26+
"jsonrpc": {
27+
"const": "2.0"
28+
},
29+
"id": {
30+
"type": [ "string", "integer" ]
31+
},
32+
"method": {
33+
"const": "resources/read"
34+
},
35+
"params": {
36+
"type": "object",
37+
"required": [ "uri" ],
38+
"properties": {
39+
"uri": {
40+
"$comment": "TODO: Use Format Assertion when supported on Blaze",
41+
"type": "string",
42+
"format": "uri"
43+
},
44+
"_meta": {
45+
"type": "object",
46+
"properties": {
47+
"progressToken": {
48+
"type": [ "string", "integer" ]
49+
}
50+
}
51+
}
52+
}
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)