MCP ExplorerExplorer

Mcp Client Server

@sripaladuguon a year ago
1 MIT
FreeCommunity
AI Systems
FastMCP implementation of client and server to interact with Caris Database on AWS Redshift

Overview

What is Mcp Client Server

mcp-client-server is a FastMCP implementation designed to facilitate interaction with Caris Database on AWS Redshift, allowing users to query and manage data efficiently.

Use cases

Use cases include data analysis for healthcare, financial reporting, and any scenario where users need to interact with large datasets stored in Redshift.

How to use

To use mcp-client-server, first build the Docker image using the command ‘bash docker-build.sh’. Then, configure the server settings in Cursor with your database connection details and run the server using the command-line interface or directly via Python.

Key features

Key features include querying Redshift databases, listing tables, viewing table schemas, executing read-only SQL queries, and compatibility with Cursor and Claude Desktop.

Where to use

mcp-client-server is primarily used in data analytics, business intelligence, and any applications requiring efficient data retrieval from AWS Redshift databases.

Content

TL;DR
Run the following command:

bash docker-build.sh

The above command builds a Docker image, now you can start the MCP server with the following settings in Cursor (please don’t forget to update the database connection string with your own values i.e, username, password, hostname, port, database):

{
  "mcpServers": {
    "redshift-mcp-docker": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "DEFAULT_SCHEMA=flatiron_cmdb_nsclc_sdm_latest",
        "redshift-mcp-py-simple",
        "postgresql://username:password@redshift-url:5439/database?sslmode=require"
      ],
      "description": "Redshift MCP Server in Docker",
      "env": {}
    }
  }
}

Redshift MCP Server (Python)

A Model Context Protocol (MCP) server for querying Redshift databases, implemented in Python using FastMCP.

Features

  • Query Redshift databases through an MCP server
  • List tables in the database
  • View table schemas
  • Execute read-only SQL queries
  • Works with Cursor and Claude Desktop

Installation

Prerequisites

  • Python 3.10+
  • Redshift database connection details
  • pip 21.3+ (for pyproject.toml support)

Setup

  1. Clone this repository:
git clone https://github.com/yourusername/redshift-mcp-py.git
cd redshift-mcp-py
  1. Create a virtual environment and install the package:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Make sure pip is up to date
pip install --upgrade pip

# Install the package
pip install -e .

If you encounter build errors, you may need to install the build tool first:

pip install hatchling
pip install -e .

Usage

Running the server using the CLI

After installation, you can use the provided command-line interface:

redshift-mcp-server "postgresql://username:password@hostname:port/database?sslmode=require"

Running the server directly

python redshift_mcp_server.py "postgresql://username:password@hostname:port/database?sslmode=require"

Using with Docker

  1. Build the Docker image:
docker build -t redshift-mcp-py .
  1. Run the container:
docker run -i --rm redshift-mcp-py "postgresql://username:password@hostname:port/database?sslmode=require"

Setting up in Cursor

This project includes Cursor-specific settings in the .cursor directory:

  1. Open the project in Cursor.
  2. Edit .cursor/mcp.json to update your database connection string.
  3. Press Alt+M or click the MCP button in the sidebar.
  4. Select “redshift-mcp-py” from the list of available servers.

Alternatively, you can add the following to your global ~/.cursor/mcp.json file:

{
  "mcpServers": {
    "redshift-mcp-py": {
      "command": "python",
      "args": [
        "/path/to/redshift_mcp_server.py",
        "postgresql://username:password@hostname:port/database?sslmode=require"
      ],
      "description": "Redshift MCP Server in Python"
    }
  }
}

Setting up in Claude Desktop

Add the following to Claude Desktop’s configuration file:

{
  "servers": [
    {
      "name": "Redshift MCP Server",
      "command": "python",
      "args": [
        "/path/to/redshift_mcp_server.py",
        "postgresql://username:password@hostname:port/database?sslmode=require"
      ],
      "description": "Redshift MCP Server in Python"
    }
  ]
}

Project Structure

redshift_py/
├── .cursor/                    # Cursor-specific settings
│   ├── mcp.json                # MCP server configuration for Cursor
│   └── settings.json           # Editor settings for Python development
├── src/
│   └── redshift_mcp/
│       ├── __init__.py
│       ├── __main__.py
│       └── server.py
├── redshift_mcp_server.py
├── test_client.py
├── pyproject.toml
├── README.md
├── LICENSE
└── Dockerfile

Available MCP Features

Resources

  • redshift://tables - Lists all tables in the database
  • redshift://{hostname}/{table_name}/schema - Returns schema information for a specific table

Tools

  • query(sql: string) - Executes a read-only SQL query against the Redshift database

Testing

Use the included test client to verify functionality:

# Test using subprocess
python test_client.py "postgresql://username:password@hostname:port/database?sslmode=require"

# Test with direct connection
TEST_MODE=direct python test_client.py "postgresql://username:password@hostname:port/database?sslmode=require"

Security Notes

  • The server only allows read-only transactions
  • All queries are executed inside a transaction that is rolled back
  • Database passwords are never exposed in resource URIs

License

Apache-2.0

mcp-client-server

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers