mirror of
https://github.com/semantica-agi/semantica.git
synced 2026-08-29 04:26:20 +00:00
semantica/mcp_server/__init__.py was fixed to stop hardcoding 0.4.0, but the separate top-level mcp/ package (run via `python -m mcp.server`, documented in mcp/__init__.py as a supported way to configure Claude Desktop/Windsurf/etc. from a source checkout) still hardcoded 0.4.0 in three places: mcp/__init__.py, mcp/server.py, and mcp/resources/registry.py. Reuses semantica.__version__ directly, matching the pattern just adopted in semantica/mcp_server/__init__.py, so both implementations stay in sync with the package version going forward.
55 lines
1.9 KiB
Python
55 lines
1.9 KiB
Python
"""Regression tests for version reporting in the top-level `mcp` package
|
|
(issue #863).
|
|
|
|
Covers the same stale-version bug as `test_mcp_server_version.py` for the
|
|
standalone `mcp/` server (run via `python -m mcp.server`), which is a
|
|
separate implementation from `semantica.mcp_server` and was not covered
|
|
by that fix. `semantica.__version__` is the authoritative package
|
|
version (see semantica/mcp_server/__init__.py), so all three surfaces
|
|
are asserted against it directly.
|
|
"""
|
|
|
|
import json
|
|
import os
|
|
import sys
|
|
import unittest
|
|
|
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
|
|
|
import mcp
|
|
import semantica
|
|
from mcp.resources.registry import _read_schema_info
|
|
from mcp.server import _handle_initialize
|
|
|
|
_EXPECTED = semantica.__version__
|
|
|
|
|
|
class TestMCPPackageVersion(unittest.TestCase):
|
|
def test_package_version_matches_authoritative_source(self):
|
|
self.assertEqual(mcp.__version__, _EXPECTED)
|
|
|
|
def test_package_version_is_not_stale_literal(self):
|
|
self.assertNotEqual(mcp.__version__, "0.4.0")
|
|
|
|
def test_initialize_server_info_version_matches_package(self):
|
|
response = _handle_initialize(1, {})
|
|
self.assertEqual(response["result"]["serverInfo"]["version"], _EXPECTED)
|
|
|
|
def test_initialize_server_info_version_is_not_stale_literal(self):
|
|
response = _handle_initialize(1, {})
|
|
self.assertNotEqual(response["result"]["serverInfo"]["version"], "0.4.0")
|
|
|
|
def test_schema_info_resource_version_matches_package(self):
|
|
resource = _read_schema_info("semantica://schema/info")
|
|
info = json.loads(resource["text"])
|
|
self.assertEqual(info["version"], _EXPECTED)
|
|
|
|
def test_schema_info_resource_version_is_not_stale_literal(self):
|
|
resource = _read_schema_info("semantica://schema/info")
|
|
info = json.loads(resource["text"])
|
|
self.assertNotEqual(info["version"], "0.4.0")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|