MCP Agent
by lastmile-ai
A Python framework for building AI agents on top of MCP, giving you ready-made composable patterns (router, orchestrator-workers, evaluator-optimizer, swarm) instead of wiring agent logic from scratch.
Scaffold a new agent (2-minute quickstart)
uvx mcp-agent init
About
mcp-agent's premise is that you don't need a heavyweight agent architecture. You need MCP for tool access and a handful of well-tested composition patterns for how agents coordinate. It handles the unglamorous parts (connecting to MCP servers, managing their lifecycle, tracking tokens, structured logging) so what you write is agent behavior: which pattern applies, which servers a given agent can use, and what happens with the result.
The patterns it ships are lifted directly from Anthropic's Building Effective Agents writeup, implemented as composable Python building blocks: parallel/map-reduce for fanning work out to specialists and merging results, a router for picking the right agent or function per request, orchestrator-workers for a planner that delegates to multiple workers, evaluator-optimizer for iterating until a result clears a quality bar, and swarm for OpenAI-Swarm-compatible multi-agent handoffs. For workloads that need to survive restarts or run for hours, it can back execution with Temporal for durable, resumable workflows.
Key features
- Composable implementations of Anthropic's agent-pattern research: router, orchestrator-workers, evaluator-optimizer, parallel, swarm, intent-classifier
- Manages MCP server connection lifecycle so you don't hand-roll reconnect/session logic
- Durable execution option backed by Temporal for long-running or resumable agent workflows
- Built-in token tracking and structured logging for observability
- OAuth support and cloud deployment path for exposing an agent as its own MCP endpoint
- 2-minute scaffold-and-run quickstart via its own CLI
Use cases
- Building a 'finder' agent that reads local files and fetches URLs to answer a question
- Fanning a task out to several domain-specialist agents in parallel and merging their outputs
- Running an evaluator-optimizer loop that keeps revising a draft until it passes a quality check
- Deploying a long-running research agent on Temporal so it survives a restart mid-task
Available tools
Router
Directs an incoming request to the most suitable agent or function.
Orchestrator-Workers
A planner agent that generates a plan and delegates pieces of it to worker agents.
Evaluator-Optimizer
Iterates a result against an evaluator until it meets a quality bar.
ParallelLLM
Fans a task out to multiple specialist agents and aggregates their results.
Swarm
OpenAI-Swarm-compatible multi-agent handoff pattern.
IntentClassifier
Categorizes user input before routing it into an automation.
Frequently asked questions
Do I need to already know MCP to use this framework?
Not deeply. mcp-agent manages MCP server connections for you; you mainly need to know which MCP servers you want an agent to use, not the wire protocol.
Is Temporal required?
No. It's an optional add-on (uv add "mcp-agent[temporal]"-style extra) for when you need durable, resumable execution; the default setup runs in-process.