MCP.so
Sign In
Servers

PostgreSQL MCP Server

@vignesh-codes

This repo is an extension of PostgreSQL MCP Server providing functionalities to create tables, insert entries, update entries, delete entries, and drop tables.

Overview

What is PostgreSQL MCP Server?

A Model Context Protocol server that enables LLMs to interact with PostgreSQL databases. It supports inspecting schemas, executing read-only queries, and performing CRUD operations such as creating tables, inserting, updating, deleting entries, and dropping tables. Designed for use with Claude Desktop.

How to use PostgreSQL MCP Server?

Install Docker and Claude Desktop, clone the repository, run a PostgreSQL Docker container, build the MCP server image, then configure claude_desktop_config.json with a Docker command pointing to your PostgreSQL URL. Restart Claude Desktop to connect.

Key features of PostgreSQL MCP Server

  • Execute read-only SQL queries via the query tool.
  • Create tables dynamically with specified columns and data types.
  • Insert new entries into any table.
  • Update existing entries based on conditions.
  • Delete entries from tables using conditions.
  • Drop entire tables from the database.
  • Provides JSON schema information for each table as a resource.

Use cases of PostgreSQL MCP Server

  • Ask an LLM to inspect database schemas and explain table structure.
  • Have the LLM create new tables and populate them with sample data.
  • Update or delete records in a database through natural language instructions.
  • Perform ad‑hoc read‑only queries to analyze data without writing SQL.
  • Prototype database schemas and test relationships interactively.

FAQ from PostgreSQL MCP Server

What does this server do that the base PostgreSQL MCP server doesn’t?

It extends the base server with full CRUD capabilities: create tables, insert, update, delete entries, and drop tables, beyond the original read‑only query functionality.

What are the runtime requirements?

Docker is required to build and run the MCP server. The PostgreSQL database can run in a separate Docker container or be an existing remote instance accessible via connection URL.

Where does the data live?

Data resides in the PostgreSQL database you connect to. The server does not store any data locally; it only executes operations against the provided database.

How do I connect the server to my database?

In claude_desktop_config.json, provide a PostgreSQL connection string (e.g., postgresql://user:password@host:port/db-name) as an argument to the Docker container. Use host.docker.internal to reach a host service when running Docker on macOS.

Are operations atomic or transactional?

Read‑only queries are executed within a READ‑ONLY transaction. The CRUD operations (create, insert, update, delete, drop) are performed immediately; the README does not mention explicit transaction control for those operations.

Tags

More from Databases