# mcp-agent

> MCP Client

Mcp-agent is a composable framework for building AI agents using the Model Context Protocol, inspired by Anthropic's research on effective agent design and standardized interfaces for AI assistants.

## Overview

- **Category:** AI
- **Language:** Python
- **Stars:** 8479
- **Forks:** 180
- **Owner:** lastmile-ai
- **GitHub:** https://github.com/lastmile-ai/mcp-agent
- **Created:** 2024-12-18T01:55:10+00:00
- **Updated:** 2025-03-28T23:46:35+00:00
- **Source:** https://model-context-protocol.com/clients/build-ai-agents-model-context-protocol

## Setup

## Setup

We recommend using [uv](https://docs.astral.sh/uv/) to manage your Python projects:

```bash
uv add "mcp-agent"
```

Alternatively:

```bash
pip install mcp-agent
```

### Quickstart

> [!TIP]
> The [`examples`](/examples) directory has several example applications to get started with.
> To run an example, clone this repo, then:
>
> ```bash
> cd examples/mcp_basic_agent # Or any other example
> cp mcp_agent.secrets.yaml.example mcp_agent.secrets.yaml # Update API keys
> uv run main.py
> ```

## Tools

## Available Tools

1.  **MCPApp**: Global state and app configuration.
2.  **MCP server management**: `gen_client` and `MCPConnectionManager` to easily connect to MCP servers.
3.  **Agent**: An entity that has access to a set of MCP servers and exposes them to an LLM as tool calls.
4.  **AugmentedLLM**: An LLM that is enhanced with tools provided from a collection of MCP servers.
5.  **Parallel**: Fan-out tasks to multiple sub-agents and fan-in the results.
6.  **Router**: Given an input, route to the `top_k` most relevant categories.
7.  **IntentClassifier**: Identifies the `top_k` Intents that most closely match a given input.
8.  **Evaluator-Optimizer**: One LLM refines a response, another critiques it until a response exceeds a quality criteria.
9.  **Orchestrator-workers**: A higher-level LLM generates a plan, then assigns them to sub-agents, and synthesizes the results.
10. **Swarm**: A model-agnostic multi-agent pattern for task handling.
