# get_mcp_tools

> **Function** in `deepagents_cli`

📖 [View in docs](https://reference.langchain.com/python/deepagents-cli/mcp_tools/get_mcp_tools)

Load MCP tools from configuration file with stateful sessions.

Supports multiple server types:
- stdio: Spawns MCP servers as subprocesses with persistent sessions
- sse/http: Connects to remote MCP servers via URL

For stdio servers, this creates persistent sessions that remain active
across tool calls, avoiding server restarts. Sessions are managed by
`MCPSessionManager` and should be cleaned up with
`session_manager.cleanup()` when done.

## Signature

```python
get_mcp_tools(
    config_path: str,
) -> tuple[list[BaseTool], MCPSessionManager, list[MCPServerInfo]]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `config_path` | `str` | Yes | Path to MCP JSON configuration file. |

## Returns

`tuple[list[BaseTool], MCPSessionManager, list[MCPServerInfo]]`

Tuple of `(tools_list, session_manager, server_infos)` where:
- tools_list: List of LangChain `BaseTool` objects
- session_manager: `MCPSessionManager` instance
    (call `cleanup()` when done)
- server_infos: List of `MCPServerInfo` with per-server metadata

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/88c2b5cb874dc1d093acf54d2a967ba6e085c99b/libs/cli/deepagents_cli/mcp_tools.py#L553)