PostgreSQL Multi-Schema

PostgreSQL Multi-Schema

harjjotsinghh

Provides read-only access to PostgreSQL databases with the ability to specify and isolate multiple schemas for secure cross-schema querying.

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

3585 views3Local (stdio)

What it does

  • Execute read-only SQL queries across multiple schemas
  • Inspect table schemas and metadata from authorized namespaces
  • Configure schema-level access control via allowlist
  • Discover tables across multiple schemas with isolation
  • Access column information and data types

Best for

Multi-tenant applications with schema-per-tenant architectureDatabase analysis across different organizational unitsSecure data exploration with schema-level permissions
Multi-schema support with isolationRead-only access for safetySchema allowlist security

About PostgreSQL Multi-Schema

PostgreSQL Multi-Schema is a community-built MCP server published by harjjotsinghh that provides AI assistants with tools and capabilities via the Model Context Protocol. PostgreSQL Multi-Schema offers read-only access with advanced schema support for secure query execution and multi-namesp It is categorized under databases, analytics data.

How to install

You can install PostgreSQL Multi-Schema in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.

License

PostgreSQL Multi-Schema is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.

PostgreSQL Multi-Schema MCP Server

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.

Key Features

  • 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

Components

Tools

  • 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

Resources

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

Usage

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)

Examples

# 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

Usage with Claude Desktop

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

NPX

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

License

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.

Alternatives

Related Skills

Browse all skills
postgresql-psql

Comprehensive guide for PostgreSQL psql - the interactive terminal client for PostgreSQL. Use when connecting to PostgreSQL databases, executing queries, managing databases/tables, configuring connection options, formatting output, writing scripts, managing transactions, and using advanced psql features for database administration and development.

38
fullstack-developer

Modern web development expertise covering React, Node.js, databases, and full-stack architecture. Use when: building web applications, developing APIs, creating frontends, setting up databases, deploying web apps, or when user mentions React, Next.js, Express, REST API, GraphQL, MongoDB, PostgreSQL, or full-stack development.

11
backend-dev-guidelines

Comprehensive backend development guide for Langfuse's Next.js 14/tRPC/Express/TypeScript monorepo. Use when creating tRPC routers, public API endpoints, BullMQ queue processors, services, or working with tRPC procedures, Next.js API routes, Prisma database access, ClickHouse analytics queries, Redis queues, OpenTelemetry instrumentation, Zod v4 validation, env.mjs configuration, tenant isolation patterns, or async patterns. Covers layered architecture (tRPC procedures → services, queue processors → services), dual database system (PostgreSQL + ClickHouse), projectId filtering for multi-tenant isolation, traceException error handling, observability patterns, and testing strategies (Jest for web, vitest for worker).

7
whodb

Database operations including querying, schema exploration, and data analysis. Activates for tasks involving PostgreSQL, MySQL, MariaDB, SQLite, MongoDB, Redis, Elasticsearch, or ClickHouse databases.

1
fairdb-backup-manager

Automatically manages PostgreSQL backups with pgBackRest and Wasabi S3 storage when working with FairDB databases Activates when you request "fairdb backup manager" functionality.

1
analytics-pipeline

Real-time analytics with Redis counters, periodic PostgreSQL flush, and time-series aggregation. High-performance event tracking without database bottlenecks.

1