postgres-mcp-server
๐ PostgreSQL MCP Server โ AI-Powered PostgreSQL Management & Monitoring. A powerful, AI-integrated PostgreSQL Model Context Protocol (MCP) server for automated database operations, monitoring, security, diagnostics, and optimization.
Install / Use
claude mcp add mukul975 -- npx -y github:mukul975/postgres-mcp-serverIf the server publishes to npm under a different name, use that package instead โ check the repo README.
MCP Server
Model Context Protocol server
Quality Score
Category
SecuritySupported Platforms
Our assessment of postgres-mcp-server
postgres-mcp-server scores 72/100 on our quality scale, 1057th of 1,119 Security skills we index.
Its MCP Server is 23 KB long, well organised into 43 sections with 6 code examples: a thorough specification that gives an agent plenty to work with.
It has 10 GitHub stars, so there is little community track record yet; judge it on its content.
Maintenance, license and trust
- The repository was last updated about 7 months ago. That is recent enough to be usable, but agent tooling moves fast, so check the instructions against your agent's current version.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 91/100, with 1 caution from licensing, adoption, age or documentation. These come from repository metadata, not a code audit โ read the skill file before letting an agent act on it.
postgres-mcp-server compared with similar skills
All 4 of these similar skills score higher than postgres-mcp-server; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| postgres-mcp-server (this skill)by mukul975 | 72 | 10 | 7mo ago | MCP Server |
| claude-memby thedotmack | 100 | 99.7k | today | CLAUDE.md |
| Agent-Reachby Panniantong | 100 | 95.9k | 3d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 75.1k | 1d ago | CLAUDE.md |
| CowAgentby zhayujie | 100 | 47.3k | today | CLAUDE.md |
Frequently asked questions
- How do I install postgres-mcp-server?
- Run
claude mcp add mukul975 -- npx -y github:mukul975/postgres-mcp-server. The install tabs above show the steps for each supported agent. - Which AI agents does postgres-mcp-server work with?
- It is written for Claude Code and Claude Desktop, as a MCP Server file. Other agents that read the same format can often use it too.
- Is postgres-mcp-server safe to use?
- It is MIT-licensed and scores 91/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is postgres-mcp-server still maintained?
- The repository was last updated about 7 months ago. That is recent enough to be usable, but agent tooling moves fast, so check the instructions against your agent's current version.
Skill content
View source on GitHub๐ PostgreSQL MCP Server โ AI-Powered PostgreSQL Management & Monitoring
A powerful, AI-integrated PostgreSQL Model Context Protocol (MCP) server for automated database operations, monitoring, security, diagnostics, and optimization. Seamlessly manage PostgreSQL with tools and prompts designed for AI assistants like Claude and ChatGPT.
GitHub Repository: https://github.com/mukul975/postgres-mcp-server.git
๐ Why Use This?
- ๐ Explore, diagnose & optimize PostgreSQL databases with over 200 specialized tools.
- ๐ฌ Interact naturally using AI prompts for SQL generation, health checks, and performance reviews.
- ๐ก๏ธ Built-in security, permission validation, and error handling.
- โ๏ธ Developer-ready integration for Claude, ChatGPT, and custom agents.
๐ Features at a Glance
๐ง Core Database Operations
- โ Create/list databases & schemas
- โ Describe tables, analyze indexes
- โ Safe SELECT, UPDATE, DELETE execution
๐ Monitoring & Performance
- ๐ Query performance & execution plan insights
- ๐ Lock analysis, replication lag checks
- ๐ Index, query, and buffer pool optimization
๐ก๏ธ Security & Access Control
- ๐ฅ User creation, role auditing
- ๐ Privilege granting & connection monitoring
โ๏ธ Diagnostic Utilities
- ๐งช Table bloat check, autovacuum insights
- ๐ฝ WAL logs, checkpoints, long transaction alerts
๐ Tool Categories
To help you navigate, tools are grouped under the following main categories:
- ๐ง General Database Operations
- ๐ฅ User & Role Management
- ๐ Performance Monitoring & Tuning
- ๐ Replication & Backup
- ๐ Lock & Concurrency Management
- โ Constraint & Integrity Management
- ๐ Resource and Activity Monitoring
- ๐งฐ Index and Table Maintenance
- ๐ฌ Advanced Analysis & Diagnostics
๐ Quick Start
1. Installation
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
pip install -r requirements.txt
2. Configuration
cp .env.example .env # or use copy on Windows
# Update with:
DATABASE_URL=postgresql://username:password@localhost:5432/db
3. Run the Server
python postgres_server.py
โ For MCP CLI users:
mcp dev postgres_server.py
๐ง Integrate with Claude Desktop
Example config (claude_desktop_config.json):
<details>
<summary>Windows</summary>
{
"mcpServers": {
"postgres": {
"command": "python",
"args": ["postgres_server.py"],
"cwd": "C:\\path\\to\\postgres-mcp-server",
"env": {
"DATABASE_URL": "postgresql://username:password@localhost:5432/database"
}
}
}
}
</details>
<details>
<summary>macOS/Linux</summary>
{
"mcpServers": {
"postgres": {
"command": "python",
"args": ["postgres_server.py"],
"cwd": "/absolute/path/to/postgres-mcp-server",
"env": {
"DATABASE_URL": "postgresql://username:password@localhost:5432/database"
}
}
}
}
</details>
๐ Tool Search & Complete Reference (238 Tools)
๐ Tool Search Bar
Quick Tool Finder: Use Ctrl+F (or Cmd+F) to search for specific tools by name, category, or functionality.
๐ Tools by Category Overview
| Category | Count | Description | |----------|-------|-------------| | ๐งฑ Core Database | 26 | Basic database operations, schema management | | ๐ฅ User & Security | 18 | User management, roles, permissions | | ๐ Performance | 45 | Monitoring, analysis, optimization | | ๐ Locks & Concurrency | 22 | Lock analysis, blocking queries, deadlocks | | ๐ ๏ธ Maintenance | 28 | VACUUM, ANALYZE, table maintenance | | ๐ Index Management | 15 | Index creation, analysis, optimization | | ๐ Replication & Backup | 20 | Replication monitoring, backup status | | ๐ Table Operations | 25 | Table statistics, constraints, data | | ๐ฆ Extensions & Objects | 18 | Extensions, functions, triggers | | โ๏ธ Configuration | 12 | Settings, variables, system info | | ๐งช Advanced Analysis | 29 | Deep diagnostics, predictions, recommendations |
๐ Complete Tool Reference
๐งฑ Core Database Operations (25 tools)
<details> <summary>Click to expand Core Database tools</summary>PostgreSQL_analyze_database- Run ANALYZE on entire databasePostgreSQL_create_schema- Create new database schemaPostgreSQL_describe_table- Get detailed table informationPostgreSQL_drop_schema- Drop database schemaPostgreSQL_execute_select_query- Execute SELECT queriesPostgreSQL_execute_update_query- Execute INSERT/UPDATE/DELETEPostgreSQL_explain_query- Show query execution planPostgreSQL_get_database_config- Get database configurationPostgreSQL_get_database_growth_trend- Analyze database growthPostgreSQL_get_database_size- Get database size informationPostgreSQL_get_database_size_by_tablespace- Size by tablespacePostgreSQL_get_estimated_row_counts- Get estimated row countsPostgreSQL_get_server_version- Get PostgreSQL version infoPostgreSQL_get_table_count- Get row count of tablePostgreSQL_get_table_size- Get table size informationPostgreSQL_get_table_size_summary- Comprehensive table sizesPostgreSQL_get_tablespace_info- Get tablespace informationPostgreSQL_get_tablespace_usage- Tablespace usage statisticsPostgreSQL_list_databases- List all databasesPostgreSQL_list_schemas- List all schemasPostgreSQL_list_tables- List tables in schemaPostgreSQL_list_views- List views in schemaPostgreSQL_use_database- Switch to different databasePostgreSQL_vacuum_analyze_table- VACUUM ANALYZE tablePostgreSQL_kill_connection- Terminate database connection
๐ฅ User & Security Management (18 tools)
<details> <summary>Click to expand User & Security tools</summary>PostgreSQL_create_user- Create database user/rolePostgreSQL_drop_user- Drop database user/rolePostgreSQL_get_column_privileges- Get column-level privilegesPostgreSQL_get_role_attributes- Get role attributes and detailsPostgreSQL_get_table_permissions- Get table permissionsPostgreSQL_grant_privileges- Grant table privilegesPostgreSQL_list_roles_with_login- List roles with login capabilityPostgreSQL_list_roles_with_superuser- List superuser rolesPostgreSQL_list_users_and_roles- List all users and rolesPostgreSQL_revoke_privileges- Revoke table privilegesPostgreSQL_security_audit- Basic security auditPostgreSQL_get_active_connections- Get active connectionsPostgreSQL_get_connection_limits- Connection limits and usagePostgreSQL_get_connection_pool_stats- Connection pool statisticsPostgreSQL_get_idle_connections- Find idle connectionsPostgreSQL_connection_churn_analysis- Analyze connection patternsPostgreSQL_get_concurrent_connection_analysis- Concurrent connectionsPostgreSQL_analyze_connection_pool_efficiency- Pool efficiency
๐ Performance Monitoring & Analysis (45 tools)
<details> <summary>Click to expand Performance tools</summary>PostgreSQL_analyze_query_complexity- Analyze query complexityPostgreSQL_buffer_cache_hit_ratio- Cache hit ratiosPostgreSQL_check_long_running_queries- Find long-running queriesPostgreSQL_get_active_transactions- Get active transactionsPostgreSQL_get_buffer_cache_contents- Buffer cache contentsPostgreSQL_get_buffer_hit_ratios_detailed- Detailed hit ratiosPostgreSQL_get_cache_hit_ratio- Cache hit ratiosPostgreSQL_get_cache_hit_ratios- Buffer and index cache ratiosPostgreSQL_get_checkpoint_analysis- Checkpoint analysisPostgreSQL_get_checkpoint_info- Checkpoint informationPostgreSQL_get_checkpoint_stats- Checkpoint statisticsPostgreSQL_get_column_statistics- Column statisticsPostgreSQL_get_long_running_transactions- Long transactionsPostgreSQL_get_memory_context_analysis- Memory context analysisPostgreSQL_get_memory_usage_stats- Memory usage statisticsPostgreSQL_get_query_error_analysis- Query error analysisPostgreSQL_get_query_plan_cache_analysis- Query plan cachePostgreSQL_get_query_plan_cache_stats- Plan cache statisticsPostgreSQL_get_query_plans- Query execution plansPostgreSQL_get_query_runtime_distribution- Query runtime statsPostgreSQL_get_slow_queries- Get slow queriesPostgreSQL_get_slow_query_patterns- Slow query patternsPostgreSQL_get_slow_query_statements- Slow query statementsPostgreSQL_get_table_access_patterns- Table access patternsPostgreSQL_get_table_io_stats- Table I/O statisticsPostgreSQL_get_table_statistics- Table statisticsPostgreSQL_get_temp_file_stats- Temporary file statisticsPostgreSQL_get_temp_files- Temporary file usagePostgreSQL_get_top_heavy_queries- Top resource-heavy queriesPostgreSQL_get_transaction_age_monitoring- Transaction age monitoringPostgreSQL_get_wait_events- Current wait eventsPostgreSQL_analyze_advanced_buffer_usage- Advanced buffer analysisPostgreSQL_buffer_cache_relation_analysis- Buffer cache per relationPostgreSQL_checkpoint_activity- Detailed checkpoint activityPostgreSQL_connection_pool_stats- Connection pool statsPostgreSQL_get_connection_pool_analysis- Connection pool analysisPostgreSQL_get_performance_regression_indicators- Performance regressionPostgreSQL_high_io_tables- High I/O tablesPostgreSQL_memory_usage_analysis- Memory usage analysisPostgreSQL_table_io_patterns- Table I/O patternsPostgreSQL_temp_file_usage- Temporary file usage monitoringPostgreSQL_temporary_objects_usage- Temporary objects analysisPostgreSQL_active_temp_file_users- Active temp file usersPostgreSQL_get_high_wait_events- High wait eventsPostgreSQL_query_cancellation_analysis- Query cancellation analysis
๐ Locks & Concurrency Management (22 tools)
<details> <summary>Click to expand Lock & Concurrency tools</summary>PostgreSQL_check_blocking_queries- Get blocking queriesPostgreSQL_detect_conflicting_queries- Detect conflicting queriesPostgreSQL_detect_foreign_key_lock_contention- FK lock contentionPostgreSQL_detect_index_lock_waits- Index lock waitsPostgreSQL_foreign_key_conflicts- Foreign key conflictsPostgreSQL_get_blocking_locks- Blocking and blocked queriesPostgreSQL_get_lock_monitoring- Monitor current locksPostgreSQL_get_lock_statistics- Lock statistics with wait timesPostgreSQL_get_lock_waits- Current lock waitsPostgreSQL_get_locks_info- Current database locksPostgreSQL_deadlock_analysis- Deadlock history and patternsPostgreSQL_analyze_foreign_key_locks- Foreign key lock analysisPostgreSQL_predicate_lock_analysis- Predicate lock analysisPostgreSQL_longest_idle_transactions- Longest idle transactionsPostgreSQL_long_running_prepared_transactions- Long prepared transactionsPostgreSQL_orphaned_prepared_transactions- Orphaned prepared transactionsPostgreSQL_prepared_transaction_retention- Prepared transaction retentionPostgreSQL_get_prepared_transactions- Get prepared transactionsPostgreSQL_analyze_transaction_wraparound- Transaction wraparoundPostgreSQL_detect_transaction_wraparound_risk- Wraparound risk- `PostgreSQL_transaction_wraparound
Truncated for display โ read the full file on GitHub.
Related Skills
claude-mem
99.7kPersistent Context Across Sessions for Every Agent โ Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
Agent-Reach
95.9kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu โ one CLI, zero API fees.
headroom
75.1kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
CowAgent
47.3kOpen-source personal AI assistant & Agent Harness. Plans tasks, runs tools and skills, self-evolves with memory and knowledge. Multi-agent, multi-model, multi-channel. Lightweight, extensible, one-line install.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit โ see the Safety scan above for what the skill file itself contains.
