MCP Agents
mcp-use provides a complete agent framework for building AI applications that leverage MCP servers. The MCPAgent combines LLM integration, tool orchestration, and memory management to create powerful, autonomous AI agents.Key Features
- LLM Integration: Support for OpenAI, Anthropic, Google, and Groq
- Automatic tool calling: Agents automatically select and execute appropriate tools
- Multi-server orchestration: Connect to multiple MCP servers simultaneously
- Structured output: Type-safe responses with Zod schema validation
- Streaming support: Real-time streaming of agent responses
- Memory management: Built-in conversation history and context management
Installation
The agent framework is included with the mcp-use package:Quick Start
Here’s a basic example of creating and running an agent:Architecture Overview
The MCPAgent framework is built around several core components that work together to enable intelligent, tool-using AI applications.Agent Core
TheMCPAgent class orchestrates all agent functionality, managing LLM interactions, tool execution, and response generation.
Learn more: Agent Configuration →
LLM Integration
Native support for multiple LLM providers with a unified interface. Each provider is automatically detected and configured based on the LLM instance you provide. Supported providers:- OpenAI (GPT-3.5, GPT-4, GPT-4 Turbo)
- Anthropic (Claude 3 family)
- Google (Gemini models)
- Groq (Llama, Mixtral, and more)
Tool Orchestration
Agents automatically discover tools from connected MCP servers and intelligently select the right tools for each task. The framework handles:- Tool discovery and schema conversion
- Automatic tool selection by the LLM
- Parameter validation and type safety
- Error handling and retries
- Multi-step workflows