- add Docker deployment for independent jarca-ledger container - enable FastMCP streamable-http runtime configuration - document dcy-013, REQ-019, and BAT-015 verification evidence - update structure/runtime baselines and deployment runbook
47 lines
1.6 KiB
Python
47 lines
1.6 KiB
Python
from __future__ import annotations
|
|
|
|
import importlib
|
|
|
|
|
|
def test_mcp_runtime_config_defaults_to_stdio(monkeypatch):
|
|
monkeypatch.delenv("JARCA_MCP_TRANSPORT", raising=False)
|
|
monkeypatch.delenv("JARCA_MCP_HOST", raising=False)
|
|
monkeypatch.delenv("JARCA_MCP_PORT", raising=False)
|
|
monkeypatch.delenv("JARCA_MCP_STREAMABLE_HTTP_PATH", raising=False)
|
|
|
|
server = importlib.import_module("jarca_ledger_mcp.adapters.mcp.server")
|
|
config = server.get_mcp_runtime_config()
|
|
|
|
assert config.transport == "stdio"
|
|
assert config.host == "127.0.0.1"
|
|
assert config.port == 8000
|
|
assert config.streamable_http_path == "/mcp"
|
|
|
|
|
|
def test_mcp_runtime_config_accepts_streamable_http_env(monkeypatch):
|
|
monkeypatch.setenv("JARCA_MCP_TRANSPORT", "streamable-http")
|
|
monkeypatch.setenv("JARCA_MCP_HOST", "0.0.0.0")
|
|
monkeypatch.setenv("JARCA_MCP_PORT", "8765")
|
|
monkeypatch.setenv("JARCA_MCP_STREAMABLE_HTTP_PATH", "/ledger-mcp")
|
|
|
|
server = importlib.import_module("jarca_ledger_mcp.adapters.mcp.server")
|
|
config = server.get_mcp_runtime_config()
|
|
|
|
assert config.transport == "streamable-http"
|
|
assert config.host == "0.0.0.0"
|
|
assert config.port == 8765
|
|
assert config.streamable_http_path == "/ledger-mcp"
|
|
|
|
|
|
def test_mcp_runtime_config_rejects_invalid_transport(monkeypatch):
|
|
monkeypatch.setenv("JARCA_MCP_TRANSPORT", "websocket")
|
|
|
|
server = importlib.import_module("jarca_ledger_mcp.adapters.mcp.server")
|
|
|
|
try:
|
|
server.get_mcp_runtime_config()
|
|
except ValueError as exc:
|
|
assert "JARCA_MCP_TRANSPORT" in str(exc)
|
|
else:
|
|
raise AssertionError("invalid MCP transport should be rejected")
|