Simple PostgreSQL MCP Server

Simple PostgreSQL MCP Server is an MCP server that connects AI assistants directly to PostgreSQL relational databases. Developed by Netanel Bollag, it serves as both a lightweight interface for querying data and an educational template for developers learning to build their own Model Context Protocol tools. Software engineers, data analysts, and researchers use this server to interact with schemas and records through natural language. The server exposes database querying tools such as execute_query and test_connection, alongside dedicated resources for inspecting table lists and schema definitions across a specified database namespace. It also implements pre-built prompt templates for automated query generation and analytical query construction. The codebase is written in Python and operates using Astral's uv package manager, making it simple to inspect, adapt, or expand for custom relational workflows. It enables conversational agents to fetch data, inspect column types, verify connections, and run SELECT queries against local or hosted PostgreSQL instances.

Category: Databases & Data Stores

Tags: database, postgresql, relational, SQL

Visit Simple PostgreSQL MCP Server

How to install and configure Simple PostgreSQL MCP Server

  1. Clone the repository and navigate to its directory. 2. Create and activate a Python virtual environment, then install dependencies: bash uv venv source .venv/bin/activate uv pip install -r requirements.txt 3. Add the server configuration to your MCP client (such as Claude Desktop) under mcpServers: json { "mcpServers": { "postgres": { "command": "/path/to/uv", "args": [ "--directory", "/path/to/simple-psql-mcp", "run", "postgres" ], "env": { "DSN": "postgresql://username:password@localhost:5432/my-db", "SCHEMA": "public" } } } } 4. Alternatively, execute ./generate_mcp_config.sh to generate the configuration interactively. 5. Test the setup using npx @modelcontextprotocol/inspector uv --directory . run postgres -e DSN=postgresql://username:password@hostname:port/database -e SCHEMA=public.

What you can do with Simple PostgreSQL MCP Server

  • Running conversational SQL queries against live PostgreSQL tables to extract specific user records or aggregate metrics without writing SQL manually. - Inspecting relational table schemas, column types, and structural relationships directly within prompt sessions using MCP database resources. - Testing PostgreSQL connectivity and validating credentials before deploying AI database agents or running broader analytical workflows. - Generating and optimizing complex analytical SQL queries using the included prompt templates and database schema context.

Key facts

  • Open Source
  • https://github.com/NetanelBollag/simple-psql-mcp
  • Databases & Data Stores
  • database, postgresql, relational, SQL

Part of MCP Servers

Related MCP servers

  • MCP Memory Keeper — MCP Memory Keeper is an MCP server that provides persistent context management and memory storage for Claude AI coding assistants.…
  • MCP Notes — MCP Notes is an MCP server that provides note-taking and note-management capabilities to AI models using Amazon Web Services DynamoDB…
  • MCP Neo4j Server — MCP Neo4j Server is an MCP server that provides an integration between the Neo4j graph database and Model Context Protocol…
  • MCP Memory Toolkit — MCP Memory Toolkit is an MCP server that provides persistent memory capabilities for Claude and other compatible assistants using ChromaDB.…
  • MCP Memory Server — MCP Memory Server is an MCP server that integrates Claude Desktop with Azure Cosmos DB and OpenAI embeddings to provide…
  • MCP MS SQL Server — MCP MS SQL Server is an MCP server that provides a standardized Model Context Protocol interface for AI models to…

What is Simple PostgreSQL MCP Server?

Simple PostgreSQL MCP Server is an open source Model Context Protocol server that allows AI assistants like Claude to connect to PostgreSQL databases. It provides tools to test database connections and run queries, resources to inspect schemas and tables, and prompt templates for building analytical SQL queries.

How do I install Simple PostgreSQL MCP Server?

You install it by cloning the repository, creating a virtual environment with uv, and installing dependencies via requirements.txt. You then configure your client using the provided JSON structure with your PostgreSQL DSN and schema, or run the generate_mcp_config.sh script.

Which MCP clients work with Simple PostgreSQL MCP Server?

It works with any client supporting the Model Context Protocol standard, including Claude Desktop and the MCP Inspector interface. Claude Desktop supports its tools, resources, and prompt templates natively.

Is Simple PostgreSQL MCP Server safe for production?

No. The project is an experimental template meant for learning and local development. It checks whether queries start with SELECT, but it does not provide comprehensive protection against SQL injection and should not be run in production environments.

Is Simple PostgreSQL MCP Server open source?

Yes, Simple PostgreSQL MCP Server is open source software released under the MIT license. The full source code is publicly accessible on GitHub.

  • AI Tools
  • Categories
  • Industries
  • CLI Coding Agents
  • MCP Servers
  • MCP Categories