Skip to main content
MCPAgent supports OpenAI, Anthropic, Google, OpenRouter, Ollama, and OpenAI-compatible endpoints. Configure a provider with a "provider/model" string or a ProviderConfig.

Choose a provider

Configure a provider string

Set the provider’s environment variable before starting the process. The agent resolves the key when it initializes.
A successful run prints scripts found through the filesystem MCP server. The string parser accepts model names that contain /. For example, openrouter/openai/gpt-4o selects the openrouter provider and passes openai/gpt-4o as the model name.

Connect an OpenAI-compatible endpoint

Use openai-compatible for an endpoint that implements OpenAI chat-completions semantics. Supply the full API base URL and any required headers.
Verify that the selected model supports tool calling. A reachable text-only model cannot use MCP tools.

Handle configuration errors

Initialization throws when:
  • a provider string is not in provider/model form;
  • the provider prefix is unsupported;
  • a required API key is missing; or
  • no model driver can be created.
Keep provider-specific tuning in llmConfig or ProviderConfig. See the MCPAgent API reference for the complete option types.

Next steps