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ΒΆ

MCPAugLLMConfig

Extended AugLLMConfig with MCP integration support.

MCPPromptTemplate

Model representing an MCP prompt template.

MCPResource

Model representing an MCP resource.

MCPToolWrapper

Wrapper to convert MCP tools to Haive-compatible tools.

FunctionsΒΆ

create_mcp_enabled_aug_config(β†’ MCPAugLLMConfig)

Factory function to create an MCP-enabled AugLLMConfig.

extend_aug_llm_config_for_mcp(β†’ MCPAugLLMConfig)

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.

auto_discover_mcp_tools: bool = NoneΒΆ
inject_mcp_resources: bool = NoneΒΆ
mcp_config: haive.mcp.config.MCPConfig | None = NoneΒΆ
mcp_manager: haive.mcp.manager.MCPManager | None = NoneΒΆ
mcp_prompts: dict[str, MCPPromptTemplate] | None = NoneΒΆ
mcp_resources: list[MCPResource] | None = NoneΒΆ
use_mcp_prompts: bool = NoneΒΆ
class mcp.integration.aug_llm_mcp_extension.MCPPromptTemplate(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Model representing an MCP prompt template.

arguments: list[dict[str, Any]] = NoneΒΆ
description: str = NoneΒΆ
name: str = NoneΒΆ
template: str = NoneΒΆ
class mcp.integration.aug_llm_mcp_extension.MCPResource(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Model representing an MCP resource.

content: Any | None = NoneΒΆ
description: str = NoneΒΆ
mime_type: str = NoneΒΆ
name: str = NoneΒΆ
uri: str = NoneΒΆ
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ΒΆ
mcp_tool: dict[str, Any]ΒΆ
name: strΒΆ

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

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ΒΆ