home / mcp / redshift mcp server

Redshift MCP Server

Provides an MCP server that exposes Redshift data operations to LLMs and AI agents with strict access controls.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "conectcardata-redshift-mcp": {
      "command": "python",
      "args": [
        "src/redshift_mcp_server.py"
      ],
      "env": {
        "DB_MCP_MODE": "readonly",
        "REDSHIFT_HOST": "your-cluster.region.redshift.amazonaws.com",
        "REDSHIFT_PORT": "5439",
        "REDSHIFT_USER": "myuser",
        "REDSHIFT_DATABASE": "mydb",
        "REDSHIFT_PASSWORD": "mypassword"
      }
    }
  }
}

You can connect LLMs and AI agents securely to Amazon Redshift and run queries, mutations, and schema explorations through a production-ready MCP server. It enforces access controls, automates connection setup, and can be extended with new tools or business logic for AI-powered data workflows.

How to use

Connect your MCP client (such as Claude Desktop or ChatGPT) to the Redshift MCP Server and start performing data operations through standard MCP tools. Start in a safe, readonly mode by default, then elevate permissions if your workflow requires it. The server exposes a controlled set of actions: connect to your Redshift cluster, run SELECT queries, modify data, inspect schemas and tables, describe structures, and disconnect when finished.

How to install

Prerequisites you need on your machine:

Python 3.8+  
pip 21+

Step-by-step setup you can follow:

# Clone the project
git clone <repo-url>
cd redshift-mcp

# Create and activate a virtual environment
python3 -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

Configure your connection and mode. Create a .env file or set environment variables. Example values shown (replace with your actual Redshift details):

REDSHIFT_HOST=your-cluster.region.redshift.amazonaws.com
REDSHIFT_DATABASE=mydb
REDSHIFT_USER=myuser
REDSHIFT_PASSWORD=mypassword
REDSHIFT_PORT=5439
DB_MCP_MODE=readonly

Start the MCP server using the recommended script or the direct entry point:

./scripts/run_server.sh
# or, start directly with the Python entry point
python src/redshift_mcp_server.py

Configuration and startup details

This server exposes a controlled set of tools to manage your Redshift data. It supports automatic connection on startup when the required environment variables are present. You can run in one of three access modes determined by DB_MCP_MODE: readonly, readwrite, or admin.

Key environment variables include the following. Set these in your environment or in a .env file to automatically connect and configure defaults:

REDSHIFT_HOST
REDSHIFT_DATABASE
REDSHIFT_USER
REDSHIFT_PASSWORD
REDSHIFT_PORT
DB_MCP_MODE

Security and safety notes

Use environment variables to keep credentials out of code and tool calls. Run with the minimal required permissions for your Redshift user. Queries should be parameterized to prevent SQL injection, and the server blocks actions that are not allowed by the chosen mode.

Troubleshooting

If you encounter connection issues, verify your Redshift endpoint, credentials, and network reachability. Check that the cluster is active and that security groups allow access from your client. If an operation is blocked by mode restrictions, confirm DB_MCP_MODE and adjust it if your workflow requires broader permissions.

Notes on usage with MCP clients

The server is designed to work with Claude Desktop, ChatGPT, and any MCP client. It provides tools to connect, query, modify (when allowed), list schemas, list tables, describe tables, and disconnect. Start in readonly mode to safely explore your data, then move to readwrite or admin as needed.

Tool access and behavior

Tools available through the MCP server include: connect_db, query, execute, list_schemas, list_tables, describe_table, and disconnect. Each tool enforces access rules based on the configured mode and uses parameterized queries to protect against injection.

Available tools

connect_db

Connect to a Redshift database cluster using environment variables or provided parameters. Establishes the initial connection for subsequent tools.

query

Execute SELECT queries with optional parameter binding to retrieve data from Redshift.

execute

Execute data modification or DDL statements such as INSERT, UPDATE, DELETE, or CREATE.

list_schemas

List all schemas available in the connected database.

list_tables

List tables within a specified schema.

describe_table

Return detailed information about a table's structure.

disconnect

Close the active database connection.