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

# How to set up the Atoti MCP Server in Python

> How to expose the Atoti MCP Server from an Atoti Python project through the `ai` plugin and an empty `AiConfig`, with the MCP endpoint location, authentication against the session's own security configuration, and steps to verify the tool list.

> [!NOTE]
>
> ### Atoti Intelligence SDK
>
> This is part of the Atoti Intelligence SDK offer.

This guide explains how to expose the Atoti MCP Server from an Atoti Python project. Read more about best practices for configuring MCP across a deployment in [What are the best practices for MCP configuration?](https://docs.activeviam.com/atoti-intelligence/6.2/developer-guide/mcp-server/introduction.md#what-are-the-best-practices-for-mcp-configuration).

> [!NOTE]
>
> This guide covers exposing the Atoti MCP Server, so external clients can call session tools. It differs from connecting to other MCP Servers, where a session uses another server's tools as its own. See [Connect to other MCP Servers in Python](https://docs.activeviam.com/atoti-intelligence/6.2/developer-guide/mcp-server/connect-to-other-servers/setup-python.md).

## Prerequisites

Before setting up the MCP Server, ensure the following requirements are met:

* An Atoti Python project
* A license including the Atoti Intelligence Extension tier, which itself requires Essentials

## How to install the package

Install the Atoti AI package:

```bash theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
uv add "atoti[ai]"
```

The `ai` plugin already brings the Atoti MCP Server through its own dependencies. No extra package or property is required, unlike the Java setup.

## How to enable the MCP Server

Pass an [`AiConfig`](https://docs.activeviam.com/engine/python-sdk/latest/api/atoti_ai.config.AiConfig) to [`SessionConfig`](https://docs.activeviam.com/engine/python-sdk/latest/api/atoti.config.SessionConfig) when starting the session. The MCP Server needs no LLM provider. An empty `AiConfig()` is enough, the same way Auto-Explain works without one:

```python theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
import atoti as tt
from atoti_ai import AiConfig

session = tt.Session.start(tt.SessionConfig(ai=AiConfig()))
```

## Where is the MCP endpoint?

The Atoti MCP Server is reachable at `f"{session.url}/mcp"`, over the Streamable HTTP transport.

## How to authenticate an MCP client

An MCP client authenticates against the session's own security configuration. The following example registers a user with HTTP Basic credentials and grants it a role:

```python theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
session.security.basic_authentication.credentials["mcp-user"] = "password"
session.security.individual_roles["mcp-user"] = {"ROLE_USER"}
```

An MCP client without valid credentials receives `401 Unauthorized`.

> [!NOTE]
>
> The Atoti Python SDK exposes no configuration for custom tools or for the OAuth 2.1 authentication modes. Both are set on a Java application; see [How to add custom tools](https://docs.activeviam.com/atoti-intelligence/6.2/developer-guide/mcp-server/custom-tools.md) and [Configure OAuth 2.1 discovery](https://docs.activeviam.com/atoti-intelligence/6.2/developer-guide/mcp-server/setup/configure-oauth2-discovery.md). A Python session serves the built-in cube tools and authenticates through its own security configuration.

## Verify the setup

After enabling the MCP Server, verify that it is available:

1. Start the Atoti session.
2. Create at least one cube, since the cube tools need one to be useful.
3. Point an MCP client at `{session.url}/mcp`.
4. Check that the tool list contains `runMdxQuery`.

## Related reading

* [How to set up the Atoti MCP Server in Java](./setup-java)
* [Connect to other MCP Servers in Python](https://docs.activeviam.com/atoti-intelligence/6.2/developer-guide/mcp-server/connect-to-other-servers/setup-python.md)
* [Connect with Postman](https://docs.activeviam.com/atoti-intelligence/6.2/developer-guide/mcp-server/setup/connect-with-postman.md) to test the MCP Server
* [Connect with Claude](https://docs.activeviam.com/atoti-intelligence/6.2/developer-guide/mcp-server/setup/connect-with-claude.md) to integrate with Claude AI
* [Configure OAuth 2.1 discovery](https://docs.activeviam.com/atoti-intelligence/6.2/developer-guide/mcp-server/setup/configure-oauth2-discovery.md) to enable browser-based SSO
  against your IdP for MCP clients
* [Add custom tools](https://docs.activeviam.com/atoti-intelligence/6.2/developer-guide/mcp-server/custom-tools.md) to extend functionality
* [What is the Atoti MCP Server?](https://docs.activeviam.com/atoti-intelligence/6.2/developer-guide/mcp-server/introduction.md)
* [`atoti_ai.AiConfig`](https://docs.activeviam.com/engine/python-sdk/latest/api/atoti_ai.config.AiConfig) API reference
