Configuration
Learn how to configure mcp-agent using configuration files to control logging, execution, model providers, and MCP server connections.Configuration Files
mcp-agent uses two configuration files:mcp_agent.config.yaml
Application settings, logging, and server configurations
mcp_agent.secrets.yaml
API keys and sensitive information (should be gitignored)
Basic Configuration
- YAML Configuration (Recommended)
- Programmatic Configuration
1
Create config file
Create
mcp_agent.config.yaml
in your project root:2
Create secrets file
Create
mcp_agent.secrets.yaml
for sensitive data:Add
mcp_agent.secrets.yaml
to your .gitignore
file to avoid committing API keys.3
Load configuration
mcp-agent automatically loads these files when you create an
MCPApp
:OAuth Configuration
MCP Agent exposes two complementary OAuth configuration blocks:authorization
describes how the MCP Agent server validates inbound bearer tokens and publishes protected resource metadata.oauth
configures delegated authorization when the agent connects to downstream MCP servers.
- When
authorization.enabled
is true the MCP server advertises/.well-known/oauth-protected-resource
and enforces bearer tokens using the provided introspection or JWKS configuration. oauth
enables delegated authorization flows; the default in-memory token store is ideal for local development while Redis is recommended for production clusters.- Downstream servers opt into OAuth via
mcp.servers.<name>.auth.oauth
. Supplying aclient_id
/client_secret
allows immediate usage; support for dynamic client registration is planned as a follow-up.
Configuration Reference
Execution Engine
Controls how mcp-agent executes workflows:- asyncio (Default)
- temporal
Logging Configuration
Console Logging
Console Logging
File Logging
File Logging
Both Console and File
Both Console and File
Dynamic Log Files
Dynamic Log Files
MCP Server Configuration
Define MCP servers your agents can connect to:Common MCP Servers
Fetch Server
Filesystem Server
SQLite Server
Git Server
Model Provider Configuration
OpenAI
Anthropic
Azure OpenAI
Configure Azure OpenAI with different endpoint types:- Azure OpenAI Endpoint
- Azure AI Inference Endpoint
AWS Bedrock
Google Gemini
Configure Google Gemini with different authentication methods:- Gemini API
- Vertex AI
Use the Gemini Developer API with your API key. Set
vertexai: false
(default).Groq
Groq provides fast inference for open-source models through an OpenAI-compatible API:Groq uses OpenAI-compatible endpoints. Popular models include
llama-3.3-70b-versatile
, llama-4-maverick-17b-128e-instruct
, and kimi-k2-instruct
.Together AI
Together AI provides access to various open-source models through an OpenAI-compatible API:Ollama
Ollama provides local model inference with OpenAI-compatible endpoints:Ollama runs locally and doesn’t require a real API key. The framework includes specialized
OllamaAugmentedLLM
for better integration.Advanced Configuration
Temporal Configuration
Configure Temporal for durable workflow execution:Observability Configuration
Enable tracing with OpenTelemetry:MCP Server Transport Options
mcp-agent supports multiple MCP server transport mechanisms:- stdio (Default)
- Server-Sent Events (SSE)
- Streamable HTTP
- WebSocket
MCP Server Advanced Configuration
Complete configuration options for MCP servers:Environment Variable Substitution
mcp-agent supports environment variable substitution using${VARIABLE_NAME}
syntax:
Use
${VAR:-default}
syntax to provide fallback values when environment variables are not set.Secrets Management
Keep sensitive configuration in separate secrets files:- Separate Secrets File
- Environment Variables Only
- Cloud Secrets
Create
mcp_agent.secrets.yaml
alongside your config:Always add
mcp_agent.secrets.yaml
to your .gitignore
file.Subagent Configuration
Load subagents from Claude Code format or other sources:Schema Validation
mcp-agent validates configuration against a schema. Check the configuration schema for all available options.Deployment Scenarios
Development Environment
Local development configuration:Production Environment
Production deployment with Temporal and monitoring:Testing Environment
Configuration for automated testing:Configuration Examples
Basic Web Agent
File Processing Agent
Multi-Provider Agent
Enterprise Configuration with Authentication
Multi-Environment Configuration
Use different configurations for different environments:- Development
- Staging
- Production
Configuration Schema Reference
The complete configuration schema is available at mcp-agent.config.schema.json.Core Settings Structure
Provider Settings Reference
OpenAI Settings
OpenAI Settings
Anthropic Settings
Anthropic Settings
Azure Settings
Azure Settings
Google Settings
Google Settings
Troubleshooting
Configuration Not Found
Configuration Not Found
Issue:
mcp_agent.config.yaml
not foundSolutions:- Ensure configuration files are in your project directory
- Check search paths: current directory,
.mcp-agent/
subdirectory, home directory~/.mcp-agent/
- Use absolute path with
MCPApp(config_path="/path/to/config.yaml")
Schema Validation Errors
Schema Validation Errors
Issue: YAML validation or parsing errorsSolutions:
- Validate YAML syntax using online validators
- Check indentation (use spaces, not tabs)
- Verify all required fields are present
- Check the configuration schema
- Use quotes around string values with special characters
Environment Variable Substitution Errors
Environment Variable Substitution Errors
Issue: Variables like
${API_KEY}
not resolvedSolutions:- Verify environment variables are set:
echo $API_KEY
- Use defaults:
${API_KEY:-default_value}
- Check variable names match exactly (case-sensitive)
- Escape literal
$
with$$
if needed
MCP Server Connection Errors
MCP Server Connection Errors
Issue: Cannot connect to MCP serversSolutions:
- Verify server commands are installed and accessible
- Check command arguments and paths
- Test server manually:
npx @modelcontextprotocol/server-filesystem .
- Verify environment variables for servers are set
- Check file permissions for stdio transport
- For HTTP transports, verify URL accessibility
Model Provider Authentication
Model Provider Authentication
Issue: API key or authentication errorsSolutions:
- Verify API keys are correct and active
- Check rate limits and quotas
- For Azure: ensure endpoint URL format is correct
- For Bedrock: verify AWS credentials and permissions
- For Google: check authentication method (API key vs service account)
Temporal Connection Issues
Temporal Connection Issues
Issue: Cannot connect to Temporal serverSolutions:
- Verify Temporal server is running:
temporal server start-dev
- Check host and port configuration
- For production: verify TLS settings and certificates
- Check namespace exists and is accessible
- Verify API key if using Temporal Cloud
Performance Issues
Performance Issues
Issue: Slow responses or timeoutsSolutions:
- Increase timeout values in MCP server configurations
- Check network connectivity for remote servers
- Monitor resource usage (CPU, memory)
- Enable logging to debug bottlenecks
- Consider using connection pooling for HTTP transports