Skip to main content
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 supports openai, anthropic, google, and groq provider strings. Install the matching LangChain package and set the provider API key in the environment.
Pass llmConfig.apiKey when you cannot use environment variables.

Use explicit mode

Explicit mode accepts any LangChain-compatible chat model. Use it for custom model setup, provider-specific options, callbacks, or models not supported by simplified mode.

OpenAI

Anthropic

Google Gemini

Groq

Verify provider support

Before wiring a model into a production workflow, run one prompt that requires a tool call. If the model cannot call tools, the agent will not be able to use MCP tools even if the client connection succeeds. For more providers, use a LangChain chat model that supports tool calling and pass it through explicit mode. See the LangChain JavaScript chat model integrations.

Next steps