Provides read-only access to PostgreSQL databases with enhanced multi-schema support, enabling schema inspection, query execution, and isolation across multiple namespaces.
This PostgreSQL Multi-Schema MCP Server provides read-only access to PostgreSQL databases across multiple schemas. It enables language models to inspect database structures and execute safe, read-only queries while maintaining proper isolation between different database schemas.
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
Installation
You can run the MCP server directly using npx without installing it globally:
query: Execute read-only SQL queries against the connected database
Input: sql (string): The SQL query to execute
All queries execute within a READ ONLY transaction
Schema context is maintained through search_path restriction
Available Resources
The server provides schema information for tables across authorized schemas:
Table Schemas (postgres:///<db_schema>/
/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
How to add this MCP server to Cursor
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.
Adding an MCP server to Cursor globally
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:
To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.
How to use the MCP server
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.