mcp -postgres-multi-schema
A Model Context Protocol server that provides read-only access to PostgreSQL databases with enhanced multi-schema support.
claude mcp add --transport stdio harjjotsinghh-mcp-server-postgres-multi-schema npx -y mcp-server-postgres-multi-schema <database-url> <schemas>
How to use
This MCP server provides read-only access to one or more PostgreSQL schemas. It exposes a unified view of tables across authorized schemas while enforcing strict schema isolation, so your language models can inspect metadata and run read-only queries without accessing unauthorized objects. The server exposes two core capabilities: a query tool that executes read-only SQL within a restricted transaction context, and metadata access that surfaces table schemas across the allowed schemas. To use it, supply the Postgres connection string and a comma-separated list of schemas you want to expose. By default, if no schemas are provided, the server uses the public schema.
Typical workflow:
- Start the server with the database URL and an allow-list of schemas (e.g., public,audit,analytics).
- Use the query tool to run read-only SQL against the connected database. Each query runs in a READ ONLY transaction and respects the configured search_path so results reflect the allowed schemas.
- Retrieve table schemas and metadata, which are exposed per table across the authorized schemas, enabling schema-aware reasoning while maintaining isolation between schemas.
How to install
Prerequisites:
- Node.js and npm or npx installed on your system.
- Access to the target PostgreSQL database.
Installation steps:
-
Ensure Node.js is installed. You can verify with: node -v npm -v
-
Use NPX to launch the MCP server without a global install (recommended): npx -y mcp-server-postgres-multi-schema <database-url> <schemas>
Example: npx -y mcp-server-postgres-multi-schema postgresql://localhost/mydb public,audit
-
(Optional) If you want to configure Claude Desktop or other clients, add an mcpServers entry with the appropriate command and arguments: { "mcpServers": { "postgres": { "command": "npx", "args": ["-y", "mcp-server-postgres-multi-schema", "postgresql://localhost/mydb", "public,audit"] } } }
Additional notes
Notes and tips:
- Schemas to expose are explicitly listed; other schemas are not accessible via the server.
- If you omit schemas, the default behavior is to expose the public schema.
- The server is read-only; write operations to the database are not permitted through the MCP tools.
- Ensure the database user referenced in the connection string has read permissions on the exposed schemas.
- The tooling surfaces table schemas and metadata in a per-table format, supporting cross-schema discovery while maintaining schema boundaries.
- If you run into connection or permission errors, verify network access to the PostgreSQL host and that the provided schemas exist and are accessible to the user.
Related MCP Servers
mcp-for-beginners
This open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable, and secure AI workflows from session setup to service orchestration.
bitbucket
Bitbucket MCP - A Model Context Protocol (MCP) server for integrating with Bitbucket Cloud and Server APIs
mcp-arr
MCP server for *arr media management suite
crawlbase
Crawlbase MCP Server connects AI agents and LLMs with real-time web data. It powers Claude, Cursor, and Windsurf integrations with battle-tested web scraping, JavaScript rendering, and anti-bot protection enabling structured, live data inside your AI workflows.
npm-search
MCP server for searching npm packages
mcpplay
The FastAPI /docs experience, for MCP servers.