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 integration

  • MCPServerConfig - Individual server configuration

  • MCPTransport - Transport protocol enumeration

AgentsΒΆ

  • MCPAgent - Basic MCP-enabled agent

  • IntelligentMCPAgent - Agent with automatic discovery

  • TransferableMCPAgent - Agent with tool sharing capabilities

ManagementΒΆ

  • MCPManager - Server lifecycle management

  • MCPHealthStatus - Health monitoring

  • MCPRegistrationResult - Registration status

UtilitiesΒΆ

SubmodulesΒΆ

AttributesΒΆ

Package ContentsΒΆ

mcp.IntelligentMCPAgent = NoneΒΆ
mcp.MCPBrowserPlugin = NoneΒΆ
mcp.MCPDocumentationLoader = NoneΒΆ
mcp.MCPHealthStatus = NoneΒΆ
mcp.MCPMixin = NoneΒΆ
mcp.MCPServerDiscovery = NoneΒΆ