Sponsored by Deepsite.site

Redshift MCP Server

Created By
tuanknguyen8 months ago
Content

Redshift MCP Server

A Model Context Protocol (MCP) server for interacting with Amazon Redshift databases.

Features

  • Run SQL queries on Redshift
  • Explain SQL query execution plans
  • List tables and views within a schema
  • List all schemas within the database
  • Test connection to Redshift

Prerequisites

  • Python 3.10+
  • Amazon Redshift database credentials

Installation

Installation Requirements

  1. Install uv from Astral or the GitHub README
  2. Install Python 3.10 or newer using uv python install 3.10 (or a more recent version)

Configure for Amazon Q or Claude

To add this MCP server to your Amazon Q or Claude, add the following to your MCP config file. With Amazon Q, create (if does not yet exist) a file named .amazonq/mcp.json under the same directory that is running q chat. Then add the following config:

{
  "mcpServers": {
    "redshift": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "--with", "<path-to-redshift-mcp-server>", "redshift-mcp-server"
      ],
      "env": {
        "FASTMCP_LOG_LEVEL": "ERROR"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

Setup Your Credentials

⚠️ SECURITY WARNING ⚠️

NEVER commit credential files to version control or include them in Docker images!

Set up your Redshift credentials using environment variables:

# Linux/macOS
export REDSHIFT_HOST=<your-redshift-host>
export REDSHIFT_PORT=5439  # Default Redshift port
export REDSHIFT_DATABASE=<your-database-name>
export REDSHIFT_USER=<your-username>
export REDSHIFT_PASSWORD=<your-password>

# Windows (Command Prompt)
set REDSHIFT_HOST=<your-redshift-host>
set REDSHIFT_PORT=5439
set REDSHIFT_DATABASE=<your-database-name>
set REDSHIFT_USER=<your-username>
set REDSHIFT_PASSWORD=<your-password>

# Windows (PowerShell)
$env:REDSHIFT_HOST = "<your-redshift-host>"
$env:REDSHIFT_PORT = "5439"
$env:REDSHIFT_DATABASE = "<your-database-name>"
$env:REDSHIFT_USER = "<your-username>"
$env:REDSHIFT_PASSWORD = "<your-password>"

Development

  1. Clone this repository:

    git clone https://github.com/tuanknguyen/redshift-mcp-server.git
    cd redshift-mcp-server
    
  2. Create and activate a virtual environment:

    # Create the venv
    uv venv
    
    # Activate it
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    
  3. Install the project:

    # Install the project and its dependencies
    uv pip install -e .
    
    # Or for development
    uv pip install -e ".[dev]"
    

Configuration

Set the following environment variables with your Redshift connection details:

export REDSHIFT_HOST=<your-redshift-host>
export REDSHIFT_PORT=5439  # Default Redshift port
export REDSHIFT_DATABASE=<your-database-name>
export REDSHIFT_USER=<your-username>
export REDSHIFT_PASSWORD=<your-password>

Optional environment variables:

export FASTMCP_LOG_LEVEL=INFO  # Set log level (DEBUG, INFO, WARNING, ERROR)

Development Mode

For development and testing with the MCP Inspector:

mcp dev redshift-mcp-server

Available Tools

  • run_query(query: str) - Execute a SQL query against Redshift
  • explain_query(query: str) - Get the execution plan for a SQL query
  • list_tables_in_schema(schema_name: str) - List all tables and views in a specific schema
  • list_schemas() - List all schemas in the database
  • test_redshift_connection() - Test connectivity to the Redshift database

Connection Testing

The MCP server automatically tests the connection when starting up. If the connection test fails, the server will not start and will raise an error.

You can also run a standalone connection test using:

python test_connection.py

Best Practices

  • Use list_schemas and list_tables_in_schema to explore the database structure
  • For large queries, consider using explain_query first to understand execution plans
  • Always include appropriate WHERE clauses to limit result sets
  • Use column names explicitly instead of SELECT * for better performance
  • Consider adding LIMIT clauses to prevent returning too many rows
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
DeepChatYour AI Partner on Desktop
Amap Maps高德地图官方 MCP Server
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
CursorThe AI Code Editor
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
WindsurfThe new purpose-built IDE to harness magic
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Tavily Mcp
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Serper MCP ServerA Serper MCP Server
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
ChatWiseThe second fastest AI chatbot™
Playwright McpPlaywright MCP server