Postgres MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Postgres MCP Servershow me the columns in the users table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Postgres MCP Server
A Model Context Protocol (MCP) server that exposes Postgres database information to VS Code agents and other MCP-compatible clients.
Features
List available databases
List schemas in a database
List tables in a schema
Get table schema (columns)
Execute read-only SQL queries
Related MCP server: PostgreSQL MCP Server
Setup
Create a virtual environment and install dependencies:
python3 -m venv venv source venv/bin/activate pip install -r requirements.txtConfigure your Postgres connection in
.env:DB_HOST=localhost DB_PORT=5432 DB_NAME=postgres DB_USER=postgres DB_PASSWORD=your_passwordRun the server:
source venv/bin/activate python server.py
Usage with VS Code
Add to your .vscode/mcp.json:
{
"servers": {
"postgres-mcp": {
"type": "stdio",
"command": "venv/bin/python",
"args": ["server.py"]
}
}
}Tools
list_databases: Lists all databaseslist_schemas: Lists schemas in a databaselist_tables: Lists tables in a schemaget_table_schema: Gets column details for a tableexecute_query: Runs SELECT queries (read-only)
This server cannot be deployed
Maintenance
Related MCP Connectors
- dataOAuthco.thinair
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Hosted MCP server for PostgreSQL diagnostics: slow queries, missing indexes, connection pressure.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables secure querying of PostgreSQL databases through MCP-compatible clients. Supports read-only SQL execution, table exploration, and connection management with built-in security validation.330 npm9MIT
- -licenseNot gradedqualityNot gradedmaintenanceEnables users to perform SQL query execution, schema exploration, and performance analysis on PostgreSQL databases through any MCP-compatible client. It prioritizes security with read-only protection by default and provides guided workflows for database documentation and optimization.-
- AlicenseNot gradedqualityFmaintenanceEnables interaction with PostgreSQL databases through MCP, supporting queries, DDL, DML, and schema inspection.6MIT
- FlicenseAqualityCmaintenanceProvides read-only access to PostgreSQL databases, enabling querying, schema exploration, and table metadata retrieval via MCP tools like query, list-tables, describe-table, list-schemas, and list-environments.5-