npm package: @squadbase/mcp-redshift
Description: MCP Server for Amazon Redshift
Latest version: 0.0.1

# @squadbase/mcp-redshift

MCP (Model Context Protocol) server for Amazon Redshift.

## Features

- Execute SQL queries against Redshift clusters
- Browse databases, schemas, and tables
- Inspect table schemas with distribution and sort key info
- Get table statistics and storage information
- Designed for AI/LLM data analysis workflows

## Installation

```bash
# No installation needed - use npx
npx -y @squadbase/mcp-redshift

# Or install globally
npm install -g @squadbase/mcp-redshift
mcp-redshift
```

## Usage

### Direct Execution

```bash
npx -y @squadbase/mcp-redshift
```

### Via Launcher

```bash
npx -y @squadbase/mcp redshift
```

## MCP Client Configuration

Add to your `mcp.json`:

**Via Launcher (recommended):**
```json
{
  "mcpServers": {
    "redshift": {
      "command": "npx",
      "args": ["-y", "@squadbase/mcp", "redshift"],
      "env": {
        "REDSHIFT_HOST": "your-cluster.region.redshift.amazonaws.com",
        "REDSHIFT_PORT": "5439",
        "REDSHIFT_DATABASE": "dev",
        "REDSHIFT_USERNAME": "admin",
        "REDSHIFT_PASSWORD": "your-password"
      }
    }
  }
}
```

**Direct:**
```json
{
  "mcpServers": {
    "redshift": {
      "command": "npx",
      "args": ["-y", "@squadbase/mcp-redshift"],
      "env": {
        "REDSHIFT_HOST": "your-cluster.region.redshift.amazonaws.com",
        "REDSHIFT_PORT": "5439",
        "REDSHIFT_DATABASE": "dev",
        "REDSHIFT_USERNAME": "admin",
        "REDSHIFT_PASSWORD": "your-password"
      }
    }
  }
}
```

## Environment Variables

| Variable | Description | Required |
|----------|-------------|----------|
| `REDSHIFT_HOST` | Cluster endpoint | Yes |
| `REDSHIFT_PORT` | Port number (default: 5439) | Yes |
| `REDSHIFT_DATABASE` | Database name | Yes |
| `REDSHIFT_USERNAME` | Username | Yes |
| `REDSHIFT_PASSWORD` | Password | Yes |

## Available Tools

### ping

Health check - returns server name and version.

**Input:** None

**Output:**
```json
{
  "ok": true,
  "server": "mcp-redshift",
  "version": "0.0.1"
}
```

### redshift_info

Get connection requirements and configuration info.

**Input:** None

**Output:**
```json
{
  "ok": true,
  "message": "TODO: implement Redshift connectivity via host/username/password",
  "required_env": [
    "REDSHIFT_HOST",
    "REDSHIFT_PORT",
    "REDSHIFT_DATABASE",
    "REDSHIFT_USERNAME",
    "REDSHIFT_PASSWORD"
  ]
}
```

### execute_sql

Execute a SQL query against Redshift.

**Input:**
```json
{
  "query": "SELECT * FROM public.users LIMIT 10",
  "database": "dev",
  "max_rows": 1000
}
```

### list_databases

List all databases in the Redshift cluster.

**Input:** None

### list_schemas

List all schemas in a database.

**Input:**
```json
{
  "database": "dev"
}
```

### list_tables

List all tables in a schema.

**Input:**
```json
{
  "schema": "public",
  "include_views": false
}
```

### describe_table

Get detailed information about a table including columns, distribution style, and sort keys.

**Input:**
```json
{
  "schema": "public",
  "table": "users"
}
```

**Output includes:**
- Column names, types, nullability
- Distribution key (distkey) columns
- Sort key columns
- Table storage info (diststyle, sortkey type, size)

### sample_table

Get sample rows from a table for data exploration.

**Input:**
```json
{
  "schema": "public",
  "table": "users",
  "limit": 10
}
```

### get_table_stats

Get statistics and storage information for a table.

**Input:**
```json
{
  "schema": "public",
  "table": "users"
}
```

**Output includes:**
- Row count
- Size in MB
- Unsorted percentage
- Statistics accuracy
- Last analyzed timestamp

## Current Status

This package provides stub implementations. The tools return placeholder data to demonstrate the API structure. Full implementation with actual Redshift connectivity via pg driver is planned.

## License

MIT