Skip to main content

What is mcp-agent?

mcp-agent is a Python framework for building AI agents using the Model Context Protocol (MCP). It provides a simple, composable way to build effective agents by combining standardized MCP servers with proven workflow patterns.

Anatomy of an MCP Agent

The quickest way to internalise the stack is to walk through the basic finder agent. Each step maps directly to a core SDK concept:

1. Configure servers and models

mcp_agent.config.yaml
This defines the transports the agent can call and the model preferences it should use.

2. Bootstrap the application

main.py
MCPApp loads the config/secrets, prepares logging and tracing, and manages server connections.

3. Describe the agent

finder_agent.py
The agent couples instructions with the set of MCP servers it is allowed to use. When async with finder: runs, the agent initialises those connections via the app’s server registry.

4. Attach an augmented LLM

The augmented LLM automatically surfaces the agent’s tools (fetch, read_text_file, etc.) during generation.

5. Run inside the app context

You gain uniform logging, token accounting, and graceful shutdown by executing inside app.run(). From here, layer in more sophisticated patterns: With these building blocks you can mix and match—swap models, add workflow decorators, run inside Temporal, or expose the whole app as an MCP server.

Core Architecture

mcp-agent consists of four main layers:

MCP Integration

Connect to any MCP server and automatically discover tools, resources, and prompts

Agent Layer

Agents that combine instructions with MCP server capabilities

LLM Integration

Augmented LLMs that can use tools and maintain conversation context

Workflow Patterns

Composable patterns for orchestrating agents and tasks

Key Components

MCPApp

The MCPApp is the central application context that manages configuration, logging, and server connections:
Learn more about MCPApp →

Agents

Agents are entities with specific instructions and access to MCP servers:
Learn more about Agents →

AugmentedLLM

AugmentedLLMs are LLMs enhanced with tools from MCP servers:
Learn more about AugmentedLLM →

MCP Servers

MCP servers provide tools, resources, and other capabilities to agents:
mcp_agent.config.yaml
Learn more about MCP Servers →

Workflows

Workflows are composable patterns for orchestrating agents:
Learn more about Workflows →

Execution Engines

Execution engines determine how workflows run:
  • asyncio: In-memory execution for development
  • Temporal: Durable execution with pause/resume capabilities
mcp_agent.config.yaml
Learn more about Execution Engines →

Workflow Patterns

mcp-agent implements all patterns from Anthropic’s Building Effective Agents:

Parallel

Fan-out tasks to multiple agents

Router

Intelligent request routing

Intent Classifier

Understand user intent

Planner

Plan and execute complex tasks

Deep Research

Adaptive planning with knowledge extraction

Evaluator-Optimizer

Iterative improvement with LLM-as-judge

Swarm

Multi-agent collaboration

Model Context Protocol

mcp-agent provides full support for MCP capabilities:

Tools

Execute functions and produce side effects

Resources

Access data and load context

Prompts

Reusable templates for interactions

Sampling

Request LLM completions from clients
Learn more about MCP Support →

Next Steps

Core Components

Learn about the building blocks

Effective Patterns

Explore agent workflow patterns

MCP Protocol

Understand MCP capabilities

Advanced Topics

Durable agents, observability, and more