AthenaMCPServer

AthenaMCPServer

An MCP server that allows AI assistants to execute SQL queries against Amazon Athena and retrieve results in structured formats.

Category
访问服务器

README

AthenaMCPServer

An MCP (Model Context Protocol) server for querying Amazon Athena. This server allows AI assistants to execute SQL queries against AWS Athena and retrieve results in a structured format.

Features

  • Execute SQL queries against Amazon Athena
  • Authenticate to AWS account using profiles
  • Format results as JSON, CSV, or formatted tables
  • Configurable database, region, and output location

Setup

# Install dependencies
npm install

Configuration

The server uses the following environment variables for configuration:

  • AWS_REGION: AWS region where Athena is located (default: "us-east-1")
  • ATHENA_WORKGROUP: Athena workgroup to use (default: "primary")
  • ATHENA_OUTPUT_LOCATION: S3 location for query results (default: "s3://aws-athena-query-results/")
  • ATHENA_DATABASE: Default database to query (default: "default")
  • ATHENA_CATALOG: Default catalog/data source to query (default: "AwsDataCatalog")
  • AWS_PROFILE: AWS Profile to use for authentication (default: undefined, and will fallback to using default AWS credentials provider chain)

You can set these environment variables before running the server:

export AWS_REGION=us-west-2
export ATHENA_WORKGROUP=my-workgroup
export ATHENA_OUTPUT_LOCATION=s3://my-bucket/athena-results/
export ATHENA_DATABASE=my_database
export ATHENA_CATALOG=AwsDataCatalog
export AWS_PROFILE=aws_profile_name

Alternatively, you can set these environment variables in the MCP Client configuration (see below).

Configuration for MCP Client

{
  "mcpServers": {
    "athena-mcp": {
      "command": "npm",
      "args": [
        "--prefix",
        "/Users/<alias>/workplace/AthenaMCPServer/src/AthenaMCPServer",
        "start"
      ],
      "disabled": false,
      "env": {
        "AWS_PROFILE": "<aws-profile-for-account-with-athena>",
        "ATHENA_OUTPUT_LOCATION": "s3://<your-athena-query-results-bucket>"
      },
      "autoApprove": []
    }
  }
}

AWS Authentication

The server uses the AWS SDK's default credential provider chain. You can authenticate using any of the following methods:

  1. Environment variables (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY)
  2. Shared credentials file (~/.aws/credentials)
  3. EC2 instance profile or ECS task role
  4. AWS SSO

Using AWS Profiles

You can specify an AWS profile from your shared credentials config file (~/.aws/config) when executing queries:

{
  "query": "SELECT * FROM my_table LIMIT 10",
  "profile": "my-aws-profile"
}

This is useful when you have multiple AWS accounts or roles configured in your credentials file.

For more information, see the AWS SDK documentation.

Usage

Basic example Using MCP Client (e.g. Cline)

Type the following into the MCP Client Window

use the athena mcp server to run a basic query and return in csv

Response:

test
1

You can pass it a query directly, or use other LLMs to generate the SQL for you and ask it to run it using the Athena MCP Server

Starting the Server

# Start the server
npm start

Available Tools

query_athena

Executes SQL queries against Amazon Athena and retrieves results.

Parameters:

  • query (required): SQL query to execute
  • database (optional): Database to query (uses default if not specified)
  • catalog (optional): Catalog (Data source) to query (uses AwsDataCatalog if not specified)
  • region (optional): AWS region (uses default if not specified)
  • format (optional): Result format (json, table, or csv)
  • profile (optional): AWS profile name to use from shared credentials file

Example:

{
  "query": "SELECT * FROM my_table LIMIT 10",
  "database": "my_database",
  "catalog": "AwsDataCatalog",
  "format": "table",
  "profile": "my-aws-profile"
}

Development

Project Structure

athena-mcp/
├── src/
│   ├── core/
│   │   └── aws/
│   │       └── athena-client.ts
│   ├── tools/
│   │   └── query-athena/
│   │       └── tool.ts
│   ├── cli.ts
│   └── index.ts
├── package.json
├── tsconfig.json
└── README.md

Running in Development Mode

# Run in development mode with auto-reload
npm run watch

Testing

# Run tests
npm test

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选