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ΒΆ
AttributesΒΆ
Package ContentsΒΆ
- mcp.IntelligentMCPAgent = NoneΒΆ
- mcp.MCPBrowserPlugin = NoneΒΆ
- mcp.MCPDocumentationLoader = NoneΒΆ
- mcp.MCPHealthStatus = NoneΒΆ
- mcp.MCPMixin = NoneΒΆ
- mcp.MCPServerDiscovery = NoneΒΆ