Private
Public Access
0
0
Files
manual_slop/tests/test_external_mcp.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

57 lines
1.5 KiB
Python

import asyncio
import json
import sys
import pytest
from src import mcp_client
from src import models
from src.mcp_client import MCPServerConfig
@pytest.mark.asyncio
async def test_external_mcp_real_process():
manager = mcp_client.ExternalMCPManager()
# Use our mock script
mock_script = "scripts/mock_mcp_server.py"
config = MCPServerConfig(
name="real-mock",
command="python",
args=[mock_script]
)
await manager.add_server(config)
try:
tools = manager.get_all_tools()
assert "echo" in tools
assert tools["echo"]["server"] == "real-mock"
result = await manager.async_dispatch("echo", {"hello": "world"})
assert "ECHO: {'hello': 'world'}" in result
finally:
await manager.stop_all()
@pytest.mark.asyncio
async def test_get_tool_schemas_includes_external():
manager = mcp_client.get_external_mcp_manager()
# Reset manager
await manager.stop_all()
mock_script = "scripts/mock_mcp_server.py"
config = MCPServerConfig(
name="test-server",
command="python",
args=[mock_script]
)
await manager.add_server(config)
try:
schemas = mcp_client.get_tool_schemas()
echo_schema = next((s for s in schemas if s["name"] == "echo"), None)
assert echo_schema is not None
assert echo_schema["description"] == "Echo input"
assert echo_schema["parameters"] == {"type": "object"}
finally:
await manager.stop_all()