mcp-agent
VerifiedComposable Python framework for building agents via Model Context Protocol.
What is mcp-agent?
mcp-agent is an open-source framework that connects language models to MCP servers through straightforward, reusable patterns. It manages connection lifecycles automatically and includes implementations of established agent workflows such as routing, evaluation, and orchestration.
The library works for basic agents while also supporting advanced setups via Temporal for pause, resume, and recovery capabilities. Agents can be exposed as MCP servers themselves, and the system emphasizes minimal code changes when moving from simple to production-grade deployments.
It targets developers who want reliable agent applications using existing MCP tools and resources, especially those familiar with Python and seeking to avoid overly intricate agent frameworks.
What you can build with mcp-agent
File and web research agent
Attach an agent to filesystem and fetch MCP servers to summarize documents or retrieve online content in response to natural language queries.
Workflow orchestration
Chain patterns such as map-reduce or evaluator-optimizer to process multi-step tasks while maintaining state across runs.
Agent as MCP server
Expose a custom agent as an MCP server endpoint so other tools or applications can call it through the standard protocol.
Install mcp-agent
pip install mcp-agent> mkdir hello-mcp-agent && cd hello-mcp-agent
> uvx mcp-agent init
> uv init
> uv add "mcp-agent[openai]"
> # Add openai API key to `mcp_agent.secrets.yaml` or set `OPENAI_API_KEY`
> uv run main.py
>- 1Install via pip with the mcp-agent package.
- 2Create an MCPApp instance and define an Agent with desired server names.
- 3Attach an LLM implementation such as OpenAIAugmentedLLM inside the agent context.
- 4Call generate methods on the LLM to process prompts using connected MCP tools.
- 5Add API keys to mcp_agent.secrets.yaml or environment variables before running.
mcp-agent: pros & cons
Pros
- +Handles MCP server connections and lifecycle automatically
- +Offers composable versions of proven agent patterns
- +Supports durable execution through Temporal without API changes
- +Allows agents to be published as MCP servers
Cons
- –Primarily documented for Python usage
- –Advanced durability requires separate Temporal setup
- –Depends on external MCP servers being available and configured
Frequently asked questions
An MCPApp context, an Agent configured with server names, and an attached LLM class plus valid API credentials.
User reviews
Verified reviews from the community shape this listing's rating.
Loading reviews…