sample-amazon-redshift
MCP server from aws-samples/sample-amazon-redshift-MCP-server
claude mcp add --transport stdio aws-samples-sample-amazon-redshift-mcp-server uv --directory src/redshift_mcp_server run server.py \ --env RS_HOST="your-redshift-cluster.region.redshift.amazonaws.com" \ --env RS_PORT="5439" \ --env RS_USER="your_username" \ --env RS_SCHEMA="your_schema" \ --env RS_DATABASE="your_database" \ --env RS_PASSWORD="your_password"
How to use
The Redshift MCP Server provides a set of MCP resources and tools to interact with an Amazon Redshift cluster through an AI-enabled workflow. It exposes resources to list available schemas, enumerate tables within a schema, fetch DDL for specific tables, and retrieve table statistics. It also offers tools to execute SQL against the Redshift cluster, analyze tables for statistics, and obtain execution plans for queries. To use it within an MCP-enabled assistant, configure an MCP server entry using the uv runtime (as shown in the example) and point it to the server script that powers the Redshift MCP server. Once configured, you can call resources like rs:///schemas or rs:///{schema}/tables and invoke tools such as execute_sql, analyze_table, and get_execution_plan to perform operations on Redshift from your AI assistant. The integration is designed to be seamless for assistants that support MCP, enabling conversational queries that are translated into SQL and other Redshift operations.
How to install
Prerequisites:
- Python 3.13 or higher
- An Amazon Redshift cluster with accessible network configuration
- Redshift credentials (host, port, user, password, database)
Install from source:
# Clone the repository
git clone https://github.com/aws-samples/sample-amazon-redshift-MCP-server.git
cd sample-amazon-redshift-MCP-server
# Install dependencies
uv sync
Configure environment variables (example):
export RS_HOST=your-redshift-cluster.region.redshift.amazonaws.com
export RS_PORT=5439
export RS_USER=your_username
export RS_PASSWORD=your_password
export RS_DATABASE=your_database
export RS_SCHEMA=your_schema # optional, defaults to public
Run the server (example, using uv):
uv --directory src/redshift_mcp_server run server.py
Notes:
- Ensure your Redshift cluster allows inbound connections from the machine running the MCP server.
- You may want to store credentials in a .env file loaded by your application or provided by your orchestration environment.
Additional notes
Environment variables RS_HOST, RS_PORT, RS_USER, RS_PASSWORD, RS_DATABASE, and RS_SCHEMA are required for connecting to Redshift. RS_SCHEMA is optional and defaults to public if not provided. If you encounter connection errors, verify network access (VPC, security groups, and firewall rules), ensure the Redshift cluster is reachable from your deployment location, and double-check credentials. When using uv to run the server, the --directory flag should point to the directory containing the server.py script. For security, consider using secret management for credentials instead of hard-coding them in environment variables. The MCP server depends on mcp[cli] and related Python dependencies; ensure the environment has network access to fetch dependencies during uv sync installation.