Skip to main content
Glama
santosh07401

Redshift MCP Server

by santosh07401

redshift_connection_status

Check the connection status of Amazon Redshift databases to verify connectivity and troubleshoot issues.

Instructions

Check the Redshift connection status.

Returns:
    Connection status information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'redshift_connection_status' tool. It is registered via @mcp.tool() decorator and checks the Redshift connection status, returning JSON with status details or error.
    @mcp.tool()
    def redshift_connection_status() -> str:
        """
        Check the Redshift connection status.
        
        Returns:
            Connection status information
        """
        try:
            with get_connection() as conn:
                return json.dumps({
                    "status": "connected",
                    "host": REDSHIFT_HOST,
                    "port": REDSHIFT_PORT,
                    "database": REDSHIFT_DATABASE
                }, indent=2)
        except Exception as e:
            return json.dumps({
                "status": "disconnected",
                "error": str(e)
            }, indent=2)
  • Supporting helper function used by the tool to establish the database connection.
    def get_connection():
        """Create a connection to Redshift or local Postgres."""
        try:
            # If host is localhost and port is 5432, assume local Postgres for testing
            if REDSHIFT_HOST == "localhost" and REDSHIFT_PORT == 5432:
                import psycopg2
                return psycopg2.connect(
                    host=REDSHIFT_HOST,
                    port=REDSHIFT_PORT,
                    database=REDSHIFT_DATABASE,
                    user=REDSHIFT_USER,
                    password=REDSHIFT_PASSWORD
                )
            else:
                return redshift_connector.connect(
                    host=REDSHIFT_HOST,
                    port=REDSHIFT_PORT,
                    database=REDSHIFT_DATABASE,
                    user=REDSHIFT_USER,
                    password=REDSHIFT_PASSWORD
                )
        except Exception as e:
            logger.error(f"Connection error: {e}")
            raise

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/santosh07401/redshift-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server