Provides secure access to Amazon Redshift databases for AI models, with tools for querying data, listing schemas and tables, describing table structures, and optionally modifying data based on configurable access modes (readonly, readwrite, admin).
Supports configuration through .env files, allowing users to securely store database credentials and server settings without hardcoding them in the application.
🚀 Redshift MCP Server
A plug-and-play Model Context Protocol (MCP) server for Amazon Redshift. Instantly connect LLMs and AI agents (Claude, ChatGPT, etc.) to your Redshift data — securely, safely, and with zero hassle.
🌟 Features
- Production-ready: Secure, robust, and easy to deploy
- MCP Standard: Exposes Redshift as standardized tools for LLMs/AI
- Strict Access Modes:
readonly
,readwrite
,admin
(enforced by env var) - Auto-connect: Use environment variables or a
.env
file for seamless startup - No code changes needed: Just configure and run
- Extensible: Add new tools or business logic easily
- Works with Claude Desktop, ChatGPT, and any MCP client
⚡ Quickstart
- Clone & Install
- Configure (recommended: create a
.env
file): - Run the server
- Connect from your LLM/MCP client (e.g., Claude Desktop)
🔗 What is Redshift MCP Server?
Redshift MCP Server is an open-source bridge between Amazon Redshift and modern AI assistants. It lets LLMs securely query, explore, and (optionally) modify your Redshift data using the Model Context Protocol (MCP). Perfect for:
- Data teams enabling AI-powered analytics
- Building AI workflows and automations
- Secure, auditable LLM access to production data
About This Project
This repository provides a minimal, production-ready MCP server for Amazon Redshift using the FastMCP framework. It allows LLMs and AI agents to:
- Query Redshift databases (with strict access controls)
- List schemas and tables
- Describe table structures
- (Optionally) insert/update data, depending on configured mode
Key features:
- Three access modes:
readonly
,readwrite
,admin
(see below) - Environment variable and
.env
support for easy configuration - Secure by default: starts in
readonly
mode - Compatible with Claude Desktop, ChatGPT, and any MCP client
- Easy to extend with new tools or business logic
Features
This MCP server provides the following tools for Redshift database operations:
- connect_db: Establish connection to a Redshift cluster (supports environment variables)
- query: Execute SELECT queries with optional parameter binding
- execute: Run INSERT, UPDATE, DELETE, or DDL statements
- list_schemas: List all schemas in the database
- list_tables: List tables in a specific schema
- describe_table: Get detailed structure of a table
- disconnect: Close the database connection
Auto-Connection Support
The server supports automatic connection on startup using environment variables. If all required environment variables are set, the server will connect automatically when it starts.
Access Modes and Query Safety
The server supports three access modes, controlled by the DB_MCP_MODE
environment variable:
1. readonly (default)
- Allows:
SELECT
,SHOW
,DESCRIBE
, etc. - Blocks:
INSERT
,UPDATE
,DELETE
,DROP
,TRUNCATE
,ALTER
,CREATE
,GRANT
,REVOKE
,COMMENT
,SET
,COPY
,UNLOAD
,VACUUM
,ANALYZE
,MERGE
2. readwrite
- Allows:
SELECT
,INSERT
,UPDATE
,CREATE
, etc. - Blocks:
DELETE
,DROP
,TRUNCATE
,ALTER
,GRANT
,REVOKE
,COMMENT
,SET
,COPY
,UNLOAD
,VACUUM
,ANALYZE
,MERGE
3. admin
- Allows everything (no restrictions)
If a forbidden statement is detected, the server will return a clear error message.
How to Set the Mode
- Environment variable:
DB_MCP_MODE=readonly
(orreadwrite
,admin
) - Claude Desktop config:
- Shell/local:
Installation
- Clone or download this repository
- Install dependencies:
Usage
Running the Server
Run the server directly:
Or use the provided scripts:
By default, the server runs using STDIO transport, which is suitable for integration with MCP clients like Claude Desktop.
Configuration for Claude Desktop
To use this server with Claude Desktop, add the following configuration to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
Option 1: With Environment Variables (Recommended)
With this configuration, the server will automatically connect to your Redshift database on startup. You won't need to use the connect_db
tool manually.
Option 2: Without Environment Variables
With this configuration, you'll need to use the connect_db
tool to establish a connection.
Environment Variables
The server supports the following environment variables:
REDSHIFT_HOST
: Redshift cluster endpointREDSHIFT_DATABASE
: Database nameREDSHIFT_USER
: UsernameREDSHIFT_PASSWORD
: PasswordREDSHIFT_PORT
: Port number (default: 5439)DB_MCP_MODE
: Access mode (readonly
,readwrite
,admin
)
When these environment variables are set, the server will:
- Automatically connect on startup
- Use them as defaults for the
connect_db
tool if no parameters are provided - Enforce query/statement restrictions based on the selected mode
Available Tools
1. connect_db
Connect to a Redshift database cluster. If environment variables are set, parameters are optional.
2. query
Execute SELECT queries to retrieve data.
3. execute
Execute data modification or DDL statements.
4. list_schemas
List all user-created schemas.
5. list_tables
List tables in a specific schema.
6. describe_table
Get detailed information about a table's structure.
7. disconnect
Close the database connection.
Security Considerations
- Credentials: The recommended approach is to use environment variables in the MCP configuration file. This keeps credentials out of your code and tool calls.
- Permissions: Use database users with minimal required permissions.
- Query Safety: The server uses parameterized queries to prevent SQL injection. Query/statement type is checked and blocked according to the selected mode.
- Network Security: Ensure your Redshift cluster is properly secured with VPC and security groups.
Development
To extend this server:
- Add new tools using the
@mcp.tool()
decorator - Follow the FastMCP documentation for advanced features
- Test thoroughly with your Redshift cluster
Troubleshooting
Connection Issues
- Verify your Redshift cluster endpoint and credentials
- Check network connectivity and security group settings
- Ensure the cluster is active and accepting connections
Import Errors
- If
redshift-connector
is not available, the server falls back topsycopg2
- Install the appropriate connector based on your needs
License
MIT
Contributing
Feel free to submit issues or pull requests to improve this MCP server.
👤 Maintainer
This Redshift MCP Server is maintained and deployed by Anshul.
This server cannot be installed
A production-ready server that connects LLMs and AI agents (Claude, ChatGPT) to Amazon Redshift databases with configurable access controls and zero code changes.
Related MCP Servers
- -securityAlicense-qualityThis is a server that lets your LLMs (like Claude) talk directly to your BigQuery data! Think of it as a friendly translator that sits between your AI assistant and your database, making sure they can chat securely and efficiently.Last updated -1188105JavaScriptMIT License
- AsecurityAlicenseAqualityA server that enables LLMs like Claude to interact with Azure Cosmos DB databases through natural language queries, acting as a translator between AI assistants and database systems.Last updated -41JavaScriptMIT License
- AsecurityFlicenseAqualityA Model Context Protocol server allowing Claude AI to interact with AWS resources through natural language, enabling users to query and manage AWS services without using the traditional AWS Console or CLI.Last updated -34TypeScript
- AsecurityAlicenseAqualityA server that enables LLMs like Claude to query AWS DynamoDB databases through natural language requests, supporting table management, data querying, and schema analysis.Last updated -7554JavaScriptMIT License