Skip to content

Anthropic SDK

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


install
pip install anthropic

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


agent.py
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)

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

agent.py
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"],
)

agent.py
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"))

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.