lastmile-ai/mcp-agent
Build effective agents using Model Context Protocol and simple workflow patterns
8,492 ★872 forksPythonUpdated 6mo ago
What you need to know
A Python framework for building effective agents on Model Context Protocol with simple, composable patterns (Anthropic's Building Effective Agents). Fully implements MCP, manages server lifecycle, offers durable execution via Temporal, and can expose apps as MCP servers. Note: this is a framework/SDK, not an end-user MCP server.
Install
uv add mcp-agent pip install mcp-agent uv add "mcp-agent[openai, anthropic, google, azure, bedrock]" (optional LLM providers)
Usage
- •Scaffold: uvx mcp-agent init; configure servers in mcp_agent.config.yaml and secrets in mcp_agent.secrets.yaml
- •Define an MCPApp + Agent(server_names=[...]), attach an AugmentedLLM, call generate_str / generate_structured
- •Deploy: uvx mcp-agent login && uvx mcp-agent deploy my-agent
- •Expose as MCP server: server = create_mcp_server_for_app(app); server.run_stdio()
Key features
- ✓Full MCP support: tools, resources, prompts, notifications, OAuth, sampling, elicitation, roots
- ✓Composable workflow patterns: parallel (map-reduce), router, intent classifier, orchestrator-workers, deep research, evaluator-optimizer, swarm (OpenAI Swarm compatible)
- ✓Durable execution via Temporal (pause/resume/retry/history) without API changes; run a worker alongside the app
- ✓Agent-as-MCP-server (server-of-servers) so MCP clients can call your workflows; FastMCP-compatible server creation
- ✓Observability: structured logging, OpenTelemetry, token counter; signals/human-input; icons; OAuth client
Best for
Python developers building production agents that orchestrate multiple MCP servers with Anthropic's effective-agent patterns and optional Temporal durability.
Caveats
- ⚠It is a framework/SDK/library, not an out-of-the-box runnable MCP server
- ⚠Requires LLM API keys (e.g. OPENAI_API_KEY) in mcp_agent.secrets.yaml or env
- ⚠Cloud deployment is in Beta
Clients: Claude Desktop · Cursor · custom MCP clients (via agent-as-MCP-server)
Documentation ↗Reviewed 2026-08-07
Topics
agentsaiai-agentsllmllmsmcpmodel-context-protocolpython
- Stars
- 8,492★
- Forks
- 872
- Language
- Python
- License
- Apache-2.0
- Created
- 2024-12-18
- Last push
- 2026-01-25