Logo van Redshift Utils

Redshift Utils

Community
vinodismyname

🤖 Enable AI assistants (Claude, Cursor) to monitor, diagnose, and query Amazon Redshift using this MCP server and the AWS Data API.

Uitgevervinodismyname
Repositoryredshift-utils-mcp
TaalPython
Forks
3
Sterren
6
Beschikbare tools
0
Transporttypestdio
Categorieën
LicentieMIT
Links
  • Koppel tools aan AI-workflows

    Redshift Utils biedt MCP-functionaliteit die compatibele AI-clients en agenten kunnen gebruiken.

  • 0 beschikbare tools

    Bekijk hieronder de aanroepbare acties, inclusief namen en beschrijvingen als de server die beschikbaar stelt.

  • Configuratie om direct te kopiëren

    Gebruik de installatievoorbeelden om deze server in je favoriete MCP-client te configureren.

  • Indicatoren van opensource-interesse

    6 sterren en 3 forks in de gekoppelde repository.

Redshift Utils MCP Server

Overview

This project implements a Model Context Protocol (MCP) server designed specifically to interact with Amazon Redshift databases.

It bridges the gap between Large Language Models (LLMs) or AI assistants (like those in Claude, Cursor, or custom applications) and your Redshift data warehouse, enabling secure, standardized data access and interaction. This allows users to query data, understand database structure, and monitoring/diagnostic operations using natural language or AI-driven prompts.

This server is for developers, data analysts, or teams looking to integrate LLM capabilities directly with their Amazon Redshift data environment in a structured and secure manner.

Table of Contents

Features

  • ✨ Secure Redshift Connection (via Data API): Connects to your Amazon Redshift cluster using the AWS Redshift Data API via Boto3, leveraging AWS Secrets Manager for credentials managed securely via environment variables.
  • 🔍 Schema Discovery: Exposes MCP resources for listing schemas and tables within a specified schema.
  • 📊 Metadata & Statistics: Provides a tool (handle_inspect_table) to gather detailed table metadata, statistics (like size, row counts, skew, stats staleness), and maintenance status.
  • 📝 Read-Only Query Execution: Offers a secure MCP tool (handle_execute_ad_hoc_query) to execute arbitrary SELECT queries against the Redshift database, enabling data retrieval based on LLM requests.
  • 📈 Query Performance Analysis: Includes a tool (handle_diagnose_query_performance) to retrieve and analyze the execution plan, metrics, and historical data for a specific query ID.
  • 🔍 Table Inspection: Provides a tool (handle_inspect_table) to perform a comprehensive inspection of a table, including design, storage, health, and usage.
  • 🩺 Cluster Health Check: Offers a tool (handle_check_cluster_health) to perform a basic or full health assessment of the cluster using various diagnostic queries.
  • 🔒 Lock Diagnosis: Provides a tool (handle_diagnose_locks) to identify and report on current lock contention and blocking sessions.
  • 📊 Workload Monitoring: Includes a tool (handle_monitor_workload) to analyze cluster workload patterns over a time window, covering WLM, top queries, and resource usage.
  • 📝 DDL Retrieval: Offers a tool (handle_get_table_definition) to retrieve the SHOW TABLE output (DDL) for a specified table.
  • 🛡️ Input Sanitization: Utilizes parameterized queries via the Boto3 Redshift Data API client where applicable to mitigate SQL injection risks.
  • 🧩 Standardized MCP Interface: Adheres to the Model Context Protocol specification for seamless integration with compatible clients (e.g., Claude Desktop, Cursor IDE, custom applications).

Prerequisites

Software:

  • Python 3.10+
  • uv (recommended package manager) or pip

Infrastructure & Access:

  • Access to an Amazon Redshift cluster.
  • An AWS account with permissions to use the Redshift Data API (redshift-data:*) and access the specified Secrets Manager secret (secretsmanager:GetSecretValue).
  • A Redshift user account whose credentials are stored in AWS Secrets Manager. This user needs the necessary permissions within Redshift to perform the actions enabled by this server (e.g., CONNECT to the database, SELECT on target tables, SELECT on relevant system views like pg_class, pg_namespace, svv_all_schemas, svv_tables, `svv_table_info``). Using a role with the principle of least privilege is strongly recommended. See Security Considerations.

Credentials:

Your Redshift connection details are managed via AWS Secrets Manager, and the server connects using the Redshift Data API. You need:

  • The Redshift cluster identifier.
  • The database name within the cluster.
  • The ARN of the AWS Secrets Manager secret containing the database credentials (username and password).
  • The AWS region where the cluster and secret reside.
  • Optionally, an AWS profile name if not using default credentials/region.

These details will be configured via environment variables as detailed in the Configuration section.

Installation

Install from PyPI (Recommended)

The easiest way to install the Redshift Utils MCP Server is directly from PyPI:

bash
# Using pip
pip install redshift-utils-mcp

# Using uv (recommended)
uv pip install redshift-utils-mcp

Install from Source

Alternatively, you can install from the source repository:

bash
# Clone the repository
git clone https://github.com/vinodismyname/redshift-utils-mcp.git
cd redshift-utils-mcp

# Install using uv (recommended)
uv sync

# Or install using pip
pip install -e .

Configuration

Set Environment Variables: This server requires the following environment variables to connect to your Redshift cluster via the AWS Data API. You can set these directly in your shell, using a systemd service file, a Docker environment file, or by creating a .env file in the project's root directory (if using a tool like uv or python-dotenv that supports loading from .env).

Example using shell export:

bash
export REDSHIFT_CLUSTER_ID="your-cluster-id"
export REDSHIFT_DATABASE="your_database_name"
export REDSHIFT_SECRET_ARN="arn:aws:secretsmanager:us-east-1:123456789012:secret:your-redshift-secret-XXXXXX"
export AWS_REGION="us-east-1" # Or AWS_DEFAULT_REGION
# export AWS_PROFILE="your-aws-profile-name" # Optional

Example .env file (see .env.example):

dotenv
# .env file for Redshift MCP Server configuration
# Ensure this file is NOT committed to version control if it contains secrets. Add it to .gitignore.

REDSHIFT_CLUSTER_ID="your-cluster-id"
REDSHIFT_DATABASE="your_database_name"
REDSHIFT_SECRET_ARN="arn:aws:secretsmanager:us-east-1:123456789012:secret:your-redshift-secret-XXXXXX"
AWS_REGION="us-east-1" # Or AWS_DEFAULT_REGION
# AWS_PROFILE="your-aws-profile-name" # Optional

Required Variables Table:

Variable NameRequiredDescriptionExample Value
REDSHIFT_CLUSTER_IDYesYour Redshift cluster identifier.my-redshift-cluster
REDSHIFT_DATABASEYesThe name of the database to connect to.mydatabase
REDSHIFT_SECRET_ARNYesAWS Secrets Manager ARN for Redshift credentials.arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret-abcdef
AWS_REGIONYesAWS region for Data API and Secrets Manager.us-east-1
AWS_DEFAULT_REGIONNoAlternative to AWS_REGION for specifying the AWS region.us-west-2
AWS_PROFILENoAWS profile name to use from your credentials file (~/.aws/...).my-redshift-profile

Note: Ensure the AWS credentials used by Boto3 (via environment, profile, or IAM role) have permissions to access the specified REDSHIFT_SECRET_ARN and use the Redshift Data API (redshift-data:*).

Usage

After installation, you can run the server directly from the command line:

bash
# If installed from PyPI
redshift-utils-mcp

# Or using uvx (no installation required)
uvx redshift-utils-mcp

Connecting with Claude Desktop / Anthropic Console:

Add the following configuration block to your mcp.json file:

json
{
  "mcpServers": {
    "redshift-utils-mcp": {
      "command": "uvx",
      "args": ["redshift-utils-mcp"],
      "env": {
        "REDSHIFT_CLUSTER_ID":"your-cluster-id",
        "REDSHIFT_DATABASE":"your_database_name",
        "REDSHIFT_SECRET_ARN":"arn:aws:secretsmanager:...",
        "AWS_REGION": "us-east-1"
      }
  }
}

Connecting with Claude Code CLI:

Use the Claude CLI to add the server configuration:

bash
claude mcp add redshift-utils-mcp \
  -e REDSHIFT_CLUSTER_ID="your-cluster-id" \
  -e REDSHIFT_DATABASE="your_database_name" \
  -e REDSHIFT_SECRET_ARN="arn:aws:secretsmanager:..." \
  -e AWS_REGION="us-east-1" \
  -- uvx redshift-utils-mcp

Connecting with Cursor IDE:

  1. Start the MCP server locally using the instructions in the Usage / Quickstart section.
  2. In Cursor, open the Command Palette (Cmd/Ctrl + Shift + P).
  3. Type "Connect to MCP Server" or navigate to the MCP settings.
  4. Add a new server connection.
  5. Choose the stdio transport type.
  6. Enter the command and arguments required to start your server (uvx run redshift_utils_mcp). Ensure any necessary environment variables are available to the command being run.
  7. Cursor should detect the server and its available tools/resources.

Available MCP Resources

Resource URI PatternDescriptionExample URI
/scripts/{script_path}Retrieves the raw content of a SQL script file from the server's sql_scripts directory./scripts/health/disk_usage.sql
redshift://schemasLists all accessible user-defined schemas in the connected database.redshift://schemas
redshift://wlm/configurationRetrieves the current Workload Management (WLM) configuration details.redshift://wlm/configuration
redshift://schema/{schema_name}/tablesLists all accessible tables and views within the specified {schema_name}.redshift://schema/public/tables

Replace {script_path} and {schema_name} with the actual values when making requests. Accessibility of schemas/tables depends on the permissions granted to the Redshift user configured via REDSHIFT_SECRET_ARN.

Available MCP Tools

Tool NameDescriptionKey Parameters (Required*)Example Invocation
handle_check_cluster_healthPerforms a health assessment of the Redshift cluster using a set of diagnostic SQL scripts.level (optional), time_window_days (optional)use_mcp_tool("redshift-admin", "handle_check_cluster_health", {"level": "full"})
handle_diagnose_locksIdentifies active lock contention and blocking sessions in the cluster.min_wait_seconds (optional)use_mcp_tool("redshift-admin", "handle_diagnose_locks", {"min_wait_seconds": 10})
handle_diagnose_query_performanceAnalyzes a specific query's execution performance, including plan, metrics, and historical data.query_id*use_mcp_tool("redshift-admin", "handle_diagnose_query_performance", {"query_id": 12345})
handle_execute_ad_hoc_queryExecutes an arbitrary SQL query provided by the user via Redshift Data API. Designed as an escape hatch.sql_query*use_mcp_tool("redshift-admin", "handle_execute_ad_hoc_query", {"sql_query": "SELECT ..."})
handle_get_table_definitionRetrieves the DDL (Data Definition Language) statement (SHOW TABLE) for a specific table.schema_name, table_nameuse_mcp_tool("redshift-admin", "handle_get_table_definition", {"schema_name": "public", ...})
handle_inspect_tableRetrieves detailed information about a specific Redshift table, covering design, storage, health, and usage.schema_name, table_nameuse_mcp_tool("redshift-admin", "handle_inspect_table", {"schema_name": "analytics", ...})
handle_monitor_workloadAnalyzes cluster workload patterns over a specified time window using various diagnostic scripts.time_window_days (optional), top_n_queries (optional)use_mcp_tool("redshift-admin", "handle_monitor_workload", {"time_window_days": 7})

TO DO

  • Improve Prompt Options
  • Add support for more credential methods
  • Add Support for Redshift Serverless

References

Installatie

TypingMind
Vereisten:

Node.js 18+

{
  "mcpServers": {
    "redshift-utils-mcp": {
      "command": "uvx",
      "args": [
        "redshift-utils-mcp"
      ],
      "env": {
        "REDSHIFT_CLUSTER_ID": "your-cluster-id",
        "REDSHIFT_DATABASE": "your_database_name",
        "REDSHIFT_SECRET_ARN": "arn:aws:secretsmanager:...",
        "AWS_REGION": "us-east-1"
      }
    }
  }
}

Gebruik Redshift Utils MCP met meerdere AI-modellen

TypingMind koppelt MCP-tools aan de werkruimte. Zodra Redshift Utils is verbonden, kun je deze dus met verschillende AI-modellen in TypingMind gebruiken, zonder de verbinding voor elk model apart in te stellen. Deze MCP-integratie draait lokaal via de TypingMind MCP-connector op je apparaat.

Installatiehandleiding voor de lokale connector

Gebruik dit als de MCP-server toegang nodig heeft tot lokale bestanden, apps of privébronnen op je computer.

1

Open de MCP-instellingen

Ga in TypingMind naar Instellingen, Geavanceerde instellingen en vervolgens Model Context Protocol. Kies daar Connector instellen.

  1. Open TypingMind in je browser.
  2. Klik op het pictogram Instellingen.
  3. Ga naar Geavanceerde instellingen.
  4. Open het gedeelte Model Context Protocol.
  5. Klik op Connector instellen en kies Dit apparaat.
Instelscherm voor de TypingMind MCP-connector met Dit apparaat geselecteerd
2

Voer de connectoropdracht uit

Kies Dit apparaat, kopieer de opdracht uit TypingMind en voer deze uit in Terminal. Laat het proces draaien zolang je MCP gebruikt.

  1. Kopieer de installatieopdracht die TypingMind toont.
  2. Open Terminal op macOS of Windows Terminal op Windows.
  3. Plak de opdracht en voer deze uit.
  4. Keur de pakketinstallatie goed als Terminal vraagt of je wilt doorgaan.
  5. Laat het proces in het Terminal-venster draaien zolang je MCP-tools gebruikt.
3

Voeg Redshift Utils toe als server

Klik op Servers bewerken zodra de connectorstatus Gereed is en plak de MCP-serverconfiguratie.

  1. Wacht tot de connectorstatus Gereed aangeeft.
  2. Klik op Servers bewerken.
  3. Plak de MCP-serverconfiguratie van Redshift Utils.
  4. Sla de serverlijst op.
  5. Vernieuw om te controleren of de connector nog steeds klaar is voor gebruik.
MCP-instellingen van TypingMind met een actieve server en de knop Servers bewerken
{
  "mcpServers": {
    "redshift-utils": {
      "command": "npx",
      "args": [
        "-y",
        "redshift-utils-mcp"
      ]
    }
  }
}
4

Gebruik de verbinding met verschillende modellen

Sla de serverlijst op, open Plug-ins en schakel de MCP-tools van Redshift Utils in. Selecteer vervolgens een ondersteund AI-model in TypingMind en gebruik de tools in de chat of wijs ze toe aan een AI-agent.

  1. Open de pagina Plug-ins in TypingMind.
  2. Schakel de MCP-tools van Redshift Utils in.
  3. Start een chat en kies het AI-model dat je wilt gebruiken.
  4. Gebruik de MCP-tools in een chat of wijs ze toe aan een AI-agent.
  5. Schakel wanneer nodig over naar een ander AI-model zonder opnieuw verbinding te maken met MCP.
TypingMind-chat met ingeschakelde MCP-tools en een geselecteerd AI-model
Kun je Redshift Utils gebruiken om me hiermee te helpen?
Redshift Utils
Zeker. Ik heb het gelezen.
Dit vond ik met Redshift Utils.

Veelgestelde vragen

Waarvoor wordt de MCP-server Redshift Utils gebruikt?

Redshift Utils is een MCP-server waarmee compatibele AI-clients verbinding kunnen maken met externe tools en context. In TypingMind hoef je deze MCP-server maar één keer toe te voegen om de tools beschikbaar te maken in je AI-werkruimte.

Kan ik Redshift Utils MCP met meerdere AI-modellen in TypingMind gebruiken?

Ja. TypingMind verbindt MCP-tools op werkruimteniveau. Daardoor kun je Redshift Utils gebruiken met verschillende AI-modellen, zoals Claude, ChatGPT, Gemini of andere modellen die je in TypingMind hebt ingesteld, zonder de MCP-server voor elk model afzonderlijk in te stellen.

Waarom Redshift Utils MCP gebruiken met TypingMind?

TypingMind is een van de beste interfaces voor chats met LLM's, omdat het meerdere AI-modellen, prompts, plug-ins, AI-agenten, API-sleutels en MCP-tools samenbrengt in één werkruimte. Als Redshift Utils verbonden is, kun je de MCP-tools ervan gebruiken met je favoriete modellen en je chatworkflow overzichtelijk houden in TypingMind.

Hoe verbind ik Redshift Utils MCP met TypingMind?

Redshift Utils werkt via de lokale MCP-connector van TypingMind. Dit is de beste optie als de MCP-server toegang nodig heeft tot lokale bestanden, desktopapps, opdrachtregeltools of privébronnen op je computer.

Welke tools biedt Redshift Utils MCP in TypingMind?

Redshift Utils biedt MCP-functies die je kunt inschakelen via de pagina Plug-ins in TypingMind. Je kunt ze gebruiken in chats of toewijzen aan AI-agenten.

Moet ik mijn API-sleutels delen met TypingMind om Redshift Utils MCP te gebruiken?

Nee. TypingMind werkt in de eerste plaats lokaal en laat je de controle houden over je modelaanbieders, API-sleutels, prompts en MCP-configuratie. Als Redshift Utils authenticatie vereist, voeg je bij het maken van de verbinding de vereiste headers, OAuth-instellingen of lokale configuratie voor die MCP-server toe.

Gerelateerde MCP-servers

Toon alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇