mcp-agent logo

mcp-agent

by lastmile-ai

mcp-agent is a simple, composable framework for building AI agents using the Model Context Protocol (MCP). It provides tools and patterns for managing MCP server connections and implementing agent workflows.

View on GitHub

Last updated: N/A

What is mcp-agent?

mcp-agent is a lightweight framework that simplifies the creation of AI agents by leveraging the Model Context Protocol (MCP). It handles MCP server connections, implements agent patterns, and offers composable workflows for building robust agent applications.

How to use mcp-agent?

To use mcp-agent, install it using pip or uv. Define your agent's instructions, specify the MCP servers it can access, and attach an LLM. You can then use the agent to generate responses, interact with external services via MCP servers, and orchestrate complex workflows.

Key features of mcp-agent

  • Simple and composable agent patterns

  • MCP server connection management

  • Model-agnostic design

  • Workflow implementations (Parallel, Router, Evaluator-Optimizer, Swarm)

  • Support for human input and signaling

Use cases of mcp-agent

  • Multi-agent collaborative workflows

  • Human-in-the-loop workflows

  • RAG pipelines

  • Integrating AI agents into MCP clients like Claude Desktop

  • Automated tasks leveraging external services via MCP servers

FAQ from mcp-agent

What are the core benefits of using mcp-agent?

mcp-agent provides a streamlined approach to building AI agents using capabilities exposed by MCP servers. It handles the mechanics of connecting to servers, working with LLMs, handling external signals (like human input) and supporting persistent state via durable execution.

Do you need an MCP client to use mcp-agent?

No, you can use mcp-agent anywhere, since it handles MCPClient creation for you. This allows you to leverage MCP servers outside of MCP hosts like Claude Desktop.

What is Model Context Protocol (MCP)?

Model Context Protocol is a standardized interface to let any software be accessible to AI assistants via MCP servers.

What workflow patterns are supported?

mcp-agent provides implementations for Parallel, Router, IntentClassifier, Evaluator-Optimizer, Orchestrator-Workers, and Swarm.

How does mcp-agent handle human input?

If an Agent has a human_input_callback, the LLM can call a __human_input__ tool to request user input mid-workflow.