MCPAgent runs through LangChain chat models. You can either pass a "provider/model" string and let the agent create the model, or pass an existing LangChain chat model instance.
The model must support tool calling. Structured output and streaming are optional, but they are required for the corresponding MCPAgent features to work well.
Use simplified mode
Simplified mode supportsopenai, anthropic, google, and groq provider strings. Install the matching LangChain package and set the provider API key in the environment.
| Provider string | Package | API key |
|---|---|---|
openai/model | @langchain/openai | OPENAI_API_KEY |
anthropic/model | @langchain/anthropic | ANTHROPIC_API_KEY |
google/model | @langchain/google-genai | GOOGLE_API_KEY or GOOGLE_GENERATIVE_AI_API_KEY |
groq/model | @langchain/groq | GROQ_API_KEY |
llmConfig.apiKey when you cannot use environment variables.