athena-mcp-server
Remote MCP server for AWS Athena that allows executing SQL queries, checking status, fetching results, and managing saved queries via HTTP with AWS IAM credentials.
README
Athena MCP Server
A remote Model Context Protocol server for AWS Athena, deployed as a Docker container.
Customers connect Claude Desktop (or any MCP client) directly to this server using their own AWS IAM credentials — no local installation required.
Architecture
Claude Desktop ──HTTP POST /mcp──► athena-mcp-server ──► AWS Athena
(credentials in headers)
The server is fully stateless. Each request carries credentials in HTTP headers; no sessions, no credential caching.
MCP Tools
| Tool | Description |
|---|---|
run_query |
Execute a SQL query (waits up to timeoutMs, returns results or polling ID) |
get_status |
Poll the status of a running query |
get_result |
Fetch results of a completed query |
list_saved_queries |
List named queries in the workgroup |
run_saved_query |
Execute a named query by ID |
HTTP Headers
Every request to POST /mcp must include:
| Header | Required | Default | Description |
|---|---|---|---|
x-aws-access-key-id |
✅ | — | AWS Access Key ID |
x-aws-secret-access-key |
✅ | — | AWS Secret Access Key |
x-s3-output-path |
✅ | — | S3 path for query results, e.g. s3://bucket/prefix/ |
x-aws-region |
— | us-east-1 |
AWS region |
x-aws-session-token |
— | — | Session token (temporary credentials) |
x-athena-workgroup |
— | primary |
Athena workgroup |
Missing required headers → 401 Unauthorized.
Running locally
Prerequisites
- Docker + Docker Compose
- AWS credentials with the required IAM permissions (see below)
Build and run
docker compose up --build
The server starts on http://localhost:3000.
Smoke test
# Health check
curl http://localhost:3000/health
# → {"status":"ok"}
# Run a query
curl -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-H "x-aws-access-key-id: AKIA..." \
-H "x-aws-secret-access-key: ..." \
-H "x-aws-region: us-east-1" \
-H "x-s3-output-path: s3://my-bucket/athena-results/" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "run_query",
"arguments": {
"database": "default",
"query": "SELECT 1 AS test"
}
}
}'
Configuring Claude Desktop
Add the following to your claude_desktop_config.json
(~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"teramot-athena": {
"type": "http",
"url": "https://athena-mcp.teramot.com/mcp",
"headers": {
"x-aws-access-key-id": "AKIA...",
"x-aws-secret-access-key": "...",
"x-aws-region": "us-east-1",
"x-athena-workgroup": "primary",
"x-s3-output-path": "s3://customer-bucket/athena-results/"
}
}
}
}
Replace the URL with your deployed server URL and fill in the customer's credentials.
Deploying to AWS ECS
1. Push the image to ECR
AWS_ACCOUNT_ID=123456789012
AWS_REGION=us-east-1
REPO=athena-mcp-server
aws ecr create-repository --repository-name $REPO --region $AWS_REGION
aws ecr get-login-password --region $AWS_REGION \
| docker login --username AWS --password-stdin \
$AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com
docker build -t $REPO .
docker tag $REPO:latest $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$REPO:latest
docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$REPO:latest
2. Create an ECS task definition
- CPU / Memory: 256 CPU / 512 MB is sufficient for most workloads
- Port mappings: container port 3000
- Environment variables: none required (all config comes via headers)
- Health check:
CMD-SHELL wget -qO- http://localhost:3000/health || exit 1
3. Create an ECS service
- Use Fargate launch type for zero infrastructure management
- Attach to an Application Load Balancer (ALB) on HTTPS port 443
- Enable HTTPS on the ALB listener with an ACM certificate
- Target group: HTTP, port 3000, health check path
/health
4. (Optional) Custom domain
Create a Route 53 alias record pointing to the ALB, e.g. athena-mcp.teramot.com.
Required IAM permissions
The customer's IAM credentials must have the following permissions:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AthenaAccess",
"Effect": "Allow",
"Action": [
"athena:StartQueryExecution",
"athena:GetQueryExecution",
"athena:GetQueryResults",
"athena:ListNamedQueries",
"athena:GetNamedQuery",
"athena:ListWorkGroups"
],
"Resource": "*"
},
{
"Sid": "S3ResultsBucket",
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::customer-results-bucket",
"arn:aws:s3:::customer-results-bucket/*"
]
},
{
"Sid": "GlueMetastore",
"Effect": "Allow",
"Action": [
"glue:GetDatabase",
"glue:GetDatabases",
"glue:GetTable",
"glue:GetTables"
],
"Resource": "*"
}
]
}
Replace customer-results-bucket with the actual S3 bucket name.
Development
npm install
npm run dev # run with ts-node (hot-reload not included)
npm run build # compile TypeScript → dist/
npm run typecheck # type-check without emitting
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。