MCP Server for PostgreSQL
@JaviMaligno
MCP Server for PostgreSQL について
MCP server with 14 tools for PostgreSQL database operations. Query databases, explore schemas, analyze tables, list indexes/constraints, and get performance statistics. Features security-first design with SQL injection prevention and read-only mode by default. Works with Claude D
基本情報
設定
以下の設定を使って、このサーバーを MCP 対応クライアントに追加してください。
{
"mcpServers": {
"postgres": {
"command": "postgresql-mcp",
"env": {
"POSTGRES_HOST": "localhost",
"POSTGRES_PORT": "5432",
"POSTGRES_USER": "your-user",
"POSTGRES_PASSWORD": "your-password",
"POSTGRES_DB": "your-database"
}
}
}
}ツール
ツールは検出されませんでした
ツールは README から自動的に抽出されます。メンテナーは ## Tools という見出しの下に記載することで、このタブに反映できます。
概要
What is MCP Server for PostgreSQL?
MCP Server for PostgreSQL is a Model Context Protocol server that enables AI assistants to interact with PostgreSQL databases. It provides tools for query execution, schema exploration, performance analysis, and documentation generation, and it works with any MCP-compatible client such as Claude Code or Claude Desktop.
How to use MCP Server for PostgreSQL?
Install via pipx install postgresql-mcp or pip install postgresql-mcp. Configure by setting environment variables like POSTGRES_HOST, POSTGRES_USER, POSTGRES_PASSWORD, and POSTGRES_DB (with POSTGRES_PORT, POSTGRES_SSLMODE, ALLOW_WRITE_OPERATIONS, QUERY_TIMEOUT, and MAX_ROWS as optional). Then add to a client using a command like claude mcp add postgres -s user -e ... -- postgresql-mcp.
Key features of MCP Server for PostgreSQL
- Execute read‑only SQL queries by default (write operations optional)
- Explore schemas, tables, views, and functions
- Describe table structure, indexes, and constraints
- Get EXPLAIN plans and table statistics
- SQL injection prevention and credential protection
- Browsable database structure as MCP resources
Use cases of MCP Server for PostgreSQL
- Ask an AI assistant to list all tables in a schema or describe a table’s structure
- Run read‑only queries against a production database without risk of data modification
- Analyze query performance with EXPLAIN plans and table health statistics
- Generate a data dictionary or documentation for a database schema
FAQ from MCP Server for PostgreSQL
Is the server read‑only by default?
Yes. Write operations (INSERT, UPDATE, DELETE) are blocked unless the ALLOW_WRITE_OPERATIONS environment variable is set to true.
What are the runtime dependencies?
Python 3.10 or later is required. For development, uv and a PostgreSQL instance are needed; production use only needs the installed package.
Where is the database data stored?
Data remains in the PostgreSQL database that the server connects to. The server does not store any data locally.
Are there any limits on query results?
Yes. By default, a maximum of 1000 rows is returned (MAX_ROWS), and queries time out after 30 seconds (QUERY_TIMEOUT). These can be configured via environment variables.
How does authentication work?
The server connects to PostgreSQL using credentials provided as environment variables (POSTGRES_USER, POSTGRES_PASSWORD). Passwords are stored using Pydantic’s SecretStr and never appear in logs or error messages.
「データベース」の他のコンテンツ
MCP Server for Milvus
zilliztechModel Context Protocol Servers for Milvus
MotherDuck's DuckDB MCP Server
motherduckdbLocal MCP server for DuckDB and MotherDuck
Dbhub
bytebaseZero-dependency, token-efficient database MCP server for Postgres, MySQL, SQL Server, MariaDB, SQLite.
Sail MCP Server for Spark SQL
lakehqDrop-in Apache Spark replacement written in Rust, unifying batch processing, stream processing, and compute-intensive AI workloads.
Database Gateway
centralmindUniversal MCP-Server for your Databases optimized for LLMs and AI-Agents.
コメント