█

AI/TLDR

Buy me a coffee
Buy me a coffee

mcp-agent

Build composable agents on the Model Context Protocol

Multi-Agent SystemsOpen source
Language
Python
License
Apache-2.0
$pip install mcp-agent
IN SHORT

What is mcp-agent?

mcp-agent is a Python framework for building agents that connect large language models to Model Context Protocol (MCP) servers as tools. It sits in the Multi-Agent Systems category of the Agents & Automation tools and is open-source, written in Python and licensed Apache-2.0. To get started: install the package.

Overview

mcp-agent is a Python framework for building agents that connect large language models to Model Context Protocol (MCP) servers as tools. It manages the lifecycle of MCP server connections for you, so you can focus on what the agent should do rather than the plumbing of starting, connecting to, and tearing down servers.

It is aimed at developers building multi-agent systems who want reusable patterns instead of bespoke architectures. The library implements the patterns from Anthropic's "Building Effective Agents" guide, such as router, orchestrator, evaluator-optimizer, and map-reduce, and lets you chain them together.

As a multi-agent framework, mcp-agent works for a single simple agent and scales up to durable workflows backed by Temporal, which let an agent pause, resume, and recover. Agents can also be exposed as MCP servers themselves using a FastMCP-compatible API.

What it does

  • Full MCP support, including tools, resources, prompts, notifications, plus OAuth, sampling, elicitation, and roots
  • Manages the connection lifecycle of MCP servers so you don't handle it yourself
  • Composable agent patterns (router, orchestrator, evaluator-optimizer, map-reduce) that chain together
  • Durable execution on Temporal for pause, resume, and recovery without changing your agent code
  • Expose your own agents as MCP servers via a FastMCP-compatible API
  • Works with augmented LLM backends such as OpenAI

Getting started

Install mcp-agent from PyPI, set an LLM API key, then run a minimal agent that talks to MCP servers.

Install the package

Install mcp-agent from PyPI into your Python environment.

bashbash
pip install mcp-agent

Configure your LLM key

Add your LLM API key to mcp_agent.secrets.yaml or set it in your environment. The Getting Started guide covers configuration and secrets in detail.

Run a minimal agent

Create an app, define an agent that uses the filesystem and fetch MCP servers, attach an LLM, and generate a response.

pythonpython
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())

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Build an agent that reads local files and fetches web pages through MCP servers
  • Compose multi-agent workflows using patterns like router, orchestrator, or evaluator-optimizer
  • Run long-running, durable agents on Temporal that can pause, resume, and recover
  • Expose an existing agent as an MCP server for other clients to call

How mcp-agent compares

mcp-agent alongside other open-source multi-agent systems tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
Paperclip★ 118kA self-hosted control plane that runs a team of AI agents like a company, with an org chart, tasks, budgets and approvals.
Ruflo★ 82.7kAgent meta-harness that wraps Claude Code and Codex with 100+ specialized agents, swarm coordination, vector memory, background workers and cross-machine agent federation.
MetaGPT★ 71.5kA multi-agent framework that models a software company, assigning roles like product manager, architect, and engineer to generate code from a single prompt.
AutoGen★ 62kMicrosoft Research's framework for building applications where multiple agents converse with each other and with tools to solve tasks.
CrewAI★ 61.4kA framework for assembling teams ('crews') of role-playing agents that divide tasks and collaborate to complete a goal.
AgentScope★ 36.9kA framework for building multi-agent applications with message passing, visual debugging tools, and distributed execution.
OpenAI Agents SDK★ 30.9kOpenAI's lightweight Python SDK for building multi-agent workflows using explicit handoffs, tools, and guardrails.
mcp-agent★ 8.6kBuild composable agents on the Model Context Protocol