Private
Public Access
0
0
Files
manual_slop/tests/test_mcp_config.py
T
ed b15955c80e chore: stage remaining post-de-cruft fixes (src/test artifacts)
Staged-but-not-yet-fixed file artifacts from the post_module_taxonomy_de_cruft
followup. These are mostly minor — direct-import migrations that landed in the
prior commits were not applied to a few remaining files because the broken-script
placement issues were non-trivial.

For Tier 1 followup:
- src/commands.py — unused 'from src import models' removed by migration
- src/mcp_client.py — verified to no longer have the circular self-import
- src/models.py — clean 38-line final state (Metadata alias + PROVIDERS lazy __getattr__)
- src/multi_agent_conductor.py, src/project_manager.py, src/rag_engine.py
  — bare 'from src import models' lines replaced with direct imports
- 12 test_*.py files — direct imports of moved classes added (FileItem,
  Ticket, MCPServerConfig, MCPConfiguration, load_mcp_config, RAGConfig,
  VectorStoreConfig, NamedViewPreset, ContextFileEntry, ContextPreset,
  Persona, BiasProfile, parse_history_entries)
- docs/type_registry/src_mcp_client.md — regenerated via type_registry script

No production behavior changes here. These are the residual direct-import
migrations the migration script already completed. Some are tracked in the
end_of_session report for Tier 1 followup.
2026-06-26 23:18:27 -04:00

55 lines
1.6 KiB
Python

import os
import json
import pytest
from src import models
from src.mcp_client import MCPServerConfig, MCPConfiguration, load_mcp_config
def test_mcp_server_config_to_from_dict():
data = {
"command": "node",
"args": ["server.js"],
"auto_start": True
}
cfg = MCPServerConfig.from_dict("test-server", data)
assert cfg.name == "test-server"
assert cfg.command == "node"
assert cfg.args == ["server.js"]
assert cfg.auto_start is True
assert cfg.to_dict() == data
def test_mcp_configuration_to_from_dict():
data = {
"mcpServers": {
"server1": {
"command": "python",
"args": ["-m", "mcp_server"],
"auto_start": False
},
"server2": {
"url": "http://localhost:8080/sse",
"auto_start": True
}
}
}
cfg = MCPConfiguration.from_dict(data)
assert len(cfg.mcpServers) == 2
assert cfg.mcpServers["server1"].command == "python"
assert cfg.mcpServers["server2"].url == "http://localhost:8080/sse"
assert cfg.to_dict() == data
def test_load_mcp_config(tmp_path):
config_file = tmp_path / "mcp_config.json"
data = {
"mcpServers": {
"test": {"command": "echo", "args": ["hello"]}
}
}
config_file.write_text(json.dumps(data))
# We'll need a way to load from a specific path
# Maybe load_mcp_config(path)
cfg = load_mcp_config(str(config_file))
assert "test" in cfg.mcpServers
assert cfg.mcpServers["test"].command == "echo"