@lishenxydlgzs/aws-athena-mcp
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
A Model Context Protocol (MCP) server for running AWS Athena queries. This server enables AI assistants to execute SQL queries against your AWS Athena databases and retrieve results.
Usage
1. Configure AWS credentials using one of the following methods:
- AWS CLI configuration
- Environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
- IAM role (if running on AWS)
2. Add the server to your MCP configuration:
3. The server provides the following tools:
- run_query: Execute a SQL query using AWS Athena
- Parameters:
- database: The Athena database to query
- query: SQL query to execute
- maxRows: Maximum number of rows to return (default: 1000, max: 10000)
- Returns:
- If query completes within timeout: Full query results
- If timeout reached: Only the queryExecutionId for later retrieval
- get_status: Check the status of a query execution
- Parameters:
- queryExecutionId: The ID returned from run_query
- Returns:
- state: Query state (QUEUED, RUNNING, SUCCEEDED, FAILED, or CANCELLED)
- stateChangeReason: Reason for state change (if any)
- submissionDateTime: When the query was submitted
- completionDateTime: When the query completed (if finished)
- statistics: Query execution statistics (if available)
- get_result: Retrieve results for a completed query
- Parameters:
- queryExecutionId: The ID returned from run_query
- maxRows: Maximum number of rows to return (default: 1000, max: 10000)
- Returns:
- Full query results if the query has completed successfully
- Error if query failed or is still running
- list_saved_queries: List all saved (named) queries in Athena.
- Returns:
- An array of saved queries with id, name, and optional description
- Queries are returned from the configured ATHENA_WORKGROUP and AWS_REGION
- run_saved_query: Run a previously saved query by its ID.
- Parameters:
- namedQueryId: ID of the saved query
- databaseOverride: Optional override of the saved query's default database
- maxRows: Maximum number of rows to return (default: 1000)
- timeoutMs: Timeout in milliseconds (default: 60000)
- Returns:
- Same behavior as run_query: full results or execution ID
---
Usage Examples
Show All Databases
Message to AI Assistant:
MCP parameter:
List Tables in a Database
Message to AI Assistant:
MCP parameter:
Get Table Schema
Message to AI Assistant:
MCP parameter:
Table Rows Preview