Skip to main content

MCPAgent

A specialized agent designed to interact with MCP registries. The MCPAgent enhances a base ChatAgent by integrating MCP tools from various registries for search capabilities. Parameters:
  • system_message (Optional[str]): The system message for the chat agent. (default: :str:"You are an assistant with search capabilities using MCP tools.")
  • model (BaseModelBackend): The model backend to use for generating responses. (default: :obj:ModelPlatformType.DEFAULT with ModelType.DEFAULT)
  • registry_configs (List[BaseMCPRegistryConfig]): List of registry configurations (default: :obj:None)
  • local_config (Optional[Dict[str, Any]]): The local configuration for the MCP agent. (default: :obj:None)
  • local_config_path (Optional[str]): The path to the local configuration file for the MCP agent. (default: :obj:None)
  • function_calling_available (bool): Flag indicating whether the model is equipped with the function calling ability. (default: :obj:True) **kwargs: Inherited from ChatAgent

init

_initialize_mcp_toolkit

Initialize the MCP toolkit from the provided configuration.

add_registry

Add a new registry configuration to the agent. Parameters:
  • registry_config (BaseMCPRegistryConfig): The registry configuration to add.

step

Synchronous step function. Make sure MCP toolkit is connected before proceeding. Parameters:
  • input_message (Union[BaseMessage, str]): The input message. *args: Additional arguments. **kwargs: Additional keyword arguments.
Returns: ChatAgentResponse: The response from the agent.