PostgreSQL MCP Server
@aadarshjain
关于 PostgreSQL MCP Server
MCP Server (STDIO) for PostgreSQL Database
基本信息
配置
使用下面的配置,将此服务器添加到你的 MCP 客户端。
{
"mcpServers": {
"postgres-mcp-server-aadarshjain": {
"command": "python",
"args": [
"server.py",
"postgresql://username:password@hostname:port/database"
]
}
}
}工具
未检测到工具
工具是从 README 中自动提取的。维护者可以在 ## Tools 标题下列出工具,即可填充这部分内容。
概览
What is PostgreSQL MCP Server?
A Model Context Protocol (MCP) server implementation that connects to a PostgreSQL database and exposes data discovery and querying capabilities as MCP tools. It is intended for developers and AI assistants (e.g., Claude Desktop) to explore database structure and query data through a standardized interface.
How to use PostgreSQL MCP Server?
Run the server by providing a PostgreSQL connection string: python server.py postgresql://username:password@hostname:port/database. For integration with Claude Desktop, add the configuration to the Claude Desktop config file (located at ~/Library/Application Support/Claude/claude_desktop_config.json on macOS, %APPDATA%\Claude\claude_desktop_config.json on Windows, or ~/.config/Claude/claude_desktop_config.json on Linux) and restart the app.
Key features of PostgreSQL MCP Server
- Connect to any PostgreSQL database using a connection string.
- Execute custom SELECT queries with structured results.
- List all tables in the connected database.
- Get detailed schema information for any table.
- Filter database records with simple equality conditions.
- Get database statistics including size, table count, and largest tables.
Use cases of PostgreSQL MCP Server
- Explore database tables and schemas through an AI assistant.
- Query data from PostgreSQL using natural language in Claude Desktop.
- Retrieve database statistics for monitoring or reporting.
- Filter records based on simple criteria without writing raw SQL.
- Integrate PostgreSQL exploration into MCP-compatible applications.
FAQ from PostgreSQL MCP Server
What types of SQL queries are allowed?
Only SELECT queries are permitted to prevent database modifications. Connection credentials are provided via the command line and not stored.
What are the requirements to run the server?
Python 3.7+ and the required packages (mcp, pg8000, sqlalchemy) must be installed. A virtual environment is recommended.
How do I configure this server for Claude Desktop?
Add a JSON entry to the Claude Desktop config file (see the config file locations above) with the command pointing to the absolute path of server.py and the connection string as an argument. Then restart Claude Desktop.
Where is the Claude Desktop configuration file located?
On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json. On Windows: %APPDATA%\Claude\claude_desktop_config.json. On Linux: ~/.config/Claude/claude_desktop_config.json.
Why does the server crash or fail to connect?
Check that the PostgreSQL connection string is correct, the server allows connections from your client, and all dependencies are installed. Use absolute paths for the Python executable if needed.
数据库 分类下的更多 MCP 服务器
Dbhub
bytebaseZero-dependency, token-efficient database MCP server for Postgres, MySQL, SQL Server, MariaDB, SQLite.
Meilisearch MCP Server
meilisearchA Model Context Protocol (MCP) server for interacting with Meilisearch through LLM interfaces.
Multi Database MCP Server
FreePeakA powerful multi-database server implementing the Model Context Protocol (MCP) to provide AI assistants with structured access to databases.
Snowflake MCP Server
isaacwassermanNeon MCP Server
neondatabase-labsMCP server for interacting with Neon Management API and databases
评论