PostgreSQL MCP Server
PostgreSQL MCP-Server
Ein MCP-Server (Model Context Protocol), der eine Verbindung zu einer lokalen PostgreSQL-Datenbank herstellt und es KI-Assistenten ermöglicht, Ihre Datenbank abzufragen und zu verwalten.
Bereitgestellte Tools
Tool | Beschreibung |
query | Führt schreibgeschütztes SQL aus (SELECT, SHOW, EXPLAIN) |
execute | Führt Schreib-SQL aus (INSERT, UPDATE, DELETE, CREATE, ALTER, DROP) |
list_tables | Listet alle Tabellen in einem Schema auf |
describe_table | Zeigt Spalten, Typen, Schlüssel und Indizes für eine Tabelle an |
list_schemas | Listet alle Benutzerschemata in der Datenbank auf |
Related MCP server: PostgreSQL MCP Server
Ressourcen
schema-overview (
postgres://schema/overview) — Vollständiger Datenbank-Schema-Überblick in Markdown
Dynamische Verbindung über Header
Dieser Server unterstützt dynamische PostgreSQL-Verbindungen. Sie können Datenbank-Anmeldeinformationen über HTTP-Header in der anfänglichen SSE-Verbindungsanfrage bereitstellen. Dies ermöglicht es einer einzelnen bereitgestellten Instanz des Servers, mehrere verschiedene Datenbanken zu bedienen.
Unterstützte Header
Header | Beschreibung | Standard |
| PostgreSQL-Host |
|
| PostgreSQL-Port |
|
| PostgreSQL-Benutzer |
|
| PostgreSQL-Passwort |
|
| PostgreSQL-Datenbank |
|
| SSL verwenden ( |
|
| CA-Zertifikat |
|
Konfiguration in Antigravity / Cursor (VS Code)
Um diesen Server mit Antigravity oder Cursor zu verwenden, fügen Sie Folgendes zu Ihrer mcp_config.json hinzu (normalerweise zu finden unter %APPDATA%\antigravity\ oder in den MCP-Einstellungen Ihrer IDE):
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": [
"mcp-remote",
"https://postgree-mcp-dfadduf9bsdvdwa9.eastasia-01.azurewebsites.net/sse",
"--header", "x-pg-host: pg-168600c0-aeiyankhan2-d42e.g.aivencloud.com",
"--header", "x-pg-port: 26768",
"--header", "x-pg-user: avnadmin",
"--header", "x-pg-password: YOUR_PASSWORD",
"--header", "x-pg-database: defaultdb",
"--header", "x-pg-ssl: true"
]
}
}
}Konfiguration in Claude Code CLI
Wenn Sie die Claude Code CLI verwenden, können Sie diesen Server mit dem folgenden Befehl hinzufügen:
1. Claude Code installieren (falls noch nicht installiert)
npm install -g @anthropic-ai/claude-code2. Den PostgreSQL MCP-Server hinzufügen
Führen Sie diesen Befehl in Ihrem Terminal aus:
claude mcp add postgres -- npx mcp-remote https://postgree-mcp-dfadduf9bsdvdwa9.eastasia-01.azurewebsites.net/sse \
--header "x-pg-host: pg-168600c0-aeiyankhan2-d42e.g.aivencloud.com" \
--header "x-pg-port: 26768" \
--header "x-pg-user: avnadmin" \
--header "x-pg-password: YOUR_PASSWORD" \
--header "x-pg-database: defaultdb" \
--header "x-pg-ssl: true"Konfiguration in Claude Desktop
Fügen Sie dies zu Ihrer claude_desktop_config.json hinzu:
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": [
"mcp-remote",
"https://postgree-mcp-dfadduf9bsdvdwa9.eastasia-01.azurewebsites.net/sse",
"--header", "x-pg-host: pg-168600c0-aeiyankhan2-d42e.g.aivencloud.com",
"--header", "x-pg-port: 26768",
"--header", "x-pg-user: avnadmin",
"--header", "x-pg-password: YOUR_PASSWORD",
"--header", "x-pg-database: defaultdb",
"--header", "x-pg-ssl: true"
]
}
}
}Lokale Einrichtung (für die Entwicklung)
1. Abhängigkeiten installieren
npm install2. Standard-Datenbank konfigurieren (Optional)
Sie können weiterhin eine .env-Datei für die lokale Entwicklung verwenden:
PG_HOST=localhost
PG_PORT=5432
PG_USER=postgres
PG_PASSWORD=your_password_here
PG_DATABASE=your_database_name3. Erstellen und Ausführen
npm run build
npm startNutzungsbeispiele
Sobald die Konfiguration abgeschlossen ist, können Sie den KI-Assistenten Dinge fragen wie:
"List all tables in my database"
"Describe the users table"
"SELECT * FROM orders WHERE created_at > '2025-01-01'"
"Create a new table called products"
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables Claude to interact with a local PostgreSQL database through SQL queries, schema inspection, and CRUD operations.8225MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with PostgreSQL databases through natural language queries, schema inspection, and safe SQL execution.91
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to query and explore PostgreSQL databases with tools for executing SQL queries, listing tables, and describing table structures.MIT
- FlicenseNot gradedqualityCmaintenanceEnables AI models to execute SQL queries, list tables, and describe table structures on a local PostgreSQL database.2
Related MCP Connectors
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Comprehensive PostgreSQL documentation and best practices, including ecosystem tools
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/aeiyannn/postgree-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server