| tags |
|
|---|
Agent Zero supports Model Context Protocol (MCP) for connecting to external tool servers. MCP provides a standardized way for agents to access external capabilities through a protocol that LLMs can understand natively.
graph LR
A[Agent Zero] --> B[MCP Handler<br/>helpers/mcp_handler.py]
B --> C[MCP Server<br/>helpers/mcp_server.py]
C --> D[External Tools]
D --> E[File System]
D --> F[Database]
D --> G[API]
D --> H[Custom Services]
style A fill:#2d8cf0,color:#fff
style C fill:#67c23a,color:#fff
Agent Zero implements both client and server sides of MCP:
| Component | File | Purpose |
|---|---|---|
| MCP Handler | helpers/mcp_handler.py |
Client-side — discovers and calls MCP tools |
| MCP Server | helpers/mcp_server.py |
Server-side — exposes Agent Zero tools via MCP |
When an MCP server is connected, its tools are dynamically registered and appear alongside built-in tools:
- Tools show up in the tool list with
mcp_prefix - The agent can call them like any other tool
- Results are returned in standard format
MCP servers are configured in settings:
{
"mcp_servers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path"],
"transport": "stdio"
},
"remote-api": {
"url": "http://mcp-server:3000/mcp",
"transport": "sse"
}
}
}| Transport | Description |
|---|---|
stdio |
Local process communication via stdin/stdout |
sse |
Server-Sent Events over HTTP |
sequenceDiagram
participant Agent
participant MCPHandler
participant MCPServer
Agent->>MCPHandler: Initialize MCP
MCPHandler->>MCPServer: List tools request
MCPServer-->>MCPHandler: Tool definitions
MCPHandler->>Agent: Register as available tools
Agent->>MCPHandler: Call MCP tool
MCPHandler->>MCPServer: Execute tool
MCPServer-->>MCPHandler: Result
MCPHandler-->>Agent: Formatted result
The MCP integration is provided by the core helpers:
helpers/mcp_handler.py(46KB) — Full MCP client implementationhelpers/mcp_server.py(17KB) — MCP server for exposing Agent Zero tools
- Configure in
settings.jsonundermcp_servers - Install the MCP server package if needed
- Restart Agent Zero to connect
- Verify tools appear via the tool list
| Use Case | Example MCP Server |
|---|---|
| File system access | @modelcontextprotocol/server-filesystem |
| Database queries | Custom Postgres MCP server |
| API integration | Custom REST API MCP server |
| Git operations | @modelcontextprotocol/server-github |
| Web scraping | Custom browser MCP server |
- Tools Reference — Native Agent Zero tools
- Plugin Architecture — Plugins can wrap MCP servers
- Settings — MCP server configuration
- Docker Setup — Running MCP servers alongside Agent Zero