dynamic_mcp_toolΒΆ

Dynamic MCP Discovery and Installation Tool.

This tool leverages the haive-mcp repository’s 992 server database to: 1. RAG search through MCP server documentation and metadata 2. Let agent pick the right server based on capabilities 3. Install it dynamically using FastMCP 4. Set up watch dog for server updates

Integrates with AugLLMConfig pattern and uses FastMCP for modern MCP server setup.

ClassesΒΆ

DynamicMCPTool

Tool for dynamic MCP server discovery, installation, and management.

MCPServerInstallRequest

Request to install an MCP server.

MCPServerInstallResult

Result of MCP server installation.

MCPServerListTool

Tool to list currently installed MCP servers.

FunctionsΒΆ

create_mcp_discovery_tools(...)

Create MCP discovery and management tools.

Module ContentsΒΆ

class dynamic_mcp_tool.DynamicMCPTool(engine: haive.core.engine.aug_llm.AugLLMConfig, **kwargs)ΒΆ

Bases: langchain_core.tools.BaseTool

Tool for dynamic MCP server discovery, installation, and management.

This tool: 1. Uses RAG to search the 992 MCP server database 2. Presents options to the user/agent 3. Installs selected servers using FastMCP 4. Returns ready-to-use MCP client configuration

args_schema: type[pydantic.BaseModel]ΒΆ

Pydantic model class to validate and parse the tool’s input arguments.

Args schema should be either:

  • A subclass of pydantic.BaseModel.

  • A subclass of pydantic.v1.BaseModel if accessing v1 namespace in pydantic 2

  • a JSON schema dict

description: str = Multiline-StringΒΆ
Show Value
"""
    Discover and install MCP servers dynamically based on capability requirements.

    Use this tool when you need to add new capabilities to your agent by finding and
    installing Model Context Protocol (MCP) servers. The tool searches through 992
    documented MCP servers, analyzes their capabilities, and can install them automatically.

    Examples:
    - "I need database access capabilities"
    - "Find servers that can work with GitHub"
    - "Install filesystem operations server"
    - "Get me weather data integration"
    """

Used to tell the model how/when/why to use the tool.

You can provide few-shot examples as a part of the description.

doc_loaderΒΆ
engineΒΆ
installed_servers: dict[str, dict]ΒΆ
name: str = 'dynamic_mcp_installer'ΒΆ

The unique name of the tool that clearly communicates its purpose.

class dynamic_mcp_tool.MCPServerInstallRequest(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Request to install an MCP server.

auto_install: bool = NoneΒΆ
capability_description: str = NoneΒΆ
max_servers: int = NoneΒΆ
use_fastmcp: bool = NoneΒΆ
class dynamic_mcp_tool.MCPServerInstallResult(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Result of MCP server installation.

error_message: str | None = NoneΒΆ
installation_path: strΒΆ
server_config: dict[str, Any]ΒΆ
server_name: strΒΆ
success: boolΒΆ
tools_available: list[str]ΒΆ
class dynamic_mcp_tool.MCPServerListTool(dynamic_mcp_tool: DynamicMCPTool, **kwargs)ΒΆ

Bases: langchain_core.tools.BaseTool

Tool to list currently installed MCP servers.

description: str = 'List all currently installed and available MCP servers'ΒΆ

Used to tell the model how/when/why to use the tool.

You can provide few-shot examples as a part of the description.

dynamic_mcp_toolΒΆ
name: str = 'list_mcp_servers'ΒΆ

The unique name of the tool that clearly communicates its purpose.

dynamic_mcp_tool.create_mcp_discovery_tools(engine: haive.core.engine.aug_llm.AugLLMConfig) list[langchain_core.tools.BaseTool]ΒΆ

Create MCP discovery and management tools.