█

AI/TLDR

Invítame a un café
Invítame un café

mcp-agent

Crea agentes componibles sobre el Model Context Protocol

Multi-Agent SystemsCódigo abierto
Idioma
Python
Licencia
Apache-2.0
$pip install mcp-agent
EN BREVE

What is mcp-agent?

mcp-agent es un framework de Python para crear agentes que conectan modelos de lenguaje grandes con servidores del Model Context Protocol (MCP) como herramientas. 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: instala el paquete.

Resumen

mcp-agent es un framework de Python para crear agentes que conectan modelos de lenguaje grandes con servidores del Model Context Protocol (MCP) como herramientas. Gestiona por ti el ciclo de vida de las conexiones con los servidores MCP, para que te centres en lo que debe hacer el agente y no en la parte técnica de iniciar, conectar y cerrar servidores.

Está pensado para desarrolladores que crean sistemas multiagente y quieren patrones reutilizables en lugar de arquitecturas a medida. La librería implementa los patrones de la guía «Building Effective Agents» de Anthropic, como router, orchestrator, evaluator-optimizer y map-reduce, y permite encadenarlos entre sí.

Como framework multiagente, mcp-agent funciona con un único agente sencillo y escala hasta flujos de trabajo duraderos respaldados por Temporal, que permiten pausar, reanudar y recuperar un agente. Los agentes también pueden exponerse como servidores MCP mediante una API compatible con FastMCP.

Qué hace

  • Soporte completo de MCP, con herramientas, recursos, prompts, notificaciones, además de OAuth, sampling, elicitation y roots
  • Gestiona el ciclo de vida de las conexiones con servidores MCP para que no tengas que hacerlo tú
  • Patrones de agente componibles (router, orchestrator, evaluator-optimizer, map-reduce) que se encadenan entre sí
  • Ejecución duradera sobre Temporal para pausar, reanudar y recuperar sin cambiar el código de tu agente
  • Expón tus propios agentes como servidores MCP mediante una API compatible con FastMCP
  • Funciona con backends de LLM aumentados, como OpenAI

Primeros pasos

Instala mcp-agent desde PyPI, configura una clave de API de un LLM y ejecuta un agente mínimo que se conecte a servidores MCP.

Instala el paquete

Instala mcp-agent desde PyPI en tu entorno de Python.

bashbash
pip install mcp-agent

Configura tu clave de LLM

Añade tu clave de API del LLM en mcp_agent.secrets.yaml o defínela en tu entorno. La guía de inicio explica en detalle la configuración y los secretos.

Ejecuta un agente mínimo

Crea una app, define un agente que use los servidores MCP de sistema de archivos y fetch, asocia un LLM y genera una respuesta.

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 repositorio oficial para lo último.

Cuándo usarlo

  • Crea un agente que lea archivos locales y obtenga páginas web mediante servidores MCP
  • Combina flujos de trabajo multiagente con patrones como router, orchestrator o evaluator-optimizer
  • Ejecuta agentes de larga duración en Temporal que pueden pausar, reanudar y recuperarse
  • Expón un agente existente como servidor MCP para que otros clientes lo llamen

How mcp-agent compares

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

HerramientaEstrellasQué hace
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.6kCrea agentes componibles sobre el Model Context Protocol