haive.mcp.integration.aug_llm_mcp_extension¶
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.
Classes¶
Extended AugLLMConfig with MCP integration support. |
|
Model representing an MCP prompt template. |
|
Model representing an MCP resource. |
|
Wrapper to convert MCP tools to Haive-compatible tools. |
Functions¶
|
Factory function to create an MCP-enabled AugLLMConfig. |
|
Utility function to extend an existing AugLLMConfig with MCP support. |
Module Contents¶
- class haive.mcp.integration.aug_llm_mcp_extension.MCPAugLLMConfig¶
Bases:
haive.core.engine.aug_llm.AugLLMConfigExtended 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.
- enhance_system_prompt_with_mcp()¶
Enhance the system prompt with MCP information.
- Returns:
Enhanced system prompt including MCP resources and capabilities
- Return type:
- async get_mcp_resource_content(uri)¶
Fetch content for an MCP resource.
- Parameters:
uri (str) – Resource URI
- Returns:
Resource content
- Return type:
Any
- async setup_mcp()¶
Initialize MCP integration.
Sets up the MCP manager, discovers tools, loads resources, and configures prompts based on the MCP configuration.
- Return type:
None
- class haive.mcp.integration.aug_llm_mcp_extension.MCPPromptTemplate(/, **data)¶
Bases:
pydantic.BaseModelModel representing an MCP prompt template.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- class haive.mcp.integration.aug_llm_mcp_extension.MCPResource(/, **data)¶
Bases:
pydantic.BaseModelModel representing an MCP resource.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- class haive.mcp.integration.aug_llm_mcp_extension.MCPToolWrapper(**kwargs)¶
Bases:
langchain_core.tools.BaseToolWrapper 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.
Initialize the tool.
- Raises:
TypeError – If
args_schemais not a subclass of pydanticBaseModelor dict.- Parameters:
kwargs (Any)
- async haive.mcp.integration.aug_llm_mcp_extension.create_mcp_enabled_aug_config(name, model='gpt-4o-mini', mcp_servers=None, **kwargs)¶
Factory function to create an MCP-enabled AugLLMConfig.
- Parameters:
name (str) – Configuration name
model (str) – LLM model to use
mcp_servers (dict[str, haive.mcp.config.MCPServerConfig] | None) – Dictionary of MCP server configurations
**kwargs – Additional AugLLMConfig parameters
- Returns:
Initialized MCPAugLLMConfig with MCP integration
- Return type:
- haive.mcp.integration.aug_llm_mcp_extension.extend_aug_llm_config_for_mcp(base_config, mcp_config)¶
Utility function to extend an existing AugLLMConfig with MCP support.
- Parameters:
base_config (haive.core.engine.aug_llm.AugLLMConfig) – Existing AugLLMConfig instance
mcp_config (haive.mcp.config.MCPConfig) – MCP configuration to add
- Returns:
MCPAugLLMConfig with MCP support added
- Return type: