Configure MCPAgent behavior and LLM integration
.env
file in your project root:llm
: Any LangChain-compatible language model (required)client
: The MCPClient instance (optional if connectors are provided)connectors
: List of connectors if not using client (optional)server_name
: Name of the server to use (optional)max_steps
: Maximum number of steps the agent can take (default: 5)auto_initialize
: Whether to initialize automatically (default: False)memory_enabled
: Whether to enable memory (default: True)system_prompt
: Custom system prompt (optional)system_prompt_template
: Custom system prompt template (optional)additional_instructions
: Additional instructions for the agent (optional)disallowed_tools
: List of tool names that should not be available to the agent (optional)use_server_manager
: Enable dynamic server selection (default: False)BaseAdapter
class provides a unified interface for converting MCP tools to various framework formats, with LangChainAdapter
being the most commonly used implementation.
use_server_manager=True
when creating the MCPAgent
.
server_name
for most use casesmax_steps
to prevent runaway executiondisallowed_tools
for securitymax_steps
or agent timeout values