> For the complete documentation index, see [llms.txt](https://docs.allmcp.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.allmcp.co/documentation/agent-frameworks/anthropic-sdk.md).

# Anthropic SDK

Use AllMCP tools directly in the Anthropic Python SDK via the built-in MCP client.

{% hint style="info" %}
**No adapter needed.** The Anthropic SDK ships with native MCP client support — point it at `https://go.allmcp.co/mcp/` and the model can call AllMCP tools directly.
{% endhint %}

***

## Install

{% code title="install" %}

```bash
pip install anthropic
```

{% endcode %}

No extra MCP package needed — the Anthropic SDK includes MCP client support.

***

## Minimal example

{% code title="agent.py" overflow="wrap" %}

```python
import anthropic

client = anthropic.Anthropic(api_key="YOUR_ANTHROPIC_KEY")

response = client.beta.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=4096,
    mcp_servers=[
        {
            "type": "url",
            "url": "https://go.allmcp.co/mcp/",
            "name": "allmcp",
            "authorization_token": "YOUR_ALLMCP_KEY",
        }
    ],
    messages=[
        {"role": "user", "content": "List my Bitrix24 contacts"}
    ],
    betas=["mcp-client-2025-11-20"],
)

print(response.content)
```

{% endcode %}

***

## Multi-user setup

Pass `user_id` in the URL to scope tools to a specific user:

{% code title="agent.py" overflow="wrap" %}

```python
response = client.beta.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=4096,
    mcp_servers=[
        {
            "type": "url",
            "url": f"https://go.allmcp.co/mcp/?user_id={user_id}",
            "name": "allmcp",
            "authorization_token": "YOUR_ALLMCP_KEY",
        }
    ],
    messages=[{"role": "user", "content": "Show me my CRM pipeline"}],
    betas=["mcp-client-2025-11-20"],
)
```

{% endcode %}

{% hint style="info" %}
**One key, many users.** The `user_id` query parameter scopes the tool set to a specific user while you keep using the same AllMCP key.
{% endhint %}

***

## Multi-turn conversations

{% code title="agent.py" overflow="wrap" %}

```python
import anthropic

client = anthropic.Anthropic(api_key="YOUR_ANTHROPIC_KEY")

mcp_config = {
    "type": "url",
    "url": "https://go.allmcp.co/mcp/",
    "name": "allmcp",
    "authorization_token": "YOUR_ALLMCP_KEY",
}

messages = []

def chat(user_message: str) -> str:
    messages.append({"role": "user", "content": user_message})

    response = client.beta.messages.create(
        model="claude-sonnet-4-6",
        max_tokens=4096,
        mcp_servers=[mcp_config],
        messages=messages,
        betas=["mcp-client-2025-11-20"],
    )

    assistant_message = response.content[0].text
    messages.append({"role": "assistant", "content": assistant_message})
    return assistant_message


print(chat("Connect my Bitrix24"))
print(chat("Now list my top 10 deals by amount"))
```

{% endcode %}

***

## Beta header

{% hint style="warning" %}
**Beta header required.** The `betas=["mcp-client-2025-11-20"]` header enables the Anthropic SDK's MCP client feature. Without it, the model can't reach your AllMCP tools.
{% endhint %}

Once a provider is connected, its tools are available to the model through AllMCP, and you don't wire up any of the tools by hand.

***

## Provider pages

{% content-ref url="/pages/pIswsj1zBIS3PozhLKR5" %}
[Bitrix24](/documentation/providers/bitrix24.md)
{% endcontent-ref %}

{% content-ref url="/pages/61JdV5q06K5yArOoQanQ" %}
[Google Sheets](/documentation/providers/google-sheets.md)
{% endcontent-ref %}

{% content-ref url="/pages/rlbbOdK1cda3EcpoC9LO" %}
[amoCRM](/documentation/providers/amocrm.md)
{% endcontent-ref %}

{% content-ref url="/pages/QJVxDLqxIz5KMCH5afbE" %}
[All Providers](/documentation/providers/providers.md)
{% endcontent-ref %}

***

## Related

{% content-ref url="/pages/uBaUeZYQpupBMd5c1BY0" %}
[Overview](/documentation/agent-frameworks/frameworks.md)
{% endcontent-ref %}

{% content-ref url="/pages/QJVxDLqxIz5KMCH5afbE" %}
[All Providers](/documentation/providers/providers.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.allmcp.co/documentation/agent-frameworks/anthropic-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
