awslabs.cloudtrail-mcp-server 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
awslabs/__init__.py ADDED
@@ -0,0 +1,16 @@
1
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # This file is part of the awslabs namespace.
16
+ # It is intentionally minimal to support PEP 420 namespace packages.
@@ -0,0 +1,18 @@
1
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """awslabs.cloudtrail-mcp-server"""
16
+
17
+ __version__ = '0.0.1'
18
+ MCP_SERVER_VERSION = __version__
@@ -0,0 +1,157 @@
1
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """Common utilities for CloudTrail MCP Server."""
16
+
17
+ import re
18
+ from datetime import datetime, timedelta, timezone
19
+ from typing import Any, Dict, Optional
20
+
21
+
22
+ def remove_null_values(data: Dict[str, Any]) -> Dict[str, Any]:
23
+ """Remove keys with None values from a dictionary.
24
+
25
+ Args:
26
+ data: Dictionary to clean
27
+
28
+ Returns:
29
+ Dictionary with None values removed
30
+ """
31
+ return {k: v for k, v in data.items() if v is not None}
32
+
33
+
34
+ def parse_relative_time(time_str: str) -> datetime:
35
+ """Parse relative time strings like '1 hour ago', '2 days ago', etc.
36
+
37
+ Args:
38
+ time_str: Relative time string
39
+
40
+ Returns:
41
+ Parsed datetime object
42
+
43
+ Raises:
44
+ ValueError: If time string format is invalid
45
+ """
46
+ now = datetime.now(timezone.utc)
47
+
48
+ # Handle 'now' case
49
+ if time_str.lower() == 'now':
50
+ return now
51
+
52
+ # Parse relative time patterns
53
+ pattern = r'(\d+)\s+(second|minute|hour|day|week|month|year)s?\s+ago'
54
+ match = re.match(pattern, time_str.lower())
55
+
56
+ if not match:
57
+ raise ValueError(f'Invalid relative time format: {time_str}')
58
+
59
+ amount = int(match.group(1))
60
+ unit = match.group(2)
61
+
62
+ if unit == 'second':
63
+ delta = timedelta(seconds=amount)
64
+ elif unit == 'minute':
65
+ delta = timedelta(minutes=amount)
66
+ elif unit == 'hour':
67
+ delta = timedelta(hours=amount)
68
+ elif unit == 'day':
69
+ delta = timedelta(days=amount)
70
+ elif unit == 'week':
71
+ delta = timedelta(weeks=amount)
72
+ elif unit == 'month':
73
+ delta = timedelta(days=amount * 30) # Approximate
74
+ elif unit == 'year':
75
+ delta = timedelta(days=amount * 365) # Approximate
76
+ else:
77
+ raise ValueError(f'Unknown time unit: {unit}')
78
+
79
+ return now - delta
80
+
81
+
82
+ def parse_time_input(time_input: str) -> datetime:
83
+ """Parse time input which can be ISO format or relative time.
84
+
85
+ Args:
86
+ time_input: Time string in ISO format or relative format
87
+
88
+ Returns:
89
+ Parsed datetime object
90
+
91
+ Raises:
92
+ ValueError: If time format is invalid
93
+ """
94
+ # Try parsing as ISO format first
95
+ iso_parsing_errors = []
96
+
97
+ # Handle various ISO formats
98
+ for fmt in [
99
+ '%Y-%m-%dT%H:%M:%S%z',
100
+ '%Y-%m-%dT%H:%M:%S.%f%z',
101
+ '%Y-%m-%dT%H:%M:%SZ',
102
+ '%Y-%m-%dT%H:%M:%S.%fZ',
103
+ '%Y-%m-%dT%H:%M:%S',
104
+ '%Y-%m-%d %H:%M:%S',
105
+ '%Y-%m-%d',
106
+ ]:
107
+ try:
108
+ parsed = datetime.strptime(time_input, fmt)
109
+ # If no timezone info, assume UTC
110
+ if parsed.tzinfo is None:
111
+ parsed = parsed.replace(tzinfo=timezone.utc)
112
+ return parsed
113
+ except ValueError as e:
114
+ iso_parsing_errors.append(f"Format '{fmt}': {str(e)}")
115
+ continue
116
+
117
+ # Try parsing with dateutil if available, otherwise try isoformat
118
+ try:
119
+ parsed = datetime.fromisoformat(time_input.replace('Z', '+00:00'))
120
+ return parsed
121
+ except ValueError as e:
122
+ iso_parsing_errors.append(f'ISO format parsing: {str(e)}')
123
+
124
+ # If ISO parsing fails, try relative time parsing
125
+ try:
126
+ return parse_relative_time(time_input)
127
+ except ValueError as e:
128
+ # If both ISO and relative parsing fail, raise a comprehensive error
129
+ error_msg = f"Unable to parse time input '{time_input}'. "
130
+ error_msg += f'Relative time parsing error: {str(e)}. '
131
+ error_msg += f'ISO format errors: {"; ".join(iso_parsing_errors[-2:])}' # Show last 2 errors to avoid clutter
132
+ raise ValueError(error_msg)
133
+
134
+
135
+ def validate_max_results(
136
+ max_results: Optional[int], default: int = 10, max_allowed: int = 50
137
+ ) -> int:
138
+ """Validate and return appropriate max_results value.
139
+
140
+ Args:
141
+ max_results: Requested max results
142
+ default: Default value if None
143
+ max_allowed: Maximum allowed value
144
+
145
+ Returns:
146
+ Validated max_results value
147
+ """
148
+ if max_results is None:
149
+ return default
150
+
151
+ if max_results < 1:
152
+ return 1
153
+
154
+ if max_results > max_allowed:
155
+ return max_allowed
156
+
157
+ return max_results
@@ -0,0 +1,79 @@
1
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """Pydantic models for CloudTrail MCP Server."""
16
+
17
+ from datetime import datetime
18
+ from pydantic import BaseModel, ConfigDict, Field, field_serializer
19
+ from typing import Any, Dict, List, Optional
20
+
21
+
22
+ class EventDataStore(BaseModel):
23
+ """Model for CloudTrail Lake Event Data Store."""
24
+
25
+ event_data_store_arn: Optional[str] = Field(None, alias='EventDataStoreArn')
26
+ name: Optional[str] = Field(None, alias='Name')
27
+ status: Optional[str] = Field(None, alias='Status')
28
+ advanced_event_selectors: Optional[List[Dict[str, Any]]] = Field(
29
+ None, alias='AdvancedEventSelectors'
30
+ )
31
+ multi_region_enabled: Optional[bool] = Field(None, alias='MultiRegionEnabled')
32
+ organization_enabled: Optional[bool] = Field(None, alias='OrganizationEnabled')
33
+ retention_period: Optional[int] = Field(None, alias='RetentionPeriod')
34
+ termination_protection_enabled: Optional[bool] = Field(
35
+ None, alias='TerminationProtectionEnabled'
36
+ )
37
+ created_timestamp: Optional[datetime] = Field(None, alias='CreatedTimestamp')
38
+ updated_timestamp: Optional[datetime] = Field(None, alias='UpdatedTimestamp')
39
+ kms_key_id: Optional[str] = Field(None, alias='KmsKeyId')
40
+ billing_mode: Optional[str] = Field(None, alias='BillingMode')
41
+
42
+ model_config = ConfigDict(populate_by_name=True)
43
+
44
+ @field_serializer('created_timestamp', 'updated_timestamp')
45
+ def serialize_datetime(self, value: Optional[datetime]) -> Optional[str]:
46
+ """Serialize datetime to ISO format."""
47
+ return value.isoformat() if value else None
48
+
49
+
50
+ class QueryResult(BaseModel):
51
+ """Model for CloudTrail Lake query result."""
52
+
53
+ query_id: str
54
+ query_status: str
55
+ query_statistics: Optional[Dict[str, Any]] = None
56
+ query_result_rows: Optional[List[List[Dict[str, str]]]] = None
57
+ next_token: Optional[str] = None
58
+ error_message: Optional[str] = None
59
+
60
+ def model_dump(self, **kwargs):
61
+ """Override model_dump to exclude None values."""
62
+ kwargs.setdefault('exclude_none', True)
63
+ return super().model_dump(**kwargs)
64
+
65
+
66
+ class QueryStatus(BaseModel):
67
+ """Model for CloudTrail Lake query status."""
68
+
69
+ query_id: str
70
+ query_status: str
71
+ query_statistics: Optional[Dict[str, Any]] = None
72
+ error_message: Optional[str] = None
73
+ delivery_s3_uri: Optional[str] = None
74
+ delivery_status: Optional[str] = None
75
+
76
+ def model_dump(self, **kwargs):
77
+ """Override model_dump to exclude None values."""
78
+ kwargs.setdefault('exclude_none', True)
79
+ return super().model_dump(**kwargs)
@@ -0,0 +1,49 @@
1
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """awslabs cloudtrail MCP Server implementation."""
16
+
17
+ from awslabs.cloudtrail_mcp_server.tools import CloudTrailTools
18
+ from loguru import logger
19
+ from mcp.server.fastmcp import FastMCP
20
+
21
+
22
+ mcp = FastMCP(
23
+ 'awslabs.cloudtrail-mcp-server',
24
+ instructions='Use this MCP server to query AWS CloudTrail events for security investigations, compliance auditing, and operational troubleshooting. Supports event lookup by various attributes (username, event name, resource name, etc.), user activity analysis, API call tracking, and advanced CloudTrail Lake SQL queries for complex analytics. Can search the last 90 days of management events and provides detailed event summaries and activity analysis.',
25
+ dependencies=[
26
+ 'boto3',
27
+ 'botocore',
28
+ 'pydantic',
29
+ 'loguru',
30
+ ],
31
+ )
32
+
33
+ # Initialize and register CloudTrail tools
34
+ try:
35
+ cloudtrail_tools = CloudTrailTools()
36
+ cloudtrail_tools.register(mcp)
37
+ logger.info('CloudTrail tools registered successfully')
38
+ except Exception as e:
39
+ logger.error(f'Error initializing CloudTrail tools: {str(e)}')
40
+ raise
41
+
42
+
43
+ def main():
44
+ """Run the MCP server."""
45
+ mcp.run()
46
+
47
+
48
+ if __name__ == '__main__':
49
+ main()
@@ -0,0 +1,545 @@
1
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """CloudTrail tools for MCP server."""
16
+
17
+ import boto3
18
+ import os
19
+ import time
20
+ from awslabs.cloudtrail_mcp_server import MCP_SERVER_VERSION
21
+ from awslabs.cloudtrail_mcp_server.common import (
22
+ parse_time_input,
23
+ remove_null_values,
24
+ validate_max_results,
25
+ )
26
+ from awslabs.cloudtrail_mcp_server.models import (
27
+ EventDataStore,
28
+ QueryResult,
29
+ QueryStatus,
30
+ )
31
+ from botocore.config import Config
32
+ from loguru import logger
33
+ from mcp.server.fastmcp import Context
34
+ from pydantic import Field
35
+ from typing import Annotated, Any, Dict, List, Literal, Optional
36
+
37
+
38
+ class CloudTrailTools:
39
+ """CloudTrail tools for MCP server."""
40
+
41
+ def __init__(self):
42
+ """Initialize the CloudTrail tools."""
43
+ pass
44
+
45
+ def _get_cloudtrail_client(self, region: str):
46
+ """Create a CloudTrail client for the specified region."""
47
+ config = Config(user_agent_extra=f'awslabs/mcp/cloudtrail-mcp-server/{MCP_SERVER_VERSION}')
48
+
49
+ try:
50
+ if aws_profile := os.environ.get('AWS_PROFILE'):
51
+ return boto3.Session(profile_name=aws_profile, region_name=region).client(
52
+ 'cloudtrail', config=config
53
+ )
54
+ else:
55
+ return boto3.Session(region_name=region).client('cloudtrail', config=config)
56
+ except Exception as e:
57
+ logger.error(f'Error creating CloudTrail client for region {region}: {str(e)}')
58
+ raise
59
+
60
+ def register(self, mcp):
61
+ """Register all CloudTrail tools with the MCP server."""
62
+ # Register simplified lookup_events tool that handles all filtering
63
+ mcp.tool(name='lookup_events')(self.lookup_events)
64
+
65
+ # Register lake_query tool
66
+ mcp.tool(name='lake_query')(self.lake_query)
67
+
68
+ # Register get_query_status tool
69
+ mcp.tool(name='get_query_status')(self.get_query_status)
70
+
71
+ # Register get_query_results tool
72
+ mcp.tool(name='get_query_results')(self.get_query_results)
73
+
74
+ # Register list_event_data_stores tool
75
+ mcp.tool(name='list_event_data_stores')(self.list_event_data_stores)
76
+
77
+ async def lookup_events(
78
+ self,
79
+ ctx: Context,
80
+ start_time: Annotated[
81
+ Optional[str],
82
+ Field(
83
+ description='Start time for event lookup (ISO format or relative like "1 day ago"). IMPORTANT: When using pagination (next_token), you must provide the exact same start_time as the original request.'
84
+ ),
85
+ ] = None,
86
+ end_time: Annotated[
87
+ Optional[str],
88
+ Field(
89
+ description='End time for event lookup (ISO format or relative like "1 hour ago"). IMPORTANT: When using pagination (next_token), you must provide the exact same end_time as the original request.'
90
+ ),
91
+ ] = None,
92
+ attribute_key: Annotated[
93
+ Optional[
94
+ Literal[
95
+ 'EventId',
96
+ 'EventName',
97
+ 'ReadOnly',
98
+ 'Username',
99
+ 'ResourceType',
100
+ 'ResourceName',
101
+ 'EventSource',
102
+ 'AccessKeyId',
103
+ ]
104
+ ],
105
+ Field(description='Attribute to search by'),
106
+ ] = None,
107
+ attribute_value: Annotated[
108
+ Optional[str], Field(description='Value to search for in the specified attribute')
109
+ ] = None,
110
+ max_results: Annotated[
111
+ Optional[int],
112
+ Field(description='Maximum number of events to return (1-50, default: 10)'),
113
+ ] = None,
114
+ next_token: Annotated[
115
+ Optional[str],
116
+ Field(
117
+ description='Token for pagination to fetch the next page of events. IMPORTANT: When using this token, all other parameters (start_time, end_time, attribute_key, attribute_value) must match exactly the original request that generated this token.'
118
+ ),
119
+ ] = None,
120
+ region: Annotated[
121
+ str,
122
+ Field(description='AWS region to query. Defaults to us-east-1.'),
123
+ ] = 'us-east-1',
124
+ ) -> Dict[str, Any]:
125
+ """Look up CloudTrail events based on various criteria.
126
+
127
+ This tool searches CloudTrail events using the LookupEvents API, which provides access to the
128
+ last 90 days of management events. You can filter by time range and search for specific
129
+ attribute values.
130
+
131
+ Usage: Use this tool to find CloudTrail events by various attributes like username, event name,
132
+ resource name, etc. This is useful for security investigations, troubleshooting, and audit trails.
133
+
134
+ IMPORTANT PAGINATION REQUIREMENTS:
135
+ - AWS CloudTrail requires pagination tokens to be used with exactly the same parameters as the original request
136
+ - When using next_token, you must provide the exact same start_time, end_time, attribute_key, and attribute_value
137
+ - Use the 'query_params' returned in the response for subsequent paginated requests
138
+
139
+ Returns:
140
+ --------
141
+ Dictionary containing:
142
+ - events: List of CloudTrail events matching the criteria with exact CloudTrail schema
143
+ - next_token: Token for pagination if more results available
144
+ - query_params: Parameters used for the query (includes pagination parameters when next_token is present)
145
+ """
146
+ try:
147
+ # Create CloudTrail client for the specified region
148
+ cloudtrail_client = self._get_cloudtrail_client(region)
149
+
150
+ # Handle time input validation and parsing
151
+ if next_token:
152
+ # When using pagination, both start_time and end_time are required
153
+ if not start_time or not end_time:
154
+ raise ValueError(
155
+ 'Both start_time and end_time are required when using pagination (next_token). '
156
+ 'Use the exact start_time and end_time from the "query_params" in the previous response.'
157
+ )
158
+ try:
159
+ # Parse times for pagination (should be in ISO format from previous response)
160
+ start_dt = parse_time_input(start_time)
161
+ end_dt = parse_time_input(end_time)
162
+ except Exception as e:
163
+ raise ValueError(
164
+ f'Invalid time format for pagination. Use the exact start_time and end_time from the '
165
+ f"'query_params' in the previous response. Error: {str(e)}"
166
+ )
167
+ else:
168
+ # First request - use provided times or defaults
169
+ start_time = start_time or '1 day ago'
170
+ end_time = end_time or 'now'
171
+ start_dt = parse_time_input(start_time)
172
+ end_dt = parse_time_input(end_time)
173
+
174
+ # Validate max_results
175
+ max_results = validate_max_results(max_results, default=10, max_allowed=50)
176
+
177
+ # Build lookup parameters
178
+ lookup_params = {
179
+ 'StartTime': start_dt,
180
+ 'EndTime': end_dt,
181
+ 'MaxResults': max_results,
182
+ }
183
+
184
+ # Add attribute filter if provided
185
+ if attribute_key and attribute_value:
186
+ lookup_params['LookupAttributes'] = [
187
+ {'AttributeKey': attribute_key, 'AttributeValue': attribute_value}
188
+ ]
189
+
190
+ # Add next_token for pagination if provided
191
+ if next_token:
192
+ lookup_params['NextToken'] = next_token
193
+
194
+ logger.info(f'Looking up CloudTrail events with params: {lookup_params}')
195
+
196
+ # Call CloudTrail API
197
+ response = cloudtrail_client.lookup_events(**remove_null_values(lookup_params))
198
+
199
+ # Build result with consistent parameter format
200
+ result = {
201
+ 'events': response.get('Events', []),
202
+ 'next_token': response.get('NextToken'),
203
+ 'query_params': {
204
+ 'start_time': start_dt.isoformat(),
205
+ 'end_time': end_dt.isoformat(),
206
+ 'attribute_key': attribute_key,
207
+ 'attribute_value': attribute_value,
208
+ 'max_results': max_results,
209
+ 'region': region,
210
+ },
211
+ }
212
+
213
+ logger.info(
214
+ f'Successfully retrieved {len(result["events"])} CloudTrail events from region {region}'
215
+ )
216
+ return result
217
+
218
+ except Exception as e:
219
+ logger.error(f'Error in lookup_events: {str(e)}')
220
+ await ctx.error(f'Error looking up CloudTrail events: {str(e)}')
221
+ raise
222
+
223
+ async def lake_query(
224
+ self,
225
+ ctx: Context,
226
+ sql: Annotated[
227
+ str,
228
+ Field(
229
+ description="SQL query to execute against CloudTrail Lake. IMPORTANT: You must include a valid Event Data Store (EDS) ID in the FROM clause of your SQL query. Use list_event_data_stores tool to get available EDS IDs first. CloudTrail Lake only supports SELECT statements using Trino-compatible SQL syntax. Example: SELECT * FROM 0233062b-51c6-4d18-8dec-a8c90da840d9 WHERE eventname = 'ConsoleLogin'"
230
+ ),
231
+ ],
232
+ wait_for_completion: Annotated[
233
+ bool,
234
+ Field(
235
+ description='Whether to wait for query completion and return results. If False, returns immediately with query_id for manual result fetching using get_query_results. Default: True'
236
+ ),
237
+ ] = True,
238
+ region: Annotated[
239
+ str,
240
+ Field(description='AWS region to query. Defaults to us-east-1.'),
241
+ ] = 'us-east-1',
242
+ ) -> QueryResult:
243
+ """Execute a SQL query against CloudTrail Lake for complex analytics and filtering.
244
+
245
+ CloudTrail Lake allows you to run SQL queries against your CloudTrail events for advanced
246
+ analysis. This is more powerful than the basic lookup functions and allows for complex
247
+ filtering, aggregation, and analysis.
248
+
249
+ PAGINATION WORKFLOW:
250
+ For large result sets, you have two options:
251
+ 1. Use wait_for_completion=False to get the query_id immediately, then use get_query_results with pagination
252
+ 2. Use wait_for_completion=True (default) to get first page of results, then use get_query_results with next_token for additional pages
253
+
254
+ IMPORTANT LIMITATIONS:
255
+ - CloudTrail Lake only supports SELECT statements using Trino-compatible SQL syntax
256
+ - INSERT, UPDATE, DELETE, CREATE, DROP, and other DDL/DML operations are not supported
257
+ - Your SQL query MUST include a valid Event Data Store (EDS) ID in the FROM clause
258
+ - Use the list_event_data_stores tool first to get available EDS IDs, then reference the EDS ID
259
+ directly in your FROM clause
260
+
261
+ Valid SQL query examples:
262
+ - SELECT eventname, count(*) FROM 0233062b-51c6-4d18-8dec-a8c90da840d9 WHERE eventtime > '2023-01-01' GROUP BY eventname
263
+ - SELECT useridentity.username, eventname, eventtime FROM your-eds-id WHERE errorcode IS NOT NULL
264
+ - SELECT DISTINCT awsregion FROM your-eds-id WHERE eventname = 'CreateUser'
265
+
266
+ Returns:
267
+ --------
268
+ QueryResult containing:
269
+ - query_id: Unique identifier for the query
270
+ - query_status: Current status of the query
271
+ - query_result_rows: Results if query completed successfully (only when wait_for_completion=True)
272
+ - next_token: Token for pagination (only when wait_for_completion=True and results are paginated)
273
+ - query_statistics: Performance statistics for the query
274
+ """
275
+ try:
276
+ # Create CloudTrail client for the specified region
277
+ cloudtrail_client = self._get_cloudtrail_client(region)
278
+
279
+ logger.info(f'Starting CloudTrail Lake query in region {region}')
280
+ logger.info(f'SQL: {sql}')
281
+
282
+ # Start the query directly with the provided SQL
283
+ start_response = cloudtrail_client.start_query(
284
+ QueryStatement=sql,
285
+ )
286
+
287
+ query_id = start_response['QueryId']
288
+ logger.info(f'Started query with ID: {query_id}')
289
+
290
+ # If not waiting for completion, return immediately with query_id
291
+ if not wait_for_completion:
292
+ # Get initial status to return
293
+ initial_status = cloudtrail_client.describe_query(QueryId=query_id)
294
+ return QueryResult(
295
+ query_id=query_id,
296
+ query_status=initial_status['QueryStatus'],
297
+ query_statistics=initial_status.get('QueryStatistics'),
298
+ error_message=initial_status.get('ErrorMessage'),
299
+ )
300
+
301
+ # Poll for completion (with a reasonable timeout)
302
+ max_wait_time = 300 # 5 minutes
303
+ poll_interval = 2 # 2 seconds
304
+ elapsed_time = 0
305
+
306
+ # Initialize variables to avoid "possibly unbound" errors
307
+ query_status = 'RUNNING'
308
+ status_response = {}
309
+
310
+ while elapsed_time < max_wait_time:
311
+ status_response = cloudtrail_client.describe_query(QueryId=query_id)
312
+ query_status = status_response['QueryStatus']
313
+
314
+ if query_status in ['FINISHED', 'FAILED', 'CANCELLED', 'TIMED_OUT']:
315
+ break
316
+
317
+ time.sleep(poll_interval)
318
+ elapsed_time += poll_interval
319
+
320
+ # Get final results
321
+ if query_status == 'FINISHED':
322
+ # Use the existing get_query_results method for consistency and better error handling
323
+ return await self.get_query_results(
324
+ ctx=ctx, query_id=query_id, max_results=50, next_token=None, region=region
325
+ )
326
+ else:
327
+ return QueryResult(
328
+ query_id=query_id,
329
+ query_status=query_status,
330
+ query_statistics=status_response.get('QueryStatistics'),
331
+ error_message=status_response.get('ErrorMessage'),
332
+ )
333
+
334
+ except Exception as e:
335
+ logger.error(f'Error in lake_query: {str(e)}')
336
+ await ctx.error(f'Error executing CloudTrail Lake query: {str(e)}')
337
+ raise
338
+
339
+ async def get_query_status(
340
+ self,
341
+ ctx: Context,
342
+ query_id: Annotated[str, Field(description='The ID of the query to check status for')],
343
+ region: Annotated[
344
+ str,
345
+ Field(description='AWS region to query. Defaults to us-east-1.'),
346
+ ] = 'us-east-1',
347
+ ) -> QueryStatus:
348
+ """Get the status of a CloudTrail Lake query.
349
+
350
+ This tool checks the status of a previously started CloudTrail Lake query. Use this
351
+ when you need to check if a long-running query has completed or if you want to get
352
+ details about query execution.
353
+
354
+ Usage: Use this tool to monitor the progress of CloudTrail Lake queries, especially
355
+ long-running ones that may take time to complete.
356
+
357
+ Returns:
358
+ --------
359
+ QueryStatus containing:
360
+ - query_id: The query identifier
361
+ - query_status: Current status (QUEUED, RUNNING, FINISHED, FAILED, CANCELLED, TIMED_OUT)
362
+ - query_statistics: Performance and execution statistics
363
+ - error_message: Error details if the query failed
364
+ """
365
+ try:
366
+ # Create CloudTrail client for the specified region
367
+ cloudtrail_client = self._get_cloudtrail_client(region)
368
+
369
+ logger.info(f'Checking status for query {query_id} in region {region}')
370
+
371
+ # Get query status
372
+ response = cloudtrail_client.describe_query(QueryId=query_id)
373
+
374
+ return QueryStatus(
375
+ query_id=query_id,
376
+ query_status=response['QueryStatus'],
377
+ query_statistics=response.get('QueryStatistics'),
378
+ error_message=response.get('ErrorMessage'),
379
+ delivery_s3_uri=response.get('DeliveryS3Uri'),
380
+ delivery_status=response.get('DeliveryStatus'),
381
+ )
382
+
383
+ except Exception as e:
384
+ logger.error(f'Error in get_query_status: {str(e)}')
385
+ await ctx.error(f'Error getting query status: {str(e)}')
386
+ raise
387
+
388
+ async def get_query_results(
389
+ self,
390
+ ctx: Context,
391
+ query_id: Annotated[str, Field(description='The ID of the query to get results for')],
392
+ max_results: Annotated[
393
+ Optional[int],
394
+ Field(description='Maximum number of results to return per page (1-50, default: 50)'),
395
+ ] = None,
396
+ next_token: Annotated[
397
+ Optional[str],
398
+ Field(
399
+ description='Token for pagination to fetch the next page of results. Use the next_token returned from a previous call to get successive pages.'
400
+ ),
401
+ ] = None,
402
+ region: Annotated[
403
+ str,
404
+ Field(description='AWS region to query. Defaults to us-east-1.'),
405
+ ] = 'us-east-1',
406
+ ) -> QueryResult:
407
+ """Get the results of a completed CloudTrail Lake query with pagination support.
408
+
409
+ This tool retrieves the results of a previously executed CloudTrail Lake query. It supports
410
+ pagination for large result sets, allowing you to fetch results in chunks.
411
+
412
+ Usage: Use this tool to get the results of a query that has completed (status = 'FINISHED').
413
+ For large result sets, use the next_token to fetch subsequent pages of results.
414
+
415
+ Pagination workflow:
416
+ 1. Call get_query_results with just the query_id to get the first page
417
+ 2. If next_token is returned, call again with the same query_id and the next_token
418
+ 3. Repeat until next_token is null/empty
419
+
420
+ Returns:
421
+ --------
422
+ QueryResult containing:
423
+ - query_id: The query identifier
424
+ - query_status: Current status of the query
425
+ - query_result_rows: Results for this page
426
+ - next_token: Token for next page (null if no more pages)
427
+ - query_statistics: Performance statistics for the query
428
+ """
429
+ try:
430
+ # Create CloudTrail client for the specified region
431
+ cloudtrail_client = self._get_cloudtrail_client(region)
432
+
433
+ logger.info(f'Getting results for query {query_id} in region {region}')
434
+
435
+ # Validate max_results
436
+ max_results = validate_max_results(max_results, default=50, max_allowed=50)
437
+
438
+ # Build parameters for get_query_results
439
+ params = {
440
+ 'QueryId': query_id,
441
+ 'MaxQueryResults': max_results,
442
+ }
443
+
444
+ # Add next_token for pagination if provided
445
+ if next_token:
446
+ params['NextToken'] = next_token
447
+
448
+ logger.info(f'Getting query results with params: {params}')
449
+
450
+ # Get the query results
451
+ results_response = cloudtrail_client.get_query_results(**remove_null_values(params))
452
+
453
+ # Also get the query status to include it in the response
454
+ status_response = cloudtrail_client.describe_query(QueryId=query_id)
455
+
456
+ return QueryResult(
457
+ query_id=query_id,
458
+ query_status=status_response['QueryStatus'],
459
+ query_statistics=status_response.get('QueryStatistics'),
460
+ query_result_rows=results_response.get('QueryResultRows', []),
461
+ next_token=results_response.get('NextToken'),
462
+ error_message=status_response.get('ErrorMessage'),
463
+ )
464
+
465
+ except Exception as e:
466
+ logger.error(f'Error in get_query_results: {str(e)}')
467
+ await ctx.error(f'Error getting query results: {str(e)}')
468
+ raise
469
+
470
+ async def list_event_data_stores(
471
+ self,
472
+ ctx: Context,
473
+ include_details: Annotated[
474
+ bool,
475
+ Field(
476
+ description='Whether to include detailed event selector information (default: true)'
477
+ ),
478
+ ] = True,
479
+ region: Annotated[
480
+ str,
481
+ Field(description='AWS region to query. Defaults to us-east-1.'),
482
+ ] = 'us-east-1',
483
+ ) -> List[Dict[str, Any]]:
484
+ """List available CloudTrail Lake Event Data Stores with their capabilities and event selectors.
485
+
486
+ Event Data Stores are the storage and query engines for CloudTrail Lake. This tool helps you
487
+ understand which Event Data Stores are available and their configurations.
488
+
489
+ Usage: Use this tool to understand which Event Data Stores are available and their
490
+ configurations. This information is needed when executing CloudTrail Lake queries.
491
+
492
+ Returns:
493
+ --------
494
+ List of available Event Data Stores with their configurations
495
+ """
496
+ try:
497
+ # Create CloudTrail client for the specified region
498
+ cloudtrail_client = self._get_cloudtrail_client(region)
499
+
500
+ logger.info(f'Listing CloudTrail Lake Event Data Stores in region {region}')
501
+
502
+ # List event data stores
503
+ response = cloudtrail_client.list_event_data_stores()
504
+ event_data_stores = response.get('EventDataStores', [])
505
+
506
+ # Process and format the data stores
507
+ formatted_stores = []
508
+ for store in event_data_stores:
509
+ formatted_store = EventDataStore.model_validate(store).model_dump()
510
+
511
+ # Add detailed information if requested
512
+ if include_details and formatted_store.get('event_data_store_arn'):
513
+ try:
514
+ details_response = cloudtrail_client.get_event_data_store(
515
+ EventDataStore=formatted_store['event_data_store_arn']
516
+ )
517
+ # Merge additional details
518
+ formatted_store.update(
519
+ {
520
+ 'advanced_event_selectors': details_response.get(
521
+ 'AdvancedEventSelectors', []
522
+ ),
523
+ 'multi_region_enabled': details_response.get('MultiRegionEnabled'),
524
+ 'organization_enabled': details_response.get(
525
+ 'OrganizationEnabled'
526
+ ),
527
+ }
528
+ )
529
+ except Exception as detail_error:
530
+ logger.warning(
531
+ f'Could not get detailed info for store {formatted_store.get("name")}: {detail_error}'
532
+ )
533
+
534
+ # Remove null values from the formatted store
535
+ formatted_stores.append(remove_null_values(formatted_store))
536
+
537
+ logger.info(
538
+ f'Successfully retrieved {len(formatted_stores)} Event Data Stores from region {region}'
539
+ )
540
+ return formatted_stores
541
+
542
+ except Exception as e:
543
+ logger.error(f'Error in list_event_data_stores: {str(e)}')
544
+ await ctx.error(f'Error listing Event Data Stores: {str(e)}')
545
+ raise
@@ -0,0 +1,154 @@
1
+ Metadata-Version: 2.4
2
+ Name: awslabs.cloudtrail-mcp-server
3
+ Version: 0.0.1
4
+ Summary: An AWS Labs Model Context Protocol (MCP) server for cloudtrail
5
+ Project-URL: homepage, https://awslabs.github.io/mcp/
6
+ Project-URL: docs, https://awslabs.github.io/mcp/servers/cloudtrail-mcp-server/
7
+ Project-URL: documentation, https://awslabs.github.io/mcp/servers/cloudtrail-mcp-server/
8
+ Project-URL: repository, https://github.com/awslabs/mcp.git
9
+ Project-URL: changelog, https://github.com/awslabs/mcp/blob/main/src/cloudtrail-mcp-server/CHANGELOG.md
10
+ Author: Amazon Web Services
11
+ Author-email: AWSLabs MCP <203918161+awslabs-mcp@users.noreply.github.com>, Rohit Kapoor <rokap@amazon.com>
12
+ License: Apache-2.0
13
+ License-File: LICENSE
14
+ License-File: NOTICE
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: boto3>=1.38.22
25
+ Requires-Dist: loguru>=0.7.0
26
+ Requires-Dist: mcp[cli]>=1.6.0
27
+ Requires-Dist: pydantic>=2.10.6
28
+ Description-Content-Type: text/markdown
29
+
30
+ # AWS Labs CloudTrail MCP Server
31
+
32
+ This AWS Labs Model Context Protocol (MCP) server for CloudTrail enables your AI agents to query AWS account activity for security investigations, compliance auditing, and operational troubleshooting. It provides comprehensive access to CloudTrail events and CloudTrail Lake analytics, allowing agents to track API calls, analyze user activity, and perform advanced security analysis. This server gives AI agents seamless access to CloudTrail data through standardized MCP interfaces, eliminating the need for custom API integrations and enabling powerful security insights and audit capabilities.
33
+
34
+ ## Instructions
35
+
36
+ The CloudTrail MCP Server provides specialized tools to address common security and operational scenarios including event lookup, user activity analysis, API call tracking, and advanced CloudTrail Lake analytics. Each tool encapsulates one or multiple CloudTrail APIs into task-oriented operations.
37
+
38
+ ## Features
39
+
40
+ **Event Lookup** - Search CloudTrail events by various attributes including username, event name, resource name, and more. Provides access to the last 90 days of management events for security investigations and troubleshooting.
41
+
42
+ **CloudTrail Lake Analytics** - Execute advanced SQL queries against CloudTrail Lake for complex analytics, filtering, and aggregation. Supports Trino-compatible SQL syntax for comprehensive event analysis.
43
+
44
+ **User Activity Analysis** - Track and analyze user activities across AWS services by filtering events by username, access key, or other user-related attributes.
45
+
46
+ **API Call Tracking** - Monitor specific API calls and their patterns across your AWS environment for security and compliance purposes.
47
+
48
+ **Event Data Store Management** - List and explore available CloudTrail Lake Event Data Stores to understand data sources and capabilities.
49
+
50
+ ## Prerequisites
51
+ 1. An AWS account with [CloudTrail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-user-guide.html) enabled. CloudTrail Event History is enabled by default. CloudTrail Lake needs to be enabled for advance SQL queries.
52
+ 2. This MCP server can only be run locally on the same host as your LLM client.
53
+ 3. Set up AWS credentials with access to AWS services
54
+ - You need an AWS account with appropriate permissions (See required permissions below)
55
+ - Configure AWS credentials with `aws configure` or environment variables
56
+
57
+ ## Available Tools
58
+
59
+ ### Tools for CloudTrail Events
60
+ * `lookup_events` - Look up CloudTrail events based on various criteria such as username, event name, resource name, etc. Provides access to the last 90 days of management events with pagination support
61
+
62
+ ### Tools for CloudTrail Lake Analytics
63
+ * `lake_query` - Execute SQL queries against CloudTrail Lake for complex analytics and filtering. Supports Trino-compatible SQL syntax for advanced analysis
64
+ * `list_event_data_stores` - List available CloudTrail Lake Event Data Stores with their capabilities and event selectors
65
+ * `get_query_status` - Get the status of a CloudTrail Lake query to monitor long-running queries
66
+ * `get_query_results` - Get the results of a completed CloudTrail Lake query with pagination support for large result sets
67
+
68
+ ### Required IAM Permissions
69
+ * `cloudtrail:LookupEvents`
70
+ * `cloudtrail:ListEventDataStores`
71
+ * `cloudtrail:GetEventDataStore`
72
+ * `cloudtrail:StartQuery`
73
+ * `cloudtrail:DescribeQuery`
74
+ * `cloudtrail:GetQueryResults`
75
+
76
+ ## Installation
77
+
78
+ ### Option 1: Python (UVX)
79
+ #### Prerequisites
80
+ 1. Install `uv` from [Astral](https://docs.astral.sh/uv/getting-started/installation/) or the [GitHub README](https://github.com/astral-sh/uv#installation)
81
+ 2. Install Python using `uv python install 3.10`
82
+
83
+ #### One Click Install
84
+
85
+ | Cursor | VS Code |
86
+ |:------:|:-------:|
87
+ | [![Install MCP Server](https://cursor.com/deeplink/mcp-install-light.svg)](https://cursor.com/en/install-mcp?name=awslabs.cloudtrail-mcp-server&config=ewogICAgImF1dG9BcHByb3ZlIjogW10sCiAgICAiZGlzYWJsZWQiOiBmYWxzZSwKICAgICJjb21tYW5kIjogInV2eCBhd3NsYWJzLmNsb3VkdHJhaWwtbWNwLXNlcnZlckBsYXRlc3QiLAogICAgImVudiI6IHsKICAgICAgIkFXU19QUk9GSUxFIjogIltUaGUgQVdTIFByb2ZpbGUgTmFtZSB0byB1c2UgZm9yIEFXUyBhY2Nlc3NdIiwKICAgICAgIkZBU1RNQ1BfTE9HX0xFVkVMIjogIkVSUk9SIgogICAgfSwKICAgICJ0cmFuc3BvcnRUeXBlIjogInN0ZGlvIgp9) | [![Install on VS Code](https://img.shields.io/badge/Install_on-VS_Code-FF9900?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=CloudTrail%20MCP%20Server&config=%7B%22autoApprove%22%3A%5B%5D%2C%22disabled%22%3Afalse%2C%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22awslabs.cloudtrail-mcp-server%40latest%22%5D%2C%22env%22%3A%7B%22AWS_PROFILE%22%3A%22%5BThe%20AWS%20Profile%20Name%20to%20use%20for%20AWS%20access%5D%22%2C%22FASTMCP_LOG_LEVEL%22%3A%22ERROR%22%7D%2C%22transportType%22%3A%22stdio%22%7D) |
88
+
89
+ #### MCP Config (Q CLI, Cline)
90
+ * For Q CLI, update MCP Config Amazon Q Developer CLI (~/.aws/amazonq/mcp.json)
91
+ * For Cline click on "Configure MCP Servers" option from MCP tab
92
+ ```json
93
+ {
94
+ "mcpServers": {
95
+ "awslabs.cloudtrail-mcp-server": {
96
+ "autoApprove": [],
97
+ "disabled": false,
98
+ "command": "uvx",
99
+ "args": [
100
+ "awslabs.cloudtrail-mcp-server@latest"
101
+ ],
102
+ "env": {
103
+ "AWS_PROFILE": "[The AWS Profile Name to use for AWS access]",
104
+ "FASTMCP_LOG_LEVEL": "ERROR"
105
+ },
106
+ "transportType": "stdio"
107
+ }
108
+ }
109
+ }
110
+ ```
111
+
112
+ Please reference [AWS documentation](https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-files.html) to create and manage your credentials profile
113
+
114
+ ### Option 2: Docker Image
115
+ #### Prerequisites
116
+ Build and install docker image locally on the same host of your LLM client
117
+ 1. Install [Docker](https://docs.docker.com/desktop/)
118
+ 2. `git clone https://github.com/awslabs/mcp.git`
119
+ 3. Go to sub-directory `cd src/cloudtrail-mcp-server/`
120
+ 4. Run `docker build -t awslabs/cloudtrail-mcp-server:latest .`
121
+
122
+ #### One Click Cursor Install
123
+ [![Install CloudTrail MCP Server](https://cursor.com/deeplink/mcp-install-light.svg)](https://www.cursor.com/install-mcp?name=awslabs.cloudtrail-mcp-server&config=ewogICAgICAgICJjb21tYW5kIjogImRvY2tlciIsCiAgICAgICAgImFyZ3MiOiBbCiAgICAgICAgICAicnVuIiwKICAgICAgICAgICItLXJtIiwKICAgICAgICAgICItLWludGVyYWN0aXZlIiwKICAgICAgICAgICItZSBBV1NfUFJPRklMRT1bVGhlIEFXUyBQcm9maWxlIE5hbWVdIiwKICAgICAgICAgICJhd3NsYWJzL2Nsb3VkdHJhaWwtbWNwLXNlcnZlcjpsYXRlc3QiCiAgICAgICAgXSwKICAgICAgICAiZW52Ijoge30sCiAgICAgICAgImRpc2FibGVkIjogZmFsc2UsCiAgICAgICAgImF1dG9BcHByb3ZlIjogW10KfQ==)
124
+
125
+ #### MCP Config using Docker image(Q CLI, Cline)
126
+ ```json
127
+ {
128
+ "mcpServers": {
129
+ "awslabs.cloudtrail-mcp-server": {
130
+ "command": "docker",
131
+ "args": [
132
+ "run",
133
+ "--rm",
134
+ "--interactive",
135
+ "-v ~/.aws:/root/.aws",
136
+ "-e AWS_PROFILE=[The AWS Profile Name to use for AWS access]",
137
+ "awslabs/cloudtrail-mcp-server:latest"
138
+ ],
139
+ "env": {},
140
+ "disabled": false,
141
+ "autoApprove": []
142
+ }
143
+ }
144
+ }
145
+ ```
146
+ Please reference [AWS documentation](https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-files.html) to create and manage your credentials profile
147
+
148
+ ## Contributing
149
+
150
+ Contributions are welcome! Please see the [CONTRIBUTING.md](https://github.com/awslabs/mcp/blob/main/CONTRIBUTING.md) in the monorepo root for guidelines.
151
+
152
+ ## Feedback and Issues
153
+
154
+ We value your feedback! Submit your feedback, feature requests and any bugs at [GitHub issues](https://github.com/awslabs/mcp/issues) with prefix `cloudtrail-mcp-server` in title.
@@ -0,0 +1,12 @@
1
+ awslabs/__init__.py,sha256=WuqxdDgUZylWNmVoPKiK7qGsTB_G4UmuXIrJ-VBwDew,731
2
+ awslabs/cloudtrail_mcp_server/__init__.py,sha256=goMITHofBnPgAJnl_lhlvHhXibj7Jp1XXgRngHz-tvA,708
3
+ awslabs/cloudtrail_mcp_server/common.py,sha256=X8viTngRsPrEn-VGqEg3CRn3HzQtoFJAmdVtgVQxcsU,4679
4
+ awslabs/cloudtrail_mcp_server/models.py,sha256=TJT0TUFfN5Ig9M8xYNXI9MCf2pD_yooxxbxw7vNqfYg,3154
5
+ awslabs/cloudtrail_mcp_server/server.py,sha256=7AixDu0sMC_0RMWySaybfPjVpIrpBSr-VY-DfCrAhw0,1798
6
+ awslabs/cloudtrail_mcp_server/tools.py,sha256=O2DzikW8LmRzxAxfeI0ectw3dzKxRktLE4Y3ywb2MGM,23894
7
+ awslabs_cloudtrail_mcp_server-0.0.1.dist-info/METADATA,sha256=T5Q5VxXWMPqOrCnaxNPmCPjJoOmjfI2c9avx6JQ4nws,8825
8
+ awslabs_cloudtrail_mcp_server-0.0.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
+ awslabs_cloudtrail_mcp_server-0.0.1.dist-info/entry_points.txt,sha256=ivDpa1YKhlUbKTzXWXtwTEHvTMNVGy73KNzTX6SBJ1A,92
10
+ awslabs_cloudtrail_mcp_server-0.0.1.dist-info/licenses/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
11
+ awslabs_cloudtrail_mcp_server-0.0.1.dist-info/licenses/NOTICE,sha256=sjH_X33G3MouXhZuOV8c7dN3IAvn6dSPrGLWA7tHjfQ,97
12
+ awslabs_cloudtrail_mcp_server-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.27.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ awslabs.cloudtrail-mcp-server = awslabs.cloudtrail_mcp_server.server:main
@@ -0,0 +1,175 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
@@ -0,0 +1,2 @@
1
+ awslabs.cloudtrail-mcp-server
2
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.