home / mcp / redshift mcp server
Provides an MCP server that exposes Redshift data operations to LLMs and AI agents with strict access controls.
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.
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.
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.txtConfigure 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=readonlyStart 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.pyThis 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_MODEUse 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.
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.
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.
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.
Connect to a Redshift database cluster using environment variables or provided parameters. Establishes the initial connection for subsequent tools.
Execute SELECT queries with optional parameter binding to retrieve data from Redshift.
Execute data modification or DDL statements such as INSERT, UPDATE, DELETE, or CREATE.
List all schemas available in the connected database.
List tables within a specified schema.
Return detailed information about a table's structure.
Close the active database connection.