PostgreSQL Multi-Schema

by harjjotsinghh

3 stars
1.1k downloads
Not rated
GitHub

About

Provides read-only access to PostgreSQL databases with enhanced multi-schema support, enabling schema inspection, query execution, and isolation across multiple namespaces.

Details

Author
harjjotsinghh
Repository
HarjjotSinghh/mcp-server-postgres-multi-schema
GitHub stars
3
Downloads
1,082
License
MIT License
Categories
Database, Other, AI, Design, Developer Tools, Search, Infrastructure, Security
Tags
#postgres, #sql, #sql-agent, #mobile

- Multi-Schema Support: Explicitly specify which schemas to expose through command-line configuration
- Schema Isolation: Strict access control to only authorized schemas listed during server startup
- Cross-Schema Discovery: Unified view of tables across multiple schemas while maintaining schema boundaries
- Metadata Security: Filters system catalogs to only expose user-defined tables in specified schemas

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name PostgreSQL Multi-Schema
    Command (node, npx, python, etc.) npx
    Arguments
    • Argument 1 -y
    • Argument 2 mcp-server-postgres-multi-schema
    • Argument 3 postgresql://localhost/mydb
    • Argument 4 public,audit

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

The server requires a database URL and accepts a comma-separated list of schemas to expose:

npx -y mcp-server-postgres-multi-schema <database-url> [schemas]

- database-url: PostgreSQL connection string (e.g., postgresql://localhost/mydb)
- schemas: Comma-separated list of schemas to expose (defaults to 'public' if not specified)

Configure the "mcpServers" section in your claude_desktop_config.json:

query

Execute read-only SQL queries against the connected database. Input: sql (string): The SQL query to execute. All queries are executed within a READ ONLY transaction, with schema context maintained through search_path restriction.

- query
- Execute read-only SQL queries against the connected database
- Input: sql (string): The SQL query to execute
- All queries are executed within a READ ONLY transaction
- Schema context maintained through search_path restriction

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "postgresql multi-schema": {
            "env": {},
            "args": [
                "-y",
                "mcp-server-postgres-multi-schema",
                "postgresql://localhost/mydb",
                "public,audit"
            ],
            "shell": false,
            "command": "npx"
        }
    }
}

Linux

{
    "env": [],
    "args": [
        "-y",
        "mcp-server-postgres-multi-schema",
        "postgresql://localhost/mydb",
        "public,audit"
    ],
    "shell": false,
    "command": "npx"
}

Macos

{
    "env": [],
    "args": [
        "-y",
        "mcp-server-postgres-multi-schema",
        "postgresql://localhost/mydb",
        "public,audit"
    ],
    "shell": false,
    "command": "npx"
}

Windows

{
    "env": [],
    "args": [
        "/c",
        "npx",
        "-y",
        "mcp-server-postgres-multi-schema",
        "postgresql://localhost/mydb",
        "public,audit"
    ],
    "command": "cmd"
}

Provides read-only access to PostgreSQL databases with multi-schema support, allowing LLMs to inspect schemas and execute queries across different namespaces.

A Model Context Protocol server that provides read-only access to PostgreSQL databases with enhanced multi-schema support. This server enables LLMs to inspect database schemas across multiple namespaces and execute read-only queries while maintaining schema isolation.

- Multi-Schema Support: Explicitly specify which schemas to expose through command-line configuration
- Schema Isolation: Strict access control to only authorized schemas listed during server startup
- Cross-Schema Discovery: Unified view of tables across multiple schemas while maintaining schema boundaries
- Metadata Security: Filters system catalogs to only expose user-defined tables in specified schemas

- query

- Execute read-only SQL queries against the connected database
- Input:sql(string): The SQL query to execute
- All queries are executed within a READ ONLY transaction
- Schema context maintained through search_path restriction

The server provides schema information for each table across authorized schemas:

- Table Schemas(postgres://<host>/<db_schema>/<table>/schema)

- JSON schema information for each table
- Includes column names, data types, and type modifiers
- Automatically discovered from database metadata
- Multi-schema support with explicit schema allow-list

The server requires a database URL and accepts a comma-separated list of schemas to expose:

npx -y mcp-server-postgres-multi-schema <database-url> [schemas]

- database-url: PostgreSQL connection string (e.g.,postgresql://localhost/mydb)
- schemas: Comma-separated list of schemas to expose (defaults to 'public' if not specified)

# Connect with default public schema npx -y mcp-server-postgres-multi-schema postgresql://localhost/mydb # Connect with multiple schemas npx -y mcp-server-postgres-multi-schema postgresql://localhost/mydb public,analytics,staging

Configure the "mcpServers" section in yourclaude_desktop_config.json:

{ "mcpServers": { "postgres": { "command": "npx", "args": [ "-y", "mcp-server-postgres-multi-schema", "postgresql://localhost/mydb", "public,audit" ] } } }

This multi-schema MCP server is licensed under the MIT License. You may use, modify, and distribute the software according to the terms in the LICENSE file.

Multi-database agent access (PostgreSQL, SQLite, MySQL, Oracle, SQL Server) with batch queries, pre-configured connections, and SQLGlot-enforced read-only safety

PostgreSQL MCP server for connecting AI agents to Postgres databases, inspecting schema, and executing SQL queries through MCP tools.

An MCP server for exploring and querying PostgreSQL databases.

MCPg - Production-grade PostgreSQL MCP Server

Safe-by-default PostgreSQL Model Context Protocol server for AI agents.

A read-only MCP server for querying AWS PostgreSQL databases.

A read-only MCP server for AlloyDB, enabling LLMs to query live data directly from AlloyDB databases.

A read-only MCP server by CData that enables LLMs to query live data from EnterpriseDB databases.

A server for direct interaction with CockroachDB databases.

Database MCP server for MySQL, MariaDB, PostgreSQL & SQLite

A single-binary MCP server for MySQL, MariaDB, PostgreSQL, and SQLite

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.