A command-line interface and API for analyzing AWS Bedrock usage and logs through Anthropic's MCP (Model Control Protocol).
This tool provides a convenient way to analyze AWS Bedrock model invocation logs using Anthropic's Claude model as an interactive interface. It functions as an MCP server that exposes AWS CloudWatch Logs API functionality to Claude, allowing you to query and analyze your Bedrock usage data in natural language.
Install uv
:
# On macOS and Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# On Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Clone this repository:
git clone https://github.com/dheerajoruganty/aws-bedrock-logs-mcp-server.git
cd aws-bedrock-logs-mcp-server
Set up the Python virtual environment and install dependencies:
uv venv && source .venv/bin/activate && uv pip sync pyproject.toml
For Windows:
uv venv && .venv\Scripts\activate && uv pip sync pyproject.toml
Configure your AWS credentials:
mkdir -p ~/.aws
# Set up your credentials in ~/.aws/credentials and ~/.aws/config
Run the server using:
python cloudwatch_mcp_server.py
By default, the server uses stdio transport for communication with MCP clients.
Configure this tool with Claude Desktop:
{
"mcpServers": {
"aws_bedrock_logs": {
"command": "uv",
"args": [
"--directory",
"/path/to/aws-bedrock-logs-mcp",
"run",
"cloudwatch_mcp_server.py"
]
}
}
}
Make sure to replace the directory path with the actual path to your repository on your system.
The server exposes the following tools that Claude can use:
get_bedrock_logs_df
: Retrieve raw Bedrock invocation logs as a pandas DataFrameget_model_usage_stats
: Get usage statistics grouped by modelget_user_usage_stats
: Get usage statistics grouped by userget_daily_usage_stats
: Get daily usage statistics and trendsOnce connected to Claude through an MCP-enabled interface, you can ask questions like:
cloudwatch_mcp_server.py
: Main server implementation with MCP toolspyproject.toml
: Project dependencies and metadataDockerfile
: Container definition for deploymentsKey dependencies include:
boto3
: AWS SDK for Pythonmcp[cli]
: Anthropic's Model Control Protocolpandas
: Data manipulation and analysispydantic
: Data validation using Python type annotations
{
"mcpServers": {
"aws_bedrock_logs": {
"env": {},
"args": [
"--directory",
"/path/to/aws-bedrock-logs-mcp",
"run",
"cloudwatch_mcp_server.py"
],
"command": "uv"
}
}
}
Seamless access to top MCP servers powering the future of AI integration.