Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 60 additions & 8 deletions src/redshift-mcp-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ or docker after a successful `docker build -t awslabs/redshift-mcp-server:latest
- `FASTMCP_LOG_LEVEL`: Logging level (`DEBUG`, `INFO`, `WARNING`, `ERROR`)
- `LOG_FILE`: Path to log file (optional, logs to stdout if not specified)

## Basic Usage
## Prompt Examples

### Discovery Workflow

Expand Down Expand Up @@ -274,6 +274,65 @@ WHERE saletime >= '2008-12-30'
ORDER BY saletime DESC, salesid DESC
LIMIT 10;
```

Here are practical prompts to use with the Redshift MCP server in your AI assistant:

### Example 1: Database Discovery

```
Show me all available Redshift clusters, then list databases in the first available one.
```

The assistant will:
1. Call `list_clusters` to discover Redshift instances
2. Pick the first available cluster and call `list_databases`
3. Present a summary of what's available

### Example 2: Schema Exploration

```
What tables are in the 'public' schema of the 'dev' database in my 'analytics-cluster'?
```

The assistant will:
1. Call `list_schemas` with the cluster and database
2. Call `list_tables` with the cluster, database, and schema
3. List all tables with their types (TABLE, VIEW, EXTERNAL TABLE)

### Example 3: Column Inspection

```
Show me the columns of the 'users' table in the 'analytics-cluster'.
```

The assistant will:
1. Discover databases, schemas, and locate the table
2. Call `list_columns` to get column metadata
3. Display column names, types, nullability, and constraints

### Example 4: Data Querying

```
How many customers signed up last month? Run the query on my production cluster.
```

The assistant will:
1. Use `list_clusters` to find the production cluster
2. Execute the appropriate SQL via `execute_query`
3. Format and present the results

### Example 5: End-to-End Analysis

```
Compare total sales by month across all my Redshift clusters for 2024.
```

The assistant will:
1. Discover all clusters via `list_clusters`
2. Explore each cluster's structure (databases, schemas, tables)
3. Execute aggregate queries on each cluster
4. Combine and compare results across environments
```

## Tools

Expand Down Expand Up @@ -430,10 +489,3 @@ Your AWS credentials need the following IAM permissions:
}
```

### Database Permissions

In addition to AWS IAM permissions, you need appropriate database-level permissions:

- **Read Access**: `SELECT` permissions on tables/views you want to query
- **Schema Access**: `USAGE` permissions on schemas you want to explore
- **Database Access**: Connection permissions to databases you want to access
13 changes: 7 additions & 6 deletions src/redshift-mcp-server/awslabs/redshift_mcp_server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
)
from loguru import logger
from mcp.server.fastmcp import Context, FastMCP
from mcp.types import ToolAnnotations
from pydantic import Field


Expand Down Expand Up @@ -96,7 +97,7 @@
)


@mcp.tool(name='list_clusters')
@mcp.tool(name='list_clusters', annotations=ToolAnnotations(readOnlyHint=True))
async def list_clusters_tool(ctx: Context) -> list[RedshiftCluster]:
"""List all available Amazon Redshift clusters and serverless workgroups.

Expand Down Expand Up @@ -161,7 +162,7 @@ async def list_clusters_tool(ctx: Context) -> list[RedshiftCluster]:
raise


@mcp.tool(name='list_databases')
@mcp.tool(name='list_databases', annotations=ToolAnnotations(readOnlyHint=True))
async def list_databases_tool(
ctx: Context,
cluster_identifier: str = Field(
Expand Down Expand Up @@ -240,7 +241,7 @@ async def list_databases_tool(
raise


@mcp.tool(name='list_schemas')
@mcp.tool(name='list_schemas', annotations=ToolAnnotations(readOnlyHint=True))
async def list_schemas_tool(
ctx: Context,
cluster_identifier: str = Field(
Expand Down Expand Up @@ -327,7 +328,7 @@ async def list_schemas_tool(
raise


@mcp.tool(name='list_tables')
@mcp.tool(name='list_tables', annotations=ToolAnnotations(readOnlyHint=True))
async def list_tables_tool(
ctx: Context,
cluster_identifier: str = Field(
Expand Down Expand Up @@ -422,7 +423,7 @@ async def list_tables_tool(
raise


@mcp.tool(name='list_columns')
@mcp.tool(name='list_columns', annotations=ToolAnnotations(readOnlyHint=True))
async def list_columns_tool(
ctx: Context,
cluster_identifier: str = Field(
Expand Down Expand Up @@ -531,7 +532,7 @@ async def list_columns_tool(
raise


@mcp.tool(name='execute_query')
@mcp.tool(name='execute_query', annotations=ToolAnnotations(readOnlyHint=True))
async def execute_query_tool(
ctx: Context,
cluster_identifier: str = Field(
Expand Down
10 changes: 10 additions & 0 deletions src/redshift-mcp-server/icon.svg
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use an official redshift icon instead https://awsfundamentals.com/aws-icons/amazon-redshift.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/redshift-mcp-server/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ docs = "https://awslabs.github.io/mcp/servers/redshift-mcp-server/"
documentation = "https://awslabs.github.io/mcp/servers/redshift-mcp-server/"
repository = "https://github.com/awslabs/mcp.git"
changelog = "https://github.com/awslabs/mcp/blob/main/src/redshift-mcp-server/CHANGELOG.md"
support = "https://github.com/awslabs/mcp/issues"

[project.scripts]
"awslabs.redshift-mcp-server" = "awslabs.redshift_mcp_server.server:main"
Expand Down