Integrate external tools into your agents via Model Context Protocol (MCP) servers or web search.
- MCP Server
- Web Search
agno/tools/mcp
Connects to a Model Context Protocol (MCP) server, giving agents access to external tools.Config
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
command | string | Conditional | — | Command to run the MCP server (for stdio transport). Mutually exclusive with url |
url | string | Conditional | — | URL for SSE or streamable-http transport. Mutually exclusive with command |
transport | "stdio" | "sse" | "streamable-http" | No | Auto-detected | Transport protocol. Inferred from command (stdio) or url (sse) if not set |
env | dict[string, Field[string]] | No | — | Environment variables for the server process |
headers | dict[string, Field[string]] | No | — | Static HTTP headers for remote transports |
include_run_context_headers | boolean | No | false | Forward agent run context as headers (X-User-ID, X-Session-ID, X-Run-ID) |
timeout_seconds | integer | No | 10 | Connection timeout in seconds |
include_tools | list[string] | No | — | Only include these tool names |
exclude_tools | list[string] | No | — | Exclude these tool names |
tool_name_prefix | string | No | — | Prefix added to all tool names (avoids collisions) |
Outputs
| Field | Type | Description |
|---|---|---|
spec | object | Serialized MCP tools spec for runtime reconstruction |
Example — Remote MCP server
Example — Local stdio server
Dependencies
Depends on: Nothing directly, butenv and headers fields on MCP tools support FieldReferences.
Depended on by:
agno/agent— in thetoolslistagno/team— in thetoolslist
Notes
- For MCP tools, you must provide exactly one of
commandorurl. - The
transporttype is auto-detected if not specified:commandimpliesstdio,urlimpliessse. - The
include_run_context_headersoption forwards the agent’s user ID, session ID, and run ID as HTTP headers to the MCP server. - Web search requires the
ddgspackage, which is automatically included as a pip dependency.