-
Notifications
You must be signed in to change notification settings - Fork 319
Description
Hi ,
I am testing the Anthropic API / MCP integration in Python SDK. I received the error:
"AttributeError: module 'anthropic' has no attribute 'beta'
Have you run into this ? Any idea if the Python SDK is ready for beta messages API ?
my code:
import anthropic
#client = anthropic.Anthropic()
response = anthropic.beta.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1000,
messages=[{
"role": "user",
"content": "What tools do you have available?"
}],
mcp_servers=[{
"type": "url",
"url": "http://a.b.c.d/mcp",
"name": "xyz01",
}],
betas=["mcp-client-2025-04-04"]
)
print(response.content)
Reference doc/example:
https://docs.anthropic.com/en/docs/agents-and-tools/mcp-connector
Anthropic SDK version:
Version: 0.62.0
Anthropic SDK libraries / namespaces :
['AI_PROMPT', 'APIConnectionError', 'APIError', 'APIResponse', 'APIResponseValidationError', 'APIStatusError', 'APITimeoutError', 'Anthropic', 'AnthropicBedrock', 'AnthropicError', 'AnthropicVertex', 'AsyncAPIResponse', 'AsyncAnthropic', 'AsyncAnthropicBedrock', 'AsyncAnthropicVertex', 'AsyncClient', 'AsyncMessageStream', 'AsyncMessageStreamManager', 'AsyncStream', 'AuthenticationError', 'BadRequestError', 'BaseModel', 'BetaAsyncMessageStream', 'BetaAsyncMessageStreamManager', 'BetaContentBlockStopEvent', 'BetaInputJsonEvent', 'BetaMessageStopEvent', 'BetaMessageStream', 'BetaMessageStreamEvent', 'BetaMessageStreamManager', 'BetaTextEvent', 'Client', 'ConflictError', 'ContentBlockStopEvent', 'DEFAULT_CONNECTION_LIMITS', 'DEFAULT_MAX_RETRIES', 'DEFAULT_TIMEOUT', 'DefaultAioHttpClient', 'DefaultAsyncHttpxClient', 'DefaultHttpxClient', 'HUMAN_PROMPT', 'InputJsonEvent', 'InternalServerError', 'MessageStopEvent', 'MessageStream', 'MessageStreamEvent', 'MessageStreamManager', 'NOT_GIVEN', 'NoneType', 'NotFoundError', 'NotGiven', 'Omit', 'PermissionDeniedError', 'ProxiesTypes', 'RateLimitError', 'RequestOptions', 'Stream', 'TextEvent', 'Timeout', 'Transport', 'UnprocessableEntityError', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__locals', '__name', '__name__', '__package__', '__path__', '__spec__', '__title__', '__version__', '_base_client', '_client', '_compat', '_constants', '_decoders', '_exceptions', '_files', '_legacy_response', '_models', '_qs', '_resource', '_response', '_setup_logging', '_streaming', '_t', '_types', '_utils', '_version', 'file_from_path', 'lib', 'pagination', 'resources', 'types']