View a markdown version of this page

Claude Agent SDK and Claude Code - AWS Context

Claude Agent SDK and Claude Code

Claude Code connects as an MCP client (see Connect an MCP client). For the Claude Agent SDK, add the same server to mcp_servers and pre-approve the tools.

from claude_agent_sdk import ClaudeAgentOptions, query options = ClaudeAgentOptions( mcp_servers={ "agent-context": { "type": "stdio", "command": "uvx", "args": ["mcp-proxy-for-aws-cli@latest", "https://context-mcp.us-east-1.api.aws/mcp", "--service", "context-mcp", "--region", "us-east-1", "--read-timeout", "310", "--tool-timeout", "360"], "env": {"AWS_REGION": "us-east-1"}, } }, allowed_tools=["mcp__agent-context__context___AgenticRetrieveStream"], ) async for message in query(prompt="Which tables hold customer orders?", options=options): print(message)