mcp-agent

Platforms & APIs 💻 Python ⚖️ Apache-2.0 🔴 No recent commits
8.5k stars

mcp-agent is a Python framework for building agents using the Model Context Protocol (MCP). It implements composable agent patterns from Anthropic's Building Effective Agents guide and manages MCP server connections, enabling developers to focus on agent behavior rather than boilerplate. It is designed for developers building AI agents that need to integrate with MCP servers and scale from simple to production-grade workflows.

mcp-agent cloud Demo Video

🎬 mcp-agent cloud Demo Video · LastMile AI

✨ Key features

  • Full MCP support including tools, resources, prompts, notifications, OAuth, sampling, elicitation, and roots.
  • Composable workflow patterns: map-reduce, orchestrator, evaluator-optimizer, router, and more.
  • Durable execution with Temporal backend without API changes.
  • Agent factory helpers to load AgentSpecs from files.
  • Augmented LLMs with structured output and request parameters.
  • CLI for scaffolding and deployment via uvx mcp-agent.

🎯 Use cases

  • Build a research agent that reads local files and fetches URLs to answer questions.
  • Create a content summarizer that uses multiple MCP servers to gather and summarize information.
  • Deploy agents as MCP servers for cloud or managed runtime.
  • Implement complex workflows like orchestrator-worker or evaluator-optimizer patterns.
  • Build durable agents that can pause, resume, and recover using Temporal.

📦 Installation

🧰 Requirements: Python environment with uv or pip; optional LLM provider packages (e.g., openai, anthropic); API keys for chosen LLM provider stored in mcp_agent.secrets.yaml or environment variables.

uv add "mcp-agent"

Alternatively:

pip install mcp-agent

Also add optional packages for LLM providers (e.g. uv add "mcp-agent[openai, anthropic, google, azure, bedrock]").

🚀 Usage

import asyncio

from mcp_agent.app import MCPApp
from mcp_agent.agents.agent import Agent
from mcp_agent.workflows.llm.augmented_llm_openai import OpenAIAugmentedLLM

app = MCPApp(name="hello_world")

async def main():
    async with app.run():
        agent = Agent(
            name="finder",
            instruction="Use filesystem and fetch to answer questions.",
            server_names=["filesystem", "fetch"],
        )
        async with agent:
            llm = await agent.attach_llm(OpenAIAugmentedLLM)
            answer = await llm.generate_str("Summarize README.md in two sentences.")
            print(answer)

if __name__ == "__main__":
    asyncio.run(main())

❓ FAQ

What is mcp-agent?

mcp-agent is a Python framework for building agents using the Model Context Protocol (MCP). It implements composable agent patterns and manages MCP server connections.

How do I install mcp-agent?

You can install it with uv add "mcp-agent" or pip install mcp-agent. Optionally add LLM provider packages like mcp-agent[openai].

What LLM providers are supported?

The README mentions optional packages for openai, anthropic, google, azure, and bedrock. The minimal example uses OpenAIAugmentedLLM.

Can I deploy agents to the cloud?

Yes, cloud deployment is in beta. You can deploy agents yourself or use mcp-c for a managed runtime, and all apps are deployed as MCP servers.

📊 Repository

Stars★ 8,525
Forks🍴 880
Open issues🐛 133
Last commit🕒 Jan 25, 2026
Created📅 Dec 2024
Language💻 Python
License⚖️ Apache-2.0

🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.