> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP

> Querying live Agno docs through a Model Context Protocol server.

The [MCP agent](https://github.com/agno-agi/demo-os/blob/main/agents/mcp/agent.py) is twenty lines of code that answers questions about Agno using the official docs MCP server. The docs site exposes an MCP endpoint, the agent connects to it, and the answers stay current without a local knowledge base, embeddings, or an ingest pipeline.

```python theme={null}
from agno.agent import Agent
from agno.tools.mcp import MCPTools

mcp_agent = Agent(
    id="mcp",
    name="MCP",
    model=MODEL,
    db=agent_db,
    tools=[MCPTools(url="https://docs.agno.com/mcp")],
    instructions=INSTRUCTIONS,
    add_history_to_context=True,
)
```

That's the whole agent. `MCPTools(url=...)` wraps the MCP server's tools so the agent can call `search_docs`, `read_page`, etc. as if they were native tools.

## What MCP gives you

[Model Context Protocol](https://modelcontextprotocol.io) is a standard for exposing tools, resources, and prompts to agents. Any MCP server (stdio, SSE, or streamable-HTTP transport) can be wrapped with `MCPTools`:

```python theme={null}
# Hosted server (HTTP)
MCPTools(url="https://mcp.github.com/mcp")

# Local subprocess (stdio)
MCPTools(command="uvx", args=["mcp-server-time"])

# With auth
MCPTools(url="https://mcp.linear.app", headers={"Authorization": "Bearer ..."})
```

Tool discovery happens at connect time. The agent's instructions get a list of available tools and their schemas. The agent calls them like any other tool.

## When to use MCP vs writing a tool

| Situation                                                            | Pick                  |
| -------------------------------------------------------------------- | --------------------- |
| The service already has an MCP server (Linear, GitHub, Notion, etc.) | MCP                   |
| You want tool discovery to update without redeploying                | MCP                   |
| You're integrating with internal systems                             | Write a tool, simpler |
| You need fine-grained control over arguments / response shape        | Write a tool          |

For most third-party services, MCP wins. A `@tool` function is more direct for first-party data like your database or internal APIs.

## See it in action

```
@MCP what changed in agno 2.6?
@MCP how do I add memory to an agent?
@MCP what providers does Agno support natively?
```

Each query triggers an MCP `search_docs` call against `docs.agno.com/mcp`. The agent reads the matching pages, synthesizes an answer, cites the source.

## MCP as a context provider in Scout

The MCP agent uses MCP as a tool. [Scout's `MCPContextProvider`](/tutorials/scout/connect-mcp-servers) goes one step further: any MCP server becomes a registered context. Scout calls `query_mcp_<slug>` and a sub-agent answers from that server's tools. Same protocol, different ergonomic layer.

Source: [`agents/mcp/agent.py`](https://github.com/agno-agi/demo-os/blob/main/agents/mcp/agent.py)

## Next

[Context Providers →](/demo-os/context-providers)
