Skip to content

Conversation

@call518
Copy link
Contributor

@call518 call518 commented Aug 20, 2025

Description

Add MCP-PostgreSQL-Ops: a professional, read-only MCP server for PostgreSQL operations, monitoring, and performance analysis. It surfaces server info, active connections, configuration search, capacity metrics, and pg_stat_statements / pg_stat_monitor–based insights via safe, predefined tools.

Server Details

  • Server: postgresql-ops (Python, FastMCP; supports stdio and streamable-http)
  • Changes to: New server entry with tools for server status, structure exploration, performance monitoring, and capacity management.

Motivation and Context

Many PostgreSQL MCP servers focus on general SQL access. MCP-PostgreSQL-Ops is purpose-built for operations and observability in production: it provides slow-query analysis, index-usage insights, config discovery, and size/capacity views—all read-only to minimize risk. This fills a gap for teams that want actionable diagnostics without enabling write access from LLM clients.

How Has This Been Tested?

Tested locally with:
Claude Desktop using the provided mcpServers configuration; verified tool calls and end-to-end responses.
MCP Inspector via the included script for interactive tool validation.

Scenarios exercised:
get_server_info, get_active_connections, get_postgresql_config
get_pg_stat_statements_top_queries, get_pg_stat_monitor_recent_queries, get_index_usage_stats
get_database_size_info, get_table_size_info, get_vacuum_analyze_stats

Both stdio and streamable-http modes were run as documented.

Breaking Changes

None. This is an additive server entry; no existing MCP clients need to change unless they opt in by adding the server to their mcpServers configuration.

Types of changes

  • [] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follows MCP security best practices
  • I have updated the server's README accordingly
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional context

  • Key features/tools: server info & sessions, structure exploration (DBs/tables/users), performance (top queries, real-time monitoring, index usage), and capacity (DB/table sizes, VACUUM/ANALYZE stats).
  • Security posture: strictly read-only; no direct SQL—only predefined queries; sensitive fields masked.
  • Transport modes: stdio by default; streamable-http supported for local testing.
  • Env vars: POSTGRES_HOST, POSTGRES_PORT, POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB, plus FASTMCP_* and MCP_LOG_LEVEL.
  • Prereqs: PostgreSQL ≥12 (tested with 16); recommended extensions pg_stat_statements (required for some tools) and optional pg_stat_monitor.

@olaservo olaservo merged commit 5a76b9f into modelcontextprotocol:main Aug 22, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants