AthenaMCPServer
An MCP server that allows AI assistants to execute SQL queries against Amazon Athena and retrieve results in structured formats.
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:
- Environment variables (
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEY) - Shared credentials file (
~/.aws/credentials) - EC2 instance profile or ECS task role
- 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 executedatabase(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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.