Skip to content

Commit f91193f

Browse files
committed
Add initial MCP spec implementation
Introduce MCP spec version '2025-03-26' with GitSpec integration and JSON schema parsing.
1 parent 1cdc89b commit f91193f

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

x/mcp/__init__.py

Whitespace-only changes.

x/mcp/spec.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""
2+
https://github.com/modelcontextprotocol/modelcontextprotocol/blob/9b15ff98b87d6a6a54055f4189feb22e750d9389/schema/2025-03-26/schema.json
3+
"""
4+
import os.path
5+
6+
from omdev.cache import data as dcache
7+
from omlish.formats import json
8+
from omlish.specs import jsonschema as jsch
9+
10+
11+
##
12+
13+
14+
MCP_SPEC_VERSION = '2025-03-26'
15+
16+
MCP_SPEC_DATA = dcache.GitSpec(
17+
'https://github.com/modelcontextprotocol/modelcontextprotocol',
18+
rev='9b15ff98b87d6a6a54055f4189feb22e750d9389',
19+
subtrees=[
20+
f'schema/{MCP_SPEC_VERSION}/schema.json',
21+
],
22+
)
23+
24+
25+
def _main() -> None:
26+
spec_dir = dcache.default().get(MCP_SPEC_DATA)
27+
28+
with open(os.path.join(spec_dir, 'schema', MCP_SPEC_VERSION, 'schema.json')) as f:
29+
spec_content = json.load(f)
30+
31+
spec_jsch = jsch.parse_keywords(spec_content)
32+
33+
print(json.dumps_pretty(jsch.render_keywords(spec_jsch)))
34+
35+
36+
if __name__ == '__main__':
37+
_main()

0 commit comments

Comments
 (0)