AWS CloudTrail — Claude Code MCP server: what it does, how to install
AWS CloudTrail lets an agent search CloudTrail events and run SQL against CloudTrail Lake to trace API calls and user activity.
Apache-2.0 ★ 9,939 updated 2026-10-23
Open on GitHubWhat AWS CloudTrail does
One server from the awslabs/mcp collection, five tools. lookup_events takes a username, event name or resource and returns management events from the past 90 days, paged. lake_query runs Trino-style SQL over CloudTrail Lake, with get_query_status and get_query_results for long jobs. list_event_data_stores shows which event data stores the account holds.
You need an AWS account where CloudTrail is on, plus credentials the server can pick up. aws configure writes them, environment variables work too. Event history records by default; Lake is a separate switch you turn on yourself. The IAM policy has to allow cloudtrail:LookupEvents, cloudtrail:ListEventDataStores, cloudtrail:GetEventDataStore, cloudtrail:StartQuery, cloudtrail:DescribeQuery and cloudtrail:GetQueryResults. Drop one and the matching tool fails with an access error.
Two install paths. The uvx route needs uv and Python 3.10 through uv python install 3.10; the MCP entry then calls uvx with awslabs.cloudtrail-mcp-server@latest and an AWS_PROFILE value. The other route builds a Docker image from src/cloudtrail-mcp-server/. Either way the process stays on your own machine, next to the client.
What it helps with
- find who deleted an IAM role in the last 90 days of events
- count
AssumeRolecalls per user with a Lake query - check what an access key did before a security group change
- list event data stores to see which audit data is queryable
- trace one user's activity across AWS services
Example prompts for the agent
- Look up every
DeleteRoleevent from the last 90 days and tell me which user made each call. - Run a
lake_querythat groupsAssumeRolecalls by user. - Check the status of my CloudTrail Lake query and pull the results.
How to install AWS CloudTrail
Install
The MCP registry has no launch command for it: see the repository README
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about AWS CloudTrail
How do I install the AWS CloudTrail MCP server in Claude Code?
Install uv, then run uv python install 3.10. Add an MCP entry with command uvx, argument awslabs.cloudtrail-mcp-server@latest, your profile in AWS_PROFILE, and stdio as the transport.
What does this server do?
It hands the agent CloudTrail tooling: event search across 90 days, SQL on CloudTrail Lake with status polling and paged results, plus a listing of event data stores.
Do I need CloudTrail Lake enabled for the SQL tools?
Yes. Turn on CloudTrail Lake and grant cloudtrail:StartQuery, cloudtrail:DescribeQuery and cloudtrail:GetQueryResults. Event lookup still works against the default history.