# Serve your MCP server at its own hostname

> Agno's MCPConfig now takes root_host, path and path_aliases, so an AgentOS MCP server can answer at its own hostname, a custom path and older URLs. The server card is pretty-printed too.

- Published: 2026-09-16
- Author: Ashpreet Bedi
- Categories: Changelog
- Canonical: https://www.agno.com/articles/serve-your-mcp-server-at-its-own-hostname
- Markdown: https://www.agno.com/articles/serve-your-mcp-server-at-its-own-hostname.md

Agno's `MCPConfig` now handles routing you used to write middleware for. To put your AgentOS tool server at `mcp.example.com`, your middleware had to map `/` and `/server-card` onto the native `/mcp` routes. Now you set three parameters:

```python
agent_os = AgentOS(
    agents=[agent],
    mcp=MCPConfig(
        tools=[search_docs],
        default_tools=False,
        stateless=True,
        root_host="mcp.example.com",
        path="/docs-mcp",
        path_aliases=["/mcp"],
    ),
)
```

- `root_host` serves `/` and `/server-card` on that exact hostname, so clients can connect to `https://mcp.example.com`.
- `path` moves the MCP endpoint off the default `/mcp`.
- `path_aliases` keeps older URLs and links you've already shared working.

![One MCP server, reached three ways. mcp.example.com at the root, /docs-mcp as the path and /mcp as an alias all reach the same tool server. Any other host at / gets 404.](https://www.agno.com/images/v3-0-10-mcp-routing.png)

Every AgentOS MCP route reaches the same tool server with the same authentication and public quotas. MCP clients connect without a redirect. When a browser opens the endpoint, AgentOS redirects it to the server card. AgentOS routes the request before authentication, and a `server_card_url` you set still takes precedence.

AgentOS checks these `MCPConfig` values at startup and fails on invalid ones. Paths must be absolute and can't be `/`. `root_host` must be a bare hostname with no scheme, port or wildcard.

AgentOS now pretty-prints the MCP server card with two-space indentation, so it reads cleanly in a browser. This is the card that AgentOS serves at `mcp.example.com/server-card`:

```json
{
  "name": "com.example.mcp/agentos",
  "title": "AgentOS",
  "description": "AgentOS MCP server",
  "remotes": [
    {
      "type": "streamable-http",
      "url": "https://mcp.example.com/"
    }
  ],
  "tools": [
    {
      "name": "search_docs",
      "description": "Search the docs.",
      ...
```

See the [cookbook](https://github.com/agno-agi/agno/blob/main/cookbook/05_agent_os/27_public_pages/mcp_domain.py), and learn more about [MCPConfig](https://docs.agno.com/agent-os/mcp/mcp#mcpconfig) and [discovery](https://docs.agno.com/agent-os/mcp/mcp#discovery) in the documentation.
