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

# Add MCP Server • AI Agent SDK

> add_mcp_server: Attach an MCP server to a live agent at runtime.

# add\_mcp\_server

Method

> This is a method of the [**Agent**](https://praison.ai/docs/sdk/reference/praisonaiagents/classes/Agent.md) class in the [**agent**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/agent.md) module.

Attach an MCP server to a live agent at runtime.

Connects the MCP server (discovering its tools), tracks it by name, and
appends it to `self.tools` so its tools become available on the next
turn of the same run — no agent rebuild required. New MCP tools flow
through the existing tool-execution and approval paths automatically.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def add_mcp_server(name: str, mcp: Any) -> Any
```

## Parameters

**name** `str` *required*

Unique name for this MCP server (used by `remove_mcp_server`).

**mcp** `Any` *required*

An `MCP` instance (e.g. `MCP("npx -y @notionhq/notion-mcp-server")`).

### Returns

**Returns** `Any`

The attached `MCP` instance.

## Usage

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents.mcp import MCP
    agent.add_mcp_server("notion", MCP("npx -y @notionhq/notion-mcp-server"))
    # tools live on the next turn
```

## Uses

* `ValueError`
* `refresh_tools`
* `logging.debug`

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/agent/agent.py#L6061)
>
> `praisonaiagents/agent/agent.py` at line 6061

***

## Related Documentation

> [card] [MCP Concept](https://praison.ai/docs/docs/concepts/mcp)

> [card] [MCP Lifecycle](https://praison.ai/docs/docs/features/mcp-lifecycle)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.