devacc00
MCP Serverdevacc00public

postgres_mcp

一个为 PostgreSQL 数据库设计的模型上下文协议 (MCP) 服务器,允许 AI 助手安全地与其交互。

Repository Info

0
Stars
0
Forks
0
Watchers
0
Issues
JavaScript
Language
-
License

About This Server

一个为 PostgreSQL 数据库设计的模型上下文协议 (MCP) 服务器,允许 AI 助手安全地与其交互。

Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.

Documentation

PostgreSQL MCP Server

A Model Context Protocol (MCP) server for PostgreSQL databases that allows AI assistants like Claude to interact with your PostgreSQL databases.

Features

  • Browse database schemas and table structures
  • Run read-only SQL queries against your database
  • Automatic truncation of long field values (>200 characters)
  • Read-only transactions for safety

Prerequisites

  • Node.js 18 or higher
  • npm or yarn
  • PostgreSQL database

Installation

# Clone the repository
git clone https://github.com/yourusername/postgres_mcp.git
cd postgres_mcp

# Install dependencies
npm install

# Build the project
npm run build

Usage with Cursor

Setup

  1. Start the MCP server with your PostgreSQL connection string:
node dist/index.js postgres://username:password@hostname:port/database
  1. In Cursor, configure Claude to use the MCP server by creating a .cursor/mcp.json file:
{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": [
        "path/to/repo/postgres_mcp/dist/index.js",
        "postgres://username:password@hostname:port/database"
      ]
    }
  }
}

Make sure to update the path to your index.js file and the database connection string with your actual values.

Using with Claude in Cursor

Once configured, you can ask Claude questions about your database:

  • Explore database structure: "What tables are in the database?"
  • Query data: "Get the first 5 rows from the users table"
  • Ask about schema: "What columns are in the products table?"

Example queries:

Can you show me the schema of the users table?

Run a query to find all customers who made purchases in the last month.

What's the total revenue by product category?

Security Notes

  • The server runs queries in read-only transactions to prevent data modification
  • Database password is not exposed in resource URIs
  • Only allows SELECT queries

Limitations

  • Only supports read operations (no INSERT, UPDATE, DELETE)
  • Field values longer than 200 characters are truncated
  • Limited to PostgreSQL databases

Troubleshooting

If Claude cannot connect to your database:

  1. Verify your PostgreSQL connection string is correct
  2. Ensure the database user has appropriate permissions
  3. Check network connectivity and firewall settings
  4. Verify the MCP server is running (should show no errors in terminal)

License

MIT

Quick Start

1

Clone the repository

git clone https://github.com/devacc00/postgres_mcp
2

Install dependencies

cd postgres_mcp
npm install
3

Follow the documentation

Check the repository's README.md file for specific installation and usage instructions.

Repository Details

Ownerdevacc00
Repopostgres_mcp
LanguageJavaScript
License-
Last fetched8/10/2025

Recommended MCP Servers

💬

Discord MCP

Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.

integrationsdiscordchat
🔗

Knit MCP

Connect AI agents to 200+ SaaS applications and automate workflows.

integrationsautomationsaas
🕷️

Apify MCP Server

Deploy and interact with Apify actors for web scraping and data extraction.

apifycrawlerdata
🌐

BrowserStack MCP

BrowserStack MCP Server for automated testing across multiple browsers.

testingqabrowsers

Zapier MCP

A Zapier server that provides automation capabilities for various apps.

zapierautomation