mcp-agent provides first-class support for all MCP primitives: tools, resources, prompts, and roots. This enables seamless integration with any MCP server and client.
Full MCP Protocol Support
mcp-agent is the only agent framework built specifically for the Model Context Protocol, supporting:Tools
Execute functions and commands from MCP servers
Resources
Access structured data and files via URIs
Prompts
Use and compose prompt templates from servers
Roots
Browse and access file system directories
Transports
Support for stdio, SSE, WebSocket, and HTTP
Sampling
Direct LLM sampling through MCP servers
What is MCP?
The Model Context Protocol (MCP) is an open standard that enables seamless communication between:- MCP Clients: Applications that use AI capabilities (Claude Desktop, VS Code, etc.)
- MCP Servers: Services that provide tools, data, and resources
- AI Models: LLMs that leverage MCP capabilities to perform tasks
MCP Transport Examples
Server-Sent Events (SSE)
WebSocket Transport
SSE with Authentication Headers
Using MCP in mcp-agent
Connecting to MCP Servers
Configure MCP servers in yourmcp_agent.config.yaml
:
Accessing MCP Capabilities
Agents automatically get access to all MCP capabilities from connected servers:MCP Primitives
Tools
Tools are functions that agents can execute:Resources
Resources are structured data accessible via URIs:Prompts
Prompts are reusable templates from MCP servers:Roots
Roots provide file system access with proper permissions:Transport Options
mcp-agent supports all MCP transport protocols:stdio (Standard I/O)
Default for local MCP servers:Server-Sent Events (SSE)
For streaming connections:WebSocket
For bidirectional streaming:HTTP (RESTful)
For request-response communication:Real-World Examples
Example: Document Analysis with Multiple MCP Servers
Example: Using Resources and Prompts Together
Example: Multi-Transport Setup
Advanced MCP Features
Dynamic Server Connection
Connect to MCP servers at runtime:Custom MCP Server Implementation
Create your own MCP server:MCP Server Discovery
Discover and connect to MCP servers dynamically:Best Practices
Server Configuration
Server Configuration
- Use environment variables for sensitive data
- Set appropriate timeouts for remote servers
- Group related servers logically
- Document server requirements clearly
Error Handling
Error Handling
Always handle MCP connection failures gracefully:
Performance
Performance
- Use connection pooling for HTTP/WebSocket transports
- Cache frequently accessed resources
- Batch tool calls when possible
- Monitor server response times
Security
Security
- Always use authentication for remote servers
- Validate server certificates for HTTPS/WSS
- Restrict file system access with roots
- Audit tool usage and access patterns
Ecosystem Integration
mcp-agent works with the entire MCP ecosystem:Official MCP Servers
Filesystem, Git, Postgres, and more
Community Servers
100+ community MCP servers
Build Your Own
Create custom MCP servers
MCP Inspector
Debug and test MCP servers