Configuration files
Start with two YAML files at the root of your project:mcp_agent.config.yaml
Application configuration, MCP servers, logging, execution engine, model defaults
mcp_agent.secrets.yaml
API keys, OAuth credentials, and other secrets (gitignored)
Basic configuration
Here’s a minimal configuration:Execution Engine
Choose how your workflows execute:- asyncio
- Temporal
In-memory execution for development and simple deployments:Best for:
- Local development
- Simple agents
- Quick prototyping
Logging
Configure logging output and level:mcp_agent.config.yaml
MCP Servers
Define MCP servers your agents can connect to:mcp_agent.config.yaml
Model Providers
Configure your LLM provider. Many examples follow this layout—for instance, the basic finder agent sets OpenAI defaults exactly this way.- OpenAI
- Anthropic
- Azure OpenAI
- AWS Bedrock
mcp_agent.config.yaml
mcp_agent.secrets.yaml
OAuth configuration
Two places control OAuth behaviour:- Global OAuth settings (
settings.oauth) configure token storage and callback behaviour (loopback ports, preload timeouts, Redis support). - Per-server auth (
mcp.servers[].auth.oauth) specifies client credentials, scopes, and provider overrides.
mcp_agent.config.yaml
mcp_agent.secrets.yaml or environment variables. For concrete walkthroughs, study the OAuth basic agent and the interactive OAuth tool. The pre-authorize workflow example shows how to seed credentials before a background workflow runs.
Programmatic configuration
You can bypass file discovery by passing a fully-formedSettings object (or a path) to MCPApp. This is especially useful for tests and scripts that compose configuration dynamically.
Settings extends BaseSettings, environment variables still override any fields you set explicitly.
Configuration discovery
WhenMCPApp starts, it resolves settings in this order:
MCP_APP_SETTINGS_PRELOAD/MCP_APP_SETTINGS_PRELOAD_STRICT- Explicit
settingsargument passed toMCPApp mcp_agent.config.yaml(ormcp-agent.config.yaml) discovered in the working directory, parent directories,.mcp-agent/folders, or~/.mcp-agent/mcp_agent.secrets.yaml/mcp-agent.secrets.yamlmerged on top- Environment variables (including values from
.env, using__for nesting)
Environment Variables
You can reference environment variables in configuration:mcp_agent.config.yaml
Use environment variables for deployment-specific settings like endpoints and regions, while keeping model choices in the config file.
Project Structure
Recommended project layout:.gitignore:
