Make sure you have installed mcp-agent before proceeding.
Overview
Weβll create a βfinderβ agent that has access to two MCP servers:- Fetch Server: For retrieving web content
- Filesystem Server: For reading local files
Step 1: Set Up Your Project
1
Create a new directory
2
Install dependencies
Step 2: Configure Your Agent
Create two configuration files:mcp_agent.config.yaml
mcp_agent.secrets.yaml
Replace
"your-openai-api-key-here"
with your actual OpenAI API key. You can
get one from the OpenAI platform.Step 3: Create Your Agent
Create a file calledmain.py
:
Step 4: Run Your Agent
Expected Output
You should see output similar to this:What Just Happened?
Agent Creation
You created an agent with specific instructions and access to two MCP
servers
Tool Discovery
The agent automatically discovered available tools from connected MCP
servers
LLM Integration
You attached an OpenAI LLM that can use the discovered tools
Multi-turn Chat
The agent maintains conversation context across multiple interactions
Troubleshooting
OpenAI API Key Error
OpenAI API Key Error
Make sure your API key is correctly set in
mcp_agent.secrets.yaml
and that you have credits in your OpenAI account.MCP Server Not Found
MCP Server Not Found
Ensure the MCP servers are properly configured in
mcp_agent.config.yaml
and they are included in finder_agentβs server_names
list.Permission Denied
Permission Denied
The filesystem server can only access files in the directory you specify. Make sure the current directory (
.
) is accessible.Next Steps
Learn Core Concepts
Understand how agents, MCP servers, and LLMs work together
Explore Workflow Patterns
Discover advanced patterns like parallel processing and routing
Try Different Providers
Use Anthropic Claude, Azure, or other LLM providers
Build Integrations
Create web apps, Claude Desktop integrations, and more
Check out the examples
directory for
30+ working examples covering different use cases and patterns.