haive.mcp¶
Haive MCP - Dynamic Model Context Protocol Integration.
This package provides dynamic MCP (Model Context Protocol) integration for Haive agents, enabling them to discover and use external tools and resources at runtime.
Key Components¶
MCPManager: Central manager for MCP server lifecycle and tool management
MCPAgent: Production-ready agent with static MCP configuration
IntelligentMCPAgent: AI-powered agent with automatic server discovery
TransferableMCPAgent: Agent that can share tools with other agents
Quick Start¶
Basic MCP Agent Usage¶
from haive.mcp import MCPAgent, MCPConfig
from haive.core.engine import AugLLMConfig
# Create agent with MCP capabilities
agent = MCPAgent(
engine=AugLLMConfig(),
mcp_config=MCPConfig(
enabled=True,
servers={
"filesystem": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem"]
}
}
)
)
# Initialize and use
await agent.setup()
result = await agent.arun({"messages": [...]})
Dynamic Discovery with IntelligentMCPAgent¶
from haive.mcp import IntelligentMCPAgent
# Create agent with auto-discovery
agent = IntelligentMCPAgent(
engine=AugLLMConfig(),
auto_discover=True,
require_approval=True
)
# Agent will automatically find and install needed MCP servers
result = await agent.arun({
"messages": [{"role": "user", "content": "Search web and save to database"}]
})
Available Classes¶
Configuration¶
MCPConfig- Main configuration for MCP integrationMCPServerConfig- Individual server configurationMCPTransport- Transport protocol enumeration
Agents¶
MCPAgent- Basic MCP-enabled agentIntelligentMCPAgent- Agent with automatic discoveryTransferableMCPAgent- Agent with tool sharing capabilities
Management¶
MCPManager- Server lifecycle managementMCPHealthStatus- Health monitoringMCPRegistrationResult- Registration status
Utilities¶
MCPMixin- Add MCP capabilities to existing agentsMCPServerDiscovery- Discover available serversMCPDocumentationLoader- Load server documentation
Submodules¶
- haive.mcp.agents
- haive.mcp.cli
- haive.mcp.client
- haive.mcp.config
- haive.mcp.discovery
- haive.mcp.documentation
- haive.mcp.downloader
- haive.mcp.installer_service
- haive.mcp.installers
- haive.mcp.integration
- haive.mcp.manager
- haive.mcp.mixins
- haive.mcp.plugins
- haive.mcp.registry
- haive.mcp.self_query
- haive.mcp.servers
- haive.mcp.tools
- haive.mcp.tui
- haive.mcp.utils