Successfully integrated Model Context Protocol (MCP) support into the haive-dataflow package, enabling seamless discovery, registration, and management of MCP servers and their capabilities.
- Added comprehensive MCP models to
registry/models.py:MCPTransport- Enum for transport types (stdio, http, sse)MCPServerConfig- Server configuration modelMCPToolDefinition- Tool definition modelMCPResourceDefinition- Resource definition modelMCPPromptDefinition- Prompt template modelMCPServerHealth- Health monitoring model
- Added MCP entity types to the registry system
- Comprehensive MCP server discovery from multiple sources:
- npm packages (
@modelcontextprotocol/*) - PyPI packages (
mcp-*) - GitHub repositories
- Local haive-mcp downloaded servers
- npm packages (
- Async discovery with proper error handling
- Integration with registry system for automatic registration
MCPClient- Main client for managing MCP server connectionsMCPToolProvider- Provider for registering MCP tools in dataflowMCPServerAdapter- Adapter for individual server management- Integration with LangChain MCP adapters for tool loading
- Support for multiple transport types
MCPHealthMonitor- Comprehensive health monitoring serviceMCPHealthChecker- Individual server health checking- Automatic recovery attempts for failed servers
- Performance metrics tracking
- MCP servers can be discovered and registered in the dataflow registry
- Full integration with existing discovery mechanisms
- Support for querying MCP servers by type
- Added
mcp ^1.10.1for official MCP SDK support - Added
langchain-mcp-adapters ^0.1.0for LangChain integration
Created comprehensive tests in haive-mcp/tests/:
test_mcp_models.py- Tests for all MCP model typestest_mcp_integration.py- Integration tests with registry
from haive.dataflow import registry_system, MCPServerConfig, MCPTransport
from haive.dataflow.mcp import MCPClient
# Register an MCP server
config = MCPServerConfig(
name="filesystem-server",
transport=MCPTransport.STDIO,
command="mcp-filesystem",
capabilities=["read", "write"]
)
# Create MCP client
client = MCPClient(registry_system)
await client.initialize_from_registry()
# Get available tools
tools = await client.get_available_tools()
# Execute a tool
result = await client.execute_tool("read_file", {"path": "/path/to/file"})- Create REST API endpoints for MCP functionality
- Add MCP server management UI
- Implement automatic MCP server installation
- Add more comprehensive health monitoring
- Create documentation for end users
✅ Core MCP integration is complete and functional ✅ All tests passing ✅ Ready for API endpoint development