mcp.integration.aug_llm_mcp_extension ===================================== .. py:module:: mcp.integration.aug_llm_mcp_extension .. autoapi-nested-parse:: Extension module to add MCP support to AugLLMConfig. This module provides utilities and mixins to enhance AugLLMConfig with MCP integration capabilities, allowing seamless use of MCP tools, resources, and prompts within the Haive agent framework. Attributes ---------- .. autoapisummary:: mcp.integration.aug_llm_mcp_extension.logger Classes ------- .. autoapisummary:: mcp.integration.aug_llm_mcp_extension.MCPAugLLMConfig mcp.integration.aug_llm_mcp_extension.MCPPromptTemplate mcp.integration.aug_llm_mcp_extension.MCPResource mcp.integration.aug_llm_mcp_extension.MCPToolWrapper Functions --------- .. autoapisummary:: mcp.integration.aug_llm_mcp_extension.create_mcp_enabled_aug_config mcp.integration.aug_llm_mcp_extension.extend_aug_llm_config_for_mcp Module Contents --------------- .. py:class:: MCPAugLLMConfig Bases: :py:obj:`haive.core.engine.aug_llm.AugLLMConfig` Extended AugLLMConfig with MCP integration support. This class extends the base AugLLMConfig to add MCP-specific fields and functionality, enabling agents to use MCP servers for tools, resources, and prompts. .. py:method:: enhance_system_prompt_with_mcp() -> str Enhance the system prompt with MCP information. :returns: Enhanced system prompt including MCP resources and capabilities .. py:method:: get_mcp_resource_content(uri: str) -> Any :async: Fetch content for an MCP resource. :param uri: Resource URI :returns: Resource content .. py:method:: setup_mcp() -> None :async: Initialize MCP integration. Sets up the MCP manager, discovers tools, loads resources, and configures prompts based on the MCP configuration. .. py:attribute:: auto_discover_mcp_tools :type: bool :value: None .. py:attribute:: inject_mcp_resources :type: bool :value: None .. py:attribute:: mcp_config :type: haive.mcp.config.MCPConfig | None :value: None .. py:attribute:: mcp_manager :type: haive.mcp.manager.MCPManager | None :value: None .. py:attribute:: mcp_prompts :type: dict[str, MCPPromptTemplate] | None :value: None .. py:attribute:: mcp_resources :type: list[MCPResource] | None :value: None .. py:attribute:: use_mcp_prompts :type: bool :value: None .. py:class:: MCPPromptTemplate(/, **data: Any) Bases: :py:obj:`pydantic.BaseModel` Model representing an MCP prompt template. .. py:attribute:: arguments :type: list[dict[str, Any]] :value: None .. py:attribute:: description :type: str :value: None .. py:attribute:: name :type: str :value: None .. py:attribute:: template :type: str :value: None .. py:class:: MCPResource(/, **data: Any) Bases: :py:obj:`pydantic.BaseModel` Model representing an MCP resource. .. py:attribute:: content :type: Any | None :value: None .. py:attribute:: description :type: str :value: None .. py:attribute:: mime_type :type: str :value: None .. py:attribute:: name :type: str :value: None .. py:attribute:: uri :type: str :value: None .. py:class:: MCPToolWrapper(**kwargs: Any) Bases: :py:obj:`langchain_core.tools.BaseTool` Wrapper to convert MCP tools to Haive-compatible tools. This wrapper allows MCP tools to be used seamlessly within the Haive framework by adapting their interface to match BaseTool expectations. .. py:attribute:: description :type: str Used to tell the model how/when/why to use the tool. You can provide few-shot examples as a part of the description. .. py:attribute:: mcp_client :type: Any .. py:attribute:: mcp_tool :type: dict[str, Any] .. py:attribute:: name :type: str The unique name of the tool that clearly communicates its purpose. .. py:function:: create_mcp_enabled_aug_config(name: str, model: str = 'gpt-4o-mini', mcp_servers: dict[str, haive.mcp.config.MCPServerConfig] | None = None, **kwargs) -> MCPAugLLMConfig :async: Factory function to create an MCP-enabled AugLLMConfig. :param name: Configuration name :param model: LLM model to use :param mcp_servers: Dictionary of MCP server configurations :param \*\*kwargs: Additional AugLLMConfig parameters :returns: Initialized MCPAugLLMConfig with MCP integration .. py:function:: extend_aug_llm_config_for_mcp(base_config: haive.core.engine.aug_llm.AugLLMConfig, mcp_config: haive.mcp.config.MCPConfig) -> MCPAugLLMConfig Utility function to extend an existing AugLLMConfig with MCP support. :param base_config: Existing AugLLMConfig instance :param mcp_config: MCP configuration to add :returns: MCPAugLLMConfig with MCP support added .. py:data:: logger