-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
complexity:averageModerate effort, some design neededModerate effort, some design neededphase:executionRouter, driversRouter, driverspriority:highCore functionalityCore functionalitysize:MMedium change, 50 to 200 linesMedium change, 50 to 200 linestype:featureNew functionalityNew functionality
Milestone
Description
Parent: #41 | Split: stdio transport + auto-discovery
Problem
This is part 1 of #41 (MCP Driver). It covers the stdio transport — connecting to local MCP servers via subprocess — and the auto-discovery mechanism that converts MCP tools/list results into kernel Capability objects.
Proposed Change
1. MCPDriver core + stdio transport
class MCPDriver:
"""Driver that connects to an MCP server and executes tool calls."""
async def execute(self, operation: str, params: dict, constraints: dict) -> Any:
"""Map operation → tools/call, apply constraints, return result."""- stdio transport: Connect to local MCP servers via
mcp.client.stdio.stdio_client. - Factory method:
MCPDriver.from_stdio(command, args). - Async context manager for connection lifecycle.
2. Auto-discovery
MCPDriver.discover() -> list[Capability]: Calltools/list, convert each MCP tool to aCapability.capability_id= tool name,descriptionfrom MCP tool,safety_class=READ(overridable).
3. Response handling
- Convert MCP
CallToolResultcontent blocks to dicts for the firewall. - Handle
isErrorby raisingDriverError.
Acceptance Criteria
-
MCPDriver.from_stdio()connects to a local MCP server process -
discover()converts MCP tools toCapabilityobjects with correct metadata -
execute()calls MCP tools and returns results through the firewall pipeline - Error responses raise
DriverErrorwith descriptive message - Integration test with mock MCP server (FastMCP) exercises full pipeline
-
mcp>=1.0added as optional dependency - Graceful
ImportErrorwhenmcppackage not installed
Affected Files
src/agent_kernel/drivers/mcp.py(new)src/agent_kernel/drivers/__init__.py(export)tests/test_drivers.py(integration tests)pyproject.toml(optional dep)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
complexity:averageModerate effort, some design neededModerate effort, some design neededphase:executionRouter, driversRouter, driverspriority:highCore functionalityCore functionalitysize:MMedium change, 50 to 200 linesMedium change, 50 to 200 linestype:featureNew functionalityNew functionality