PostgreSQL
MCP server for getting schema information from a PostgreSQL database
Overview
MCP-PG-Schema is a Model Context Protocol server that provides read-only access to PostgreSQL databases, enabling LLMs to inspect database schemas and execute read-only queries.
To use MCP-PG-Schema, configure it with the Claude Desktop app or run it using Docker or NPX with the appropriate PostgreSQL connection string.
- Execute read-only SQL queries against PostgreSQL databases. - Automatically discover and provide JSON schema information for each table, including column names and data types. - Supports configuration through Docker and NPX for easy deployment.
- Inspecting database schemas for data analysis.
- Executing read-only queries for reporting purposes.
- Integrating with LLMs for enhanced data interaction.
Add to your AI client
Use these steps to connect PostgreSQL in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.
Cursor
Add this to your .cursor/mcp.json file in your project root, then restart Cursor.
.cursor/mcp.json
{
"mcpServers": {
"mcp-pg-schema-vinsidious": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-pg-schema-vinsidious"
]
}
}
}Claude Desktop
Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"mcp-pg-schema-vinsidious": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-pg-schema-vinsidious"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"mcp-pg-schema-vinsidious": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-pg-schema-vinsidious"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"mcp-pg-schema-vinsidious": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-pg-schema-vinsidious"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"mcp-pg-schema-vinsidious": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-pg-schema-vinsidious"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"mcp-pg-schema-vinsidious": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-pg-schema-vinsidious"
]
}
}
}FAQ
Can MCP-PG-Schema modify data in the database?
No, MCP-PG-Schema only allows read-only access to the database.
Is there a specific PostgreSQL version required?
MCP-PG-Schema is compatible with standard PostgreSQL databases, but it's recommended to use the latest version for best performance.
How do I configure the server?
You can configure the server using the "mcpServers" section in your `claude_desktop_config.json` or by using Docker/NPX commands.7:["$","div",null,{"className":"container mx-auto flex flex-col gap-4","children":["$L26","$L27",["$","$L28",null,{"currentProject":{"id":1417,"uuid":"64ed9965-bde0-4d03-a5c9-30b4509f6f17","name":"mcp-pg-schema","title":"PostgreSQL","description":"MCP server for getting schema information from a PostgreSQL database","avatar_url":"https://avatars.githubusercontent.com/u/4240309?v=4","created_at":"2025-02-20T15:40:28.643Z","updated_at":"2025-02-23T07:21:41.157Z","status":"created","author_name":"vinsidious","author_avatar_url":"https://avatars.githubusercontent.com/u/4240309?v=4","tags":"mcp-pg-schema,postgresql,database-access","category":"research-and-data","is_featured":false,"sort":1,"url":"https://github.com/vinsidious/mcp-pg-schema","target":"_self","content":"$29","summary":"$2a","img_url":null,"type":null,"metadata":null,"user_uuid":null,"tools":null,"sse_url":null,"sse_provider":null,"sse_params":null,"is_official":false,"server_command":null,"server_params":null,"server_config":null,"allow_call":false,"is_innovation":false,"is_dxt":false,"dxt_manifest":null,"dxt_file_url":null,"is_audit":false},"randomProjects":[],"currentServerKey":"$undefined"}]]}]