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.
AttributesΒΆ
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 mcp.integration.aug_llm_mcp_extension.MCPAugLLMConfigΒΆ
Bases:
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.
- enhance_system_prompt_with_mcp() str ΒΆ
Enhance the system prompt with MCP information.
- Returns:
Enhanced system prompt including MCP resources and capabilities
- async get_mcp_resource_content(uri: str) Any ΒΆ
Fetch content for an MCP resource.
- Parameters:
uri β Resource URI
- Returns:
Resource content
- async setup_mcp() None ΒΆ
Initialize MCP integration.
Sets up the MCP manager, discovers tools, loads resources, and configures prompts based on the MCP configuration.
- mcp_config: haive.mcp.config.MCPConfig | None = NoneΒΆ
- mcp_prompts: dict[str, MCPPromptTemplate] | None = NoneΒΆ
- mcp_resources: list[MCPResource] | None = NoneΒΆ
- class mcp.integration.aug_llm_mcp_extension.MCPPromptTemplate(/, **data: Any)ΒΆ
Bases:
pydantic.BaseModel
Model representing an MCP prompt template.
- class mcp.integration.aug_llm_mcp_extension.MCPResource(/, **data: Any)ΒΆ
Bases:
pydantic.BaseModel
Model representing an MCP resource.
- class mcp.integration.aug_llm_mcp_extension.MCPToolWrapper(**kwargs: Any)ΒΆ
Bases:
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.
- description: 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.
- mcp_client: AnyΒΆ
- async mcp.integration.aug_llm_mcp_extension.create_mcp_enabled_aug_config(name: str, model: str = 'gpt-4o-mini', mcp_servers: dict[str, haive.mcp.config.MCPServerConfig] | None = None, **kwargs) MCPAugLLMConfig ΒΆ
Factory function to create an MCP-enabled AugLLMConfig.
- Parameters:
name β Configuration name
model β LLM model to use
mcp_servers β Dictionary of MCP server configurations
**kwargs β Additional AugLLMConfig parameters
- Returns:
Initialized MCPAugLLMConfig with MCP integration
- mcp.integration.aug_llm_mcp_extension.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.
- Parameters:
base_config β Existing AugLLMConfig instance
mcp_config β MCP configuration to add
- Returns:
MCPAugLLMConfig with MCP support added
- mcp.integration.aug_llm_mcp_extension.loggerΒΆ