postgres-mcp
Enables read-only SQL query execution and database schema information retrieval on PostgreSQL databases, including tools for executing queries, listing tables, and fetching table schemas.
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-mcplist all tables"
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.
PostgreSQL MCP Server
Implementation of PostgreSQL Model Context Protocol (MCP) server. Enables read-only SQL query execution and database schema information retrieval.
Features
query: Execute read-only SQL queries
listTables: Get a list of tables in the database
getTableSchema: Get schema information for a specified table
Related MCP server: postgres-mcp
Installation
From npm
npm install -g @daitasu/postgres-mcpFrom source
# Clone the repository
git clone https://github.com/daitasu/postgres-mcp.git
cd postgres-mcp
# Install dependencies
pnpm install
# Build
pnpm run buildConfiguration
Using npx (Recommended)
Add to your Claude Desktop or MCP client configuration:
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["@daitasu/postgres-mcp", "postgresql://user:password@localhost:5432/database"]
}
}
}Using global installation
If you installed globally:
{
"mcpServers": {
"postgres": {
"command": "postgres-mcp",
"args": ["postgresql://user:password@localhost:5432/database"]
}
}
}Using local installation
{
"mcpServers": {
"postgres": {
"command": "node",
"args": ["/path/to/postgres-mcp/dist/index.js", "postgresql://user:password@localhost:5432/database"]
}
}
}Command-line execution
# Using npx (no installation required)
npx @daitasu/postgres-mcp postgresql://user:password@localhost:5432/database
# Using global installation
postgres-mcp postgresql://user:password@localhost:5432/database
# Using node directly
node dist/index.js postgresql://user:password@localhost:5432/databaseTool Usage
1. query - Execute SQL queries
Input: { "sql": "SELECT * FROM users LIMIT 10" }
Output: Query results (JSON format)2. listTables - Get table list
Input: {}
Output: List of table names3. getTableSchema - Get table schema
Input: { "tableName": "users" }
Output: List of column names and data typesSecurity
All queries are executed within READ ONLY transactions
Data modification is not possible
Automatically rolled back
Development
# Development mode
pnpm run dev
# Tests
pnpm test
# Type checking
pnpm run typecheck
# Lint
pnpm run lintLicense
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Generate, fix, explain and run read-only SQL on PostgreSQL, MySQL and SQL Server
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
- dataOAuthco.thinair
Read-only PostgreSQL, MySQL, SQL Server access via MCP — 24 dialect-aware hosted tools.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables interaction with PostgreSQL databases through MCP, allowing users to explore database structures, inspect table schemas, and execute read-only SQL queries.-
- AlicenseNot gradedqualityDmaintenanceEnables safe interaction with PostgreSQL databases through read-only queries, schema exploration, and performance analysis.152 npmMIT
- FlicenseNot gradedqualityCmaintenanceEnables read-only SQL queries and schema inspection for PostgreSQL databases with up to 3 named connections.-
- AlicenseNot gradedqualityDmaintenanceRead-only access to PostgreSQL databases, enabling schema inspection and safe SQL queries.15 npmMIT