Database Analyzer

Provides an MCP server to introspect PostgreSQL schemas and execute safe SELECT queries via a standardized interface.
  • python

0

GitHub Stars

python

Language

7 months ago

First Indexed

3 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "nandagopal56-mcp-server-demo": {
      "command": "python",
      "args": [
        "server.py"
      ],
      "env": {
        "POSTGRES_DB": "your_database_name",
        "POSTGRES_HOST": "localhost",
        "POSTGRES_PORT": "5432",
        "POSTGRES_USER": "your_username",
        "POSTGRES_PASSWORD": "your_password"
      }
    }
  }
}

You can introspect and analyze PostgreSQL databases through an MCP server that exposes schema details and safe query capabilities via a standard MCP interface. This server helps you explore tables, columns, relationships, and execute safe SELECT statements without risking data integrity.

How to use

To work with this MCP server, connect your MCP client and use its tools to explore database structures and run safe queries. You can list tables in a schema, inspect table schemas, view column definitions and constraints, and execute SELECT queries with parameterized inputs. All operations are designed to be read-only for safety and to prevent unintended data modifications.

Typical usage patterns include: create a connection to the local MCP server, choose a target database/schema, list available tables, drill into a table to view columns and constraints, and run parameterized SELECT queries to retrieve data without exposing you to SQL injection risks.

If you need to adjust which database you analyze, configure the environment variables for the server before starting it, since connection details are supplied from those variables.

How to install

Prerequisites you need before starting: Python 3.x and a PostgreSQL database.

# Step 1: Clone the MCP server repository
git clone <repository-url>
cd MCP-server-demo

# Step 2: Install required Python packages
pip install -r requirements.txt

# Step 3: Create environment file with database credentials
# Put this in a file named .env at the project root
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=your_database_name
POSTGRES_USER=your_username
POSTGRES_PASSWORD=your_password

Step 4: Start the MCP server and connect with your MCP client.

python server.py

Additional content

Security features you can rely on include: only SELECT queries are allowed to prevent data modifications, parameterized queries to avoid SQL injection, environment variable configuration for sensitive data, and automatic connection cleanup and resource management.

Error handling covers common issues such as database connection problems, invalid queries, schema access problems, and resource cleanup errors, giving you clear messages and recovery steps.

Available tools

list_tables

List all tables in a specified schema to understand the available data structures.

get_table_schema

Retrieve detailed schema information for a specific table, including columns, data types, and constraints.

view_columns

Show column definitions, data types, and nullability for a chosen table.

execute_select

Run parameterized SELECT queries safely to fetch data without modifying the database.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational