Skip to main content

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

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.
  • To use Redis for token storage, configure token_store.backend: redis and supply redis_url (see optional dependency mcp-agent[redis]).
  • Downstream servers opt into OAuth via mcp.servers.<name>.auth.oauth. Supplying a client_id/client_secret allows immediate usage; support for dynamic client registration is planned as a follow-up.
  • Some providers (including GitHub) reject the RFC 8707 resource parameter. Set include_resource_parameter: false in the client settings for those services.

Configuration Reference

Execution Engine

Controls how mcp-agent executes workflows:
Standard async execution for most use cases.

Logging Configuration

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:

AWS Bedrock

Google Gemini

Configure Google Gemini with different authentication methods:
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:
Standard input/output transport for local server processes.

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:
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:

Configuration Schema Reference

The complete configuration schema is available at mcp-agent.config.schema.json.

Core Settings Structure

Provider Settings Reference

Troubleshooting

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")
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
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
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
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)
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
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

Next Steps

Core Concepts

Learn about agents, MCP servers, and augmented LLMs

MCP Protocol

Understand tools, resources, prompts, and roots

CLI Reference

Complete command line documentation

Examples

See real configuration examples