Skip to content
Agentmart
Submit a tool

PostgreSQL MCP Server

Enterprise PostgreSQL MCP server with 63 tools, 10 resources, 10 prompts for AI-native operations

Connector by neverinfamous · GitHub account verified by the MCP Registry

IndexedMITLocal (stdio)★ 12
Write a review

Install

Works with Claude Code, Codex, VS Code, Cursor, Windsurf, Claude Desktop. Read the repository before you give any tool access to your data.

npx agentmarket install connector/neverinfamous-postgres-mcp-server

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Enterprise PostgreSQL MCP server with 63 tools, 10 resources, 10 prompts for AI-native operations

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this server can do and what it asks for, from its tool list, install config and code. Checked Oct 26, 2026.

Tools
142 read · 80 write · 24 delete · 50 not yet classified
Secrets
None asked for
Install scripts
None found
Runs as
Docker image

Tools by what they do 296

Read from the source code; the running server may list different tools.

Read 142 · Look things up without changing anything.

  • pg_analyze_db_health
  • pg_analyze_query_indexes
  • pg_analyze_workload_indexes
  • pg_audit_diff_backup
  • pg_audit_list_backups
  • pg_bloat_check
  • pg_bounding_box
  • pg_cache_hit_ratio
  • pg_capacity_planning
  • pg_citext_analyze_candidates
  • pg_citext_compare
  • pg_citext_convert_column
Show 130 more tools
  • pg_citext_list_columns
  • pg_citext_schema_advisor
  • pg_connection_pool_optimize
  • pg_connection_stats
  • pg_constraint_analysis
  • pg_count
  • pg_cron_list_jobs
  • pg_database_size
  • pg_dependency_graph
  • pg_describe_table
  • pg_detect_bloat_risk
  • pg_detect_connection_spike
  • pg_detect_query_anomalies
  • pg_distance
  • pg_doc_collection_info
  • pg_doc_find
  • pg_doc_list_collections
  • pg_dump_schema
  • pg_duplicate_indexes
  • pg_exists
  • pg_explain
  • pg_explain_buffers
  • pg_geo_index_optimize
  • pg_geometry_intersection
  • pg_get_indexes
  • pg_hybrid_search
  • pg_index_recommendations
  • pg_index_stats
  • pg_intersection
  • pg_jsonb_contains
  • pg_jsonb_diff
  • pg_jsonb_extract
  • pg_jsonb_index_suggest
  • pg_jsonb_keys
  • pg_jsonb_path_query
  • pg_jsonb_pretty
  • pg_jsonb_security_scan
  • pg_jsonb_stats
  • pg_jsonb_typeof
  • pg_jsonb_validate_path
  • pg_kcache_database_stats
  • pg_kcache_query_stats
  • pg_kcache_resource_analysis
  • pg_kcache_top_cpu
  • pg_kcache_top_io
  • pg_list_constraints
  • pg_list_extensions
  • pg_list_functions
  • pg_list_objects
  • pg_list_partitions
  • pg_list_schemas
  • pg_list_sequences
  • pg_list_tables
  • pg_list_triggers
  • pg_list_views
  • pg_ltree_convert_column
  • pg_ltree_lca
  • pg_ltree_list_columns
  • pg_ltree_query
  • pg_ltree_subpath
  • pg_migration_history
  • pg_migration_risks
  • pg_migration_status
  • pg_object_details
  • pg_partition_info
  • pg_partition_strategy_suggest
  • pg_partman_analyze_partition_health
  • pg_partman_check_default
  • pg_partman_show_config
  • pg_partman_show_partitions
  • pg_partman_undo_partition
  • pg_performance_analysis
  • pg_performance_baseline
  • pg_pgcrypto_hmac
  • pg_point_in_polygon
  • pg_query_plan_compare
  • pg_query_plan_stats
  • pg_quick_query
  • pg_recovery_status
  • pg_replication_status
  • pg_role_attributes
  • pg_role_list
  • pg_role_rls_policies
  • pg_schema_snapshot
  • pg_security_encryption_status
  • pg_security_firewall_rules
  • pg_security_firewall_status
  • pg_security_password_validate
  • pg_security_sensitive_tables
  • pg_security_ssl_status
  • pg_security_user_privileges
  • pg_seq_scan_tables
  • pg_server_version
  • pg_show_settings
  • pg_stat_activity
  • pg_stat_statements
  • pg_stats_correlation
  • pg_stats_descriptive
  • pg_stats_distinct
  • pg_stats_distribution
  • pg_stats_frequency
  • pg_stats_hypothesis
  • pg_stats_lag_lead
  • pg_stats_moving_avg
  • pg_stats_ntile
  • pg_stats_outliers
  • pg_stats_percentiles
  • pg_stats_regression
  • pg_stats_running_total
  • pg_stats_sampling
  • pg_stats_summary
  • pg_stats_time_series
  • pg_stats_top_n
  • pg_system_health
  • pg_table_sizes
  • pg_table_stats
  • pg_tool_index
  • pg_topological_sort
  • pg_transaction_status
  • pg_trigram_similarity
  • pg_unused_indexes
  • pg_uptime
  • pg_user_roles
  • pg_vacuum_stats
  • pg_vector_aggregate
  • pg_vector_distance
  • pg_vector_index_optimize
  • pg_vector_performance
  • pg_vector_search
  • pg_vector_validate

Write 80 · Create, change, send or run things.

  • pg_alert_threshold_set
  • pg_append_insight
  • pg_attach_partition
  • pg_backup_physical
  • pg_backup_schedule_optimize
  • pg_backup_strategy
  • pg_batch_insert
  • pg_buffer
  • pg_cancel_backend
  • pg_citext_create_extension
  • pg_copy_import
  • pg_create_backup_plan
Show 68 more tools
  • pg_create_fts_index
  • pg_create_index
  • pg_create_partition
  • pg_create_partitioned_table
  • pg_create_schema
  • pg_create_sequence
  • pg_create_table
  • pg_create_view
  • pg_cron_alter_job
  • pg_cron_create_extension
  • pg_cron_job_run_details
  • pg_cron_schedule
  • pg_cron_schedule_in_database
  • pg_detach_partition
  • pg_doc_add
  • pg_doc_create_collection
  • pg_doc_create_index
  • pg_doc_modify
  • pg_geometry_buffer
  • pg_geometry_column
  • pg_jsonb_array
  • pg_jsonb_insert
  • pg_jsonb_merge
  • pg_jsonb_object
  • pg_jsonb_set
  • pg_kcache_create_extension
  • pg_like_search
  • pg_locks
  • pg_ltree_create_extension
  • pg_ltree_create_index
  • pg_migration_apply
  • pg_migration_record
  • pg_partman_create_extension
  • pg_partman_create_parent
  • pg_partman_partition_data
  • pg_partman_run_maintenance
  • pg_partman_set_retention
  • pg_pgcrypto_create_extension
  • pg_postgis_create_extension
  • pg_restore_command
  • pg_restore_validate
  • pg_role_assign
  • pg_role_create
  • pg_role_grants
  • pg_role_rls_enable
  • pg_role_set
  • pg_safe_restore_workflow
  • pg_security_mask_data
  • pg_set_config
  • pg_spatial_index
  • pg_text_headline
  • pg_text_rank
  • pg_text_search
  • pg_text_search_config
  • pg_text_sentiment
  • pg_text_to_query
  • pg_text_to_vector
  • pg_transaction_commit
  • pg_transaction_execute
  • pg_transaction_release
  • pg_transaction_savepoint
  • pg_upsert
  • pg_vacuum
  • pg_vector_add_column
  • pg_vector_batch_insert
  • pg_vector_create_extension
  • pg_vector_create_index
  • pg_vector_insert

Delete 24 · Delete, drop, revoke or wipe things.

  • pg_cron_cleanup_history
  • pg_cron_unschedule
  • pg_doc_drop_collection
  • pg_doc_remove
  • pg_drop_index
  • pg_drop_schema
  • pg_drop_sequence
  • pg_drop_table
  • pg_drop_view
  • pg_execute_code
  • pg_jsonb_delete
  • pg_jsonb_strip_nulls
Show 12 more tools
  • pg_kcache_reset
  • pg_migration_rollback
  • pg_reset_stats
  • pg_role_drop
  • pg_role_grant
  • pg_role_revoke
  • pg_terminate_backend
  • pg_text_normalize
  • pg_transaction_rollback
  • pg_transaction_rollback_to
  • pg_truncate
  • pg_write_query

Not yet classified 50 · We could not tell from the name and description.

  • pg_analyze
  • pg_audit_restore_backup
  • pg_cascade_simulator
  • pg_cluster
  • pg_copy_export
  • pg_diagnose_database_performance
  • pg_dump_table
  • pg_explain_analyze
  • pg_fuzzy_match
  • pg_geo_cluster
  • pg_geo_transform
  • pg_geocode
Show 38 more tools
  • pg_geometry_transform
  • pg_jsonb_agg
  • pg_jsonb_normalize
  • pg_ltree_match
  • pg_migration
  • pg_migration_init
  • pg_pgcrypto_crypt
  • pg_pgcrypto_decrypt
  • pg_pgcrypto_encrypt
  • pg_pgcrypto_gen_random_bytes
  • pg_pgcrypto_gen_random_uuid
  • pg_pgcrypto_gen_salt
  • pg_pgcrypto_hash
  • pg_query_builder
  • pg_quick_schema
  • pg_read_query
  • pg_regexp_match
  • pg_reindex
  • pg_reload_conf
  • pg_schema_design
  • pg_security_audit
  • pg_setup_citext
  • pg_setup_docstore
  • pg_setup_kcache
  • pg_setup_ltree
  • pg_setup_partman
  • pg_setup_pgcron
  • pg_setup_pgcrypto
  • pg_setup_pgvector
  • pg_setup_postgis
  • pg_stats_rank
  • pg_stats_row_number
  • pg_transaction_begin
  • pg_vacuum_analyze
  • pg_vector_cluster
  • pg_vector_dimension_reduce
  • pg_vector_embed
  • pg_vector_normalize

Network hosts it talks to 1

  • github.com · found in code

Files it touches

  • /tmp/postgres-logs/audit.jsonl
  • Any path the agent passes to its tools

Tools (296)

Read from the source code; the running server may differ. Descriptions are the server’s own words; hidden characters are shown as [U+…].

  • pg_alert_threshold_set

    Get recommended alert thresholds for monitoring key database metrics. Note: This is informational only - returns suggested warning/critical thresholds for external monitoring tools. Does not configure alerts in PostgreSQL itself.

  • pg_analyze

    Update table statistics for the query planner.

  • pg_analyze_db_health

    Comprehensive database health analysis including cache hit ratio, bloat, replication, and connection stats.

  • pg_analyze_query_indexes

    Analyze a specific query for index recommendations using EXPLAIN ANALYZE.

  • pg_analyze_workload_indexes

    Analyze database workload using pg_stat_statements to recommend missing indexes.

  • pg_append_insightAppend Insight

    Append a business insight to the in-memory insights memo. Insights are accessible via the postgres://insights resource. Use to record key findings during database analysis.

  • pg_attach_partition

    Attach an existing table as a partition.

  • pg_audit_diff_backup

    Compare a backup snapshot's DDL against the current live schema to show drift since the snapshot was taken.

  • pg_audit_list_backups

    List available pre-mutation backup snapshots with metadata (tool, target, timestamp, type, size).

  • pg_audit_restore_backup

    Restore a pre-mutation backup snapshot. Executes the captured DDL (and optional data INSERTs) within a transaction.

  • pg_backup_physical

    Generate pg_basebackup command for physical (binary) backup.

  • pg_backup_schedule_optimize

    Analyze database activity patterns and recommend optimal backup schedule.

  • pg_backup_strategy

    Design enterprise backup strategy with logical, physical, and continuous archiving options.

  • pg_batch_insert

    Insert multiple rows in a single statement. More efficient than individual inserts. Rows array must not be empty.

  • pg_bloat_check

    Check for table and index bloat. Returns tables with dead tuples.

Show 281 more tools
  • pg_bounding_box

    Find geometries within a bounding box. Swapped min/max values are auto-corrected. Default limit: 10 rows.

  • pg_buffer

    Create a buffer zone around geometries. Default limit: 10 rows, default simplify: 10m (set simplify: 0 to disable). Simplification reduces polygon point count for LLM-friendly payloads.

  • pg_cache_hit_ratio

    Get buffer cache hit ratio statistics.

  • pg_cancel_backend

    Cancel a running query (graceful, preferred over terminate).

  • pg_capacity_planning

    Analyze database growth trends and provide capacity planning forecasts. Note: Growth estimates are based on pg_stat_user_tables counters since last stats reset; accuracy depends on how long stats have been accumulating.

  • pg_cascade_simulator

    Simulate the impact of DELETE, DROP, or TRUNCATE on a table. Returns affected tables, estimated row counts, cascade paths, and severity assessment.

  • pg_citext_analyze_candidates

    Find TEXT columns that may benefit from case-insensitive comparisons. Looks for common patterns like email, username, name, slug, etc.

  • pg_citext_compare

    Compare two values using case-insensitive semantics. Useful for testing citext behavior before converting columns.

  • pg_citext_convert_column

    Convert an existing TEXT column to CITEXT for case-insensitive comparisons. This is useful for retrofitting case-insensitivity to existing columns like email or username. Note: If views depend on this column, you must drop and recreate them manually before conversion.

  • pg_citext_create_extension

    Enable the citext extension for case-insensitive text columns. citext is ideal for emails, usernames, and other identifiers where case shouldn't matter.

  • pg_citext_list_columns

    List all columns using the citext type in the database. Useful for auditing case-insensitive columns.

  • pg_citext_schema_advisor

    Analyze a specific table and recommend which columns should use citext. Provides schema design recommendations based on column names and existing data patterns. Requires the 'table' parameter to specify which table to analyze.

  • pg_cluster

    Physically reorder table data based on an index. Call with no args to re-cluster all previously-clustered tables.

  • pg_connection_pool_optimize

    Analyze connection usage and provide pool optimization recommendations.

  • pg_connection_stats

    Get connection statistics by database and state.

  • pg_constraint_analysis

    Analyze all constraints for issues: redundant indexes, missing foreign keys, missing NOT NULL, missing primary keys, and unindexed foreign keys.

  • pg_copy_export

    Export query results using COPY TO. Use query/sql for custom query or table for SELECT *.

  • pg_copy_import

    Generate COPY FROM command for importing data.

  • pg_count

    Count rows in a table, optionally with a WHERE clause or specific column.

  • pg_create_backup_plan

    Generate a backup strategy recommendation with cron schedule.

  • pg_create_fts_index

    Create a GIN index for full-text search on a column.

  • pg_create_index

    Create an index on a table. Supports btree, hash, gin, gist, brin index types.

  • pg_create_partition

    Create a partition. Use subpartitionBy/subpartitionKey to make it sub-partitionable for multi-level partitioning.

  • pg_create_partitioned_table

    Create a partitioned table. Columns: notNull, primaryKey, unique, default. Note: primaryKey/unique must include the partition key column.

  • pg_create_schema

    Create a new schema.

  • pg_create_sequence

    Create a new sequence with optional START, INCREMENT, MIN/MAX, CACHE, CYCLE, and OWNED BY.

  • pg_create_table

    Create a new table with specified columns and constraints. Supports composite primary keys and table-level constraints.

  • pg_create_view

    Create a view or materialized view.

  • pg_cron_alter_job

    Modify an existing cron job. Can change schedule, command, database, username, or active status. Only specify the parameters you want to change.

  • pg_cron_cleanup_history

    Delete old job run history records. Helps prevent the cron.job_run_details table from growing too large. By default, removes records older than 7 days.

  • pg_cron_create_extension

    Enable the pg_cron extension for job scheduling. Requires superuser privileges.

  • pg_cron_job_run_details

    View execution history for cron jobs. Shows start/end times, status, and return messages. Useful for monitoring and debugging scheduled jobs. Default limit is 10 rows.

  • pg_cron_list_jobs

    List all scheduled cron jobs. Shows job ID, name, schedule, command, and status. Jobs without names (jobname: null) must be referenced by jobId. Default limit: 50 rows.

  • pg_cron_schedule

    Schedule a new cron job. Supports standard cron syntax (e.g., "0 2 * * *" for 2 AM daily) or interval syntax (e.g., "30 seconds"). Note: pg_cron allows duplicate job names; use unique names to avoid confusion. Returns the job ID.

  • pg_cron_schedule_in_database

    Schedule a cron job to run in a different database. Useful for cross-database maintenance tasks. Returns the job ID.

  • pg_cron_unschedule

    Remove a scheduled cron job by its ID or name. If both are provided, jobName takes precedence. Job ID accepts numbers or numeric strings. Works for both active and inactive jobs.

  • pg_database_size

    Get the size of a database.

  • pg_dependency_graph

    Get the full foreign key dependency graph with cascade paths, row counts, circular dependency detection, and severity assessment. Agent-optimized structured output.

  • pg_describe_table

    Get detailed table structure including columns, types, and constraints. For tables/views only, not sequences.

  • pg_detach_partition

    Detach a partition. Use concurrently: true for non-blocking. Use finalize: true only after an interrupted CONCURRENTLY detach.

  • pg_detect_bloat_risk

    Scores tables by bloat risk using multiple factors: dead tuple ratio, vacuum staleness, table size, and autovacuum effectiveness. Returns per-table risk scores (0-100) with actionable recommendations.

  • pg_detect_connection_spike

    Detects unusual connection patterns by analyzing concentration by user, application, state, and wait events. Flags when a single user or application monopolizes the connection pool, or when idle-in-transaction connections accumulate.

  • pg_detect_query_anomalies

    Detects queries deviating from their historical execution time norms using z-score analysis. Requires pg_stat_statements extension. Returns anomalous queries ranked by deviation severity with risk level.

  • pg_diagnose_database_performance

    Consolidates key performance metrics into a single actionable report: slow queries, blocking locks, connection pressure, cache hit ratio, disk usage, and top tables by size and activity. Returns per-section health ratings and recommendations with an overall health score.

  • pg_distance

    Find nearby geometries within a distance from a point. Output distance_meters is always in meters; unit parameter only affects the filter threshold.

  • pg_doc_add

    Add one or more JSON documents to a collection.

  • pg_doc_collection_info

    Get document collection statistics: row count, size, and indexes.

  • pg_doc_create_collection

    Create a new JSONB document collection (table with doc JSONB + generated _id primary key).

  • pg_doc_create_index

    Create an expression index on document fields for faster queries. Uses PostgreSQL expression indexes on JSONB paths.

  • pg_doc_drop_collection

    Drop a document collection (table).

  • pg_doc_find

    Query documents in a JSONB collection with optional filter, field projection, and pagination.

  • pg_doc_list_collections

    List JSONB document collections in a schema. Collections are tables with a 'doc' JSONB column and '_id' text column.

  • pg_doc_modify

    Update documents matching a filter. Set fields with 'set' and remove fields with 'unset'.

  • pg_doc_remove

    Remove documents matching a filter from a collection.

  • pg_drop_index

    Drop an index from a table. Supports IF EXISTS, CASCADE, and CONCURRENTLY options.

  • pg_drop_schema

    Drop a schema (optionally with all objects).

  • pg_drop_sequence

    Drop a sequence. Supports IF EXISTS and CASCADE options.

  • pg_drop_table

    Drop a table from the database.

  • pg_drop_view

    Drop a view or materialized view. Supports IF EXISTS and CASCADE options.

  • pg_dump_schema

    Get the pg_dump command for a schema or database.

  • pg_dump_table

    Generate DDL for a table or sequence. Returns CREATE TABLE for tables, CREATE SEQUENCE for sequences.

  • pg_duplicate_indexes

    Find duplicate or overlapping indexes (same leading columns). Candidates for consolidation.

  • pg_execute_codeExecute Codecan change or delete data

    Execute TypeScript/JavaScript code in a sandboxed environment with access to all PostgreSQL tools via the pg.* API. Available API groups: - pg.core: readQuery, writeQuery, listTables, describeTable, createTable, createIndex, etc. (18 methods) - pg.transactions: begin, commit, rollback, savepoint, execute (7 methods) - pg.jsonb: extract, set, insert, delete, contains, pathQuery (19 methods) - pg.text: search, fuzzy, headline, rank (11 methods) - pg.performance: explain, tableStats, indexStats (16 methods) - pg.admin: vacuum, analyze, reindex (10 methods) - pg.monitoring: databaseSize, tableSiz…

  • pg_exists

    Check if rows exist in a table. WHERE clause is optional: with WHERE = checks matching rows; without WHERE = checks if table has any rows at all. For table *schema* existence, use pg_list_tables.

  • pg_explain

    Show query execution plan without running the query.

  • pg_explain_analyze

    Run query and show actual execution plan with timing.

  • pg_explain_buffers

    Show query plan with buffer usage statistics.

  • pg_fuzzy_match

    Fuzzy string matching using fuzzystrmatch extension. Levenshtein (default): returns distance; use maxDistance=5+ for longer strings. Soundex/metaphone: returns phonetic code for exact matches only.

  • pg_geo_cluster

    Perform spatial clustering using DBSCAN or K-Means. DBSCAN defaults: eps=100m, minPoints=3. K-Means default: numClusters=5 (provide explicit value for best results).

  • pg_geo_index_optimize

    Analyze spatial indexes and provide optimization recommendations.

  • pg_geo_transform

    Transform geometry from one spatial reference system (SRID) to another.

  • pg_geocode

    Create a point geometry from latitude/longitude coordinates. The SRID parameter sets output metadata only; input coordinates are always WGS84 lat/lng.

  • pg_geometry_buffer

    Create a buffer zone around a WKT or GeoJSON geometry. Returns the buffered geometry as GeoJSON and WKT.

  • pg_geometry_column

    Add a geometry column to a table. Returns alreadyExists: true if column exists.

  • pg_geometry_intersection

    Compute the intersection of two WKT or GeoJSON geometries. Returns the intersection geometry and whether they intersect.

  • pg_geometry_transform

    Transform a WKT or GeoJSON geometry from one SRID to another. Common SRIDs: 4326 (WGS84/GPS), 3857 (Web Mercator).

  • pg_get_indexes

    List indexes with usage statistics. When table is omitted, lists ALL database indexes (can be large). Use schema/limit to filter.

  • pg_hybrid_search

    Combined vector similarity and full-text search with weighted scoring.

  • pg_index_recommendations

    Suggest missing indexes based on table statistics or query analysis. When sql is provided and HypoPG is installed, creates hypothetical indexes to measure potential performance improvement.

  • pg_index_stats

    Get index usage statistics.

  • pg_intersection

    Find geometries that intersect with a given geometry. Auto-detects SRID from target column if not specified. Default limit: 10 rows.

  • pg_jsonb_agg

    Aggregate rows into a JSONB array. With groupBy, returns all groups with their aggregated items.

  • pg_jsonb_array

    Build a JSONB array from values. Accepts {values: [...]} or {elements: [...]}. Returns {array: [...]}.

  • pg_jsonb_contains

    Find rows where JSONB column contains the specified value. Note: Empty object {} matches all rows.

  • pg_jsonb_delete

    Delete a key or array element from a JSONB column. Accepts path as string or array. Note: rowsAffected reflects matched rows, not whether key existed.

  • pg_jsonb_diff

    Compare two JSONB objects. Returns top-level key differences only (shallow comparison, not recursive).

  • pg_jsonb_extract

    Extract value from JSONB at specified path. Returns null if path does not exist in data structure. Use select param to include identifying columns.

  • pg_jsonb_index_suggest

    Analyze JSONB column and suggest indexes. Only works on object-type JSONB (not arrays).

  • pg_jsonb_insert

    Insert value into JSONB array or object. For arrays, index -1 inserts BEFORE last element (use insertAfter:true to append). For objects, throws error if key already exists.

  • pg_jsonb_keys

    Get all unique keys from a JSONB object column (deduplicated across rows).

  • pg_jsonb_merge

    Merge two JSONB objects. deep=true (default) recursively merges. mergeArrays=true concatenates arrays.

  • pg_jsonb_normalize

    Normalize JSONB to key-value pairs. Use idColumn to specify row identifier (default: "id" if exists, else ctid).

  • pg_jsonb_object

    Build a JSONB object. Use data: {name: "John", age: 30} or parallel arrays keys: ["name"], values: ["John"]. Returns {object: {...}}.

  • pg_jsonb_path_query

    Query JSONB using SQL/JSON path expressions (PostgreSQL 12+). Note: Recursive descent (..) syntax is not supported by PostgreSQL.

  • pg_jsonb_pretty

    Format JSON/JSONB with indentation for readability. Pass raw JSON string via 'json' param, or extract from a table column via 'table' + 'column'. Uses PostgreSQL's native jsonb_pretty() for table mode.

  • pg_jsonb_security_scan

    Scan JSONB for security issues. Only works on object-type JSONB (not arrays). Use larger sampleSize for thorough scans.

  • pg_jsonb_set

    Set value in JSONB at path. Uses dot-notation by default; for literal dots in keys use array format ["key.with.dots"]. Use empty path ('' or []) to replace entire column value.

  • pg_jsonb_stats

    Get statistics about JSONB column usage. Note: topKeys only applies to object-type JSONB, not arrays.

  • pg_jsonb_strip_nulls

    Remove null values from a JSONB column. Use preview=true to see changes without modifying data.

  • pg_jsonb_typeof

    Get JSONB type at path. Uses dot-notation (a.b.c), not JSONPath ($). Response includes columnNull to distinguish NULL columns.

  • pg_jsonb_validate_path

    Validate a JSONPath expression and test it against sample data. Supports vars for parameterized paths.

  • pg_kcache_create_extension

    Enable the pg_stat_kcache extension for OS-level performance metrics. Requires pg_stat_statements to be installed first. Both extensions must be in shared_preload_libraries.

  • pg_kcache_database_stats

    Get aggregated OS-level statistics for a database. Shows total CPU time, I/O, and page faults across all queries.

  • pg_kcache_query_stats

    Get query statistics with OS-level CPU and I/O metrics. Joins pg_stat_statements with pg_stat_kcache to show what SQL did AND what system resources it consumed. orderBy options: 'total_time' (default), 'cpu_time', 'reads', 'writes'. Use minCalls parameter to filter by call count.

  • pg_kcache_reset

    Reset pg_stat_kcache statistics. Use this to start fresh measurements. Note: This also resets pg_stat_statements statistics.

  • pg_kcache_resource_analysis

    Analyze queries to classify them as CPU-bound, I/O-bound, or balanced. Helps identify the root cause of performance issues - is the query computation-heavy or disk-heavy?

  • pg_kcache_top_cpu

    Get top CPU-consuming queries. Shows which queries spend the most time in user CPU (application code) vs system CPU (kernel operations).

  • pg_kcache_top_io

    Get top I/O-consuming queries. Shows filesystem-level reads and writes, which represent actual disk access (not just shared buffer hits).

  • pg_like_search

    Search text using LIKE patterns. Case-insensitive (ILIKE) by default.

  • pg_list_constraints

    List table constraints (primary keys, foreign keys, unique, check).

  • pg_list_extensions

    List installed PostgreSQL extensions with versions.

  • pg_list_functions

    List user-defined functions with optional filtering. Use exclude (array) to filter out extension functions. Default limit=500 may need increasing for busy databases.

  • pg_list_objects

    List database objects filtered by type. Use type: "table" (singular) or types: ["table","view"] (array). Supports: table, view, materialized_view, function, procedure, sequence, index, trigger.

  • pg_list_partitions

    List all partitions of a partitioned table. Returns warning if table is not partitioned.

  • pg_list_schemas

    List all schemas in the database.

  • pg_list_sequences

    List all sequences in the database.

  • pg_list_tables

    List all tables, views, and materialized views with metadata. Use limit to restrict results.

  • pg_list_triggers

    List all triggers.

  • pg_list_views

    List all views and materialized views.

  • pg_locks

    View current lock information.

  • pg_ltree_convert_column

    Convert an existing TEXT column to LTREE type. Note: If views depend on this column, you must drop and recreate them manually before conversion.

  • pg_ltree_create_extension

    Enable the ltree extension for hierarchical tree-structured labels.

  • pg_ltree_create_index

    Create a GiST index on an ltree column for efficient tree queries.

  • pg_ltree_lca

    Find the longest common ancestor of multiple ltree paths.

  • pg_ltree_list_columns

    List all columns using the ltree type in the database.

  • pg_ltree_match

    Match ltree paths using lquery pattern syntax.

  • pg_ltree_query

    Query hierarchical relationships in ltree columns. Supports exact paths (descendants/ancestors) and lquery patterns with wildcards.

  • pg_ltree_subpath

    Extract a portion of an ltree path.

  • pg_migration

    Generate a migration plan for a schema change.

  • pg_migration_apply

    Execute migration SQL and record it atomically in a single transaction. Auto-provisions the tracking table on first use. On failure, rolls back and records a 'failed' entry. Use pg_migration_record instead if you only need to log an already-applied migration.

  • pg_migration_history

    Query migration history with optional filtering by status and source system. Returns paginated results ordered by applied_at descending.

  • pg_migration_init

    Initialize or verify the schema version tracking table (_mcp_schema_versions). Idempotent — safe to call repeatedly. Returns current tracking state.

  • pg_migration_record

    Record a migration in the schema version tracking table with status 'recorded' (metadata only, SQL not executed). Use pg_migration_apply instead to execute SQL and record with status 'applied'. Auto-provisions the tracking table on first use. Computes SHA-256 hash for idempotency detection.

  • pg_migration_risks

    Analyze proposed DDL statements for risks: data loss, lock contention, constraint violations, and breaking changes. Pre-flight check before executing migrations.

  • pg_migration_rollback

    Roll back a specific migration by ID or version. Executes the stored rollback_sql in a transaction and updates status to 'rolled_back'. Use dryRun: true to preview the rollback SQL without executing.

  • pg_migration_status

    Get current migration tracking status: latest version, counts by status, and list of source systems. Returns initialized: false if tracking table doesn't exist.

  • pg_object_details

    Get detailed metadata for a specific database object (table, view, function, sequence, index).

  • pg_partition_info

    Get detailed information about a partitioned table. Returns warning if table is not partitioned.

  • pg_partition_strategy_suggest

    Analyze a table and suggest optimal partitioning strategy.

  • pg_partman_analyze_partition_health

    Analyze the health of partition sets managed by pg_partman. Checks for issues like data in default partitions, missing premake partitions, stale maintenance, and retention configuration.

  • pg_partman_check_default

    Check if any data exists in the default partition that should be moved to child partitions. Data in default indicates partitions may be missing for certain time/value ranges.

  • pg_partman_create_extension

    Enable the pg_partman extension for automated partition management. Requires superuser privileges.

  • pg_partman_create_parent

    Create a new partition set using pg_partman's create_parent() function. Supports time-based and integer-based partitioning with automatic child partition creation. The parent table must already exist before calling this function. Partition type (time vs integer) is automatically detected from the control column's data type. For non-timestamp/integer columns (text, uuid), use raw pg_partman SQL with timeEncoder/timeDecoder parameters. IMPORTANT: For empty tables with no data, you MUST provide startPartition (e.g., 'now' for current date, or a specific date like '2024-01-01'). Without startPar…

  • pg_partman_partition_data

    Move data from the default partition to appropriate child partitions. Creates new partitions if needed for the data being moved.

  • pg_partman_run_maintenance

    Run partition maintenance to create new child partitions and enforce retention policies. Should be executed regularly (e.g., via pg_cron) to keep partitions current. Maintains all partition sets if no specific parent table is specified.

  • pg_partman_set_retention

    Configure retention policy for a partition set. Partitions older than the retention period will be dropped or detached during maintenance.

  • pg_partman_show_config

    View the configuration for a partition set from part_config table.

  • pg_partman_show_partitions

    List all child partitions for a partition set managed by pg_partman.

  • pg_partman_undo_partition

    Convert a partitioned table back to a regular table by moving all data from child partitions to a TARGET table. IMPORTANT: The targetTable parameter is REQUIRED. pg_partman does not consolidate data back to the parent table directly. You must first create an empty table with the same structure as the parent, then specify it as targetTable. Example: undoPartition({ parentTable: "public.events", targetTable: "public.events_consolidated" })

  • pg_performance_analysis

    Analyze a slow query and suggest optimizations.

  • pg_performance_baseline

    Capture current database performance metrics as a baseline for comparison.

  • pg_pgcrypto_create_extension

    Enable the pgcrypto extension for cryptographic functions.

  • pg_pgcrypto_crypt

    Hash a password using crypt() with a salt from gen_salt().

  • pg_pgcrypto_decrypt

    Decrypt data that was encrypted with pg_pgcrypto_encrypt.

  • pg_pgcrypto_encrypt

    Encrypt data using PGP symmetric encryption.

  • pg_pgcrypto_gen_random_bytes

    Generate cryptographically secure random bytes.

  • pg_pgcrypto_gen_random_uuid

    Generate a cryptographically secure UUID v4.

  • pg_pgcrypto_gen_salt

    Generate a salt for use with crypt() password hashing.

  • pg_pgcrypto_hash

    Hash data using various algorithms (SHA-256, SHA-512, MD5, etc.).

  • pg_pgcrypto_hmac

    Compute HMAC for data with a secret key.

  • pg_point_in_polygon

    Check if a point is within any polygon in a table. The geometry column should contain POLYGON or MULTIPOLYGON geometries. Default limit: 10 rows.

  • pg_postgis_create_extension

    Enable the PostGIS extension for geospatial operations.

  • pg_query_builder

    Build a PostgreSQL query based on requirements. Specify tables and operation type.

  • pg_query_plan_compare

    Compare execution plans of two SQL queries to identify performance differences.

  • pg_query_plan_stats

    Get query plan statistics showing planning time vs execution time (requires pg_stat_statements).

  • pg_quick_query

    Quick SQL query guidance for common operations.

  • pg_quick_schema

    Quick reference for exploring database schema.

  • pg_read_query

    Execute a read-only SQL query (SELECT, WITH). Returns rows as JSON. Pass transactionId to execute within a transaction.

  • pg_recovery_status

    Check if server is in recovery mode (replica).

  • pg_regexp_match

    Match text using POSIX regular expressions.

  • pg_reindex

    Rebuild indexes to improve performance. For target: database, name defaults to the current database if omitted.

  • pg_reload_conf

    Reload PostgreSQL configuration without restart.

  • pg_replication_status

    Check replication status and lag.

  • pg_reset_stats

    Reset statistics counters (requires superuser).

  • pg_restore_command

    Generate pg_restore command for restoring backups.

  • pg_restore_validate

    Generate commands to validate backup integrity and restorability.

  • pg_role_assign

    Assign (grant) a role to a user/role, establishing role membership. Optionally with ADMIN OPTION to allow re-granting.

  • pg_role_attributes

    Get detailed attributes for a PostgreSQL role: login, superuser, createdb, createrole, replication, bypassrls, inherit, connection limit, expiration, and OID.

  • pg_role_create

    Create a new PostgreSQL role with optional attributes (LOGIN, PASSWORD, SUPERUSER, CREATEDB, CREATEROLE, REPLICATION, BYPASSRLS, CONNECTION LIMIT, VALID UNTIL).

  • pg_role_drop

    Drop a PostgreSQL role. Use ifExists (default: true) to skip gracefully if the role does not exist.

  • pg_role_grant

    Grant privileges (SELECT, INSERT, UPDATE, DELETE, ALL, etc.) on tables, schemas, sequences, or functions to a PostgreSQL role.

  • pg_role_grants

    Show privileges and memberships for a PostgreSQL role. Includes role attributes, membership in other roles, and optionally table-level grants.

  • pg_role_list

    List PostgreSQL roles with attributes (login, superuser, createdb, etc.) and optional name filtering.

  • pg_role_revoke

    Revoke role membership from a user, or revoke specific privileges on objects from a role. For membership: provide role + user. For privileges: provide role + privileges + table/schema.

  • pg_role_rls_enable

    Enable or disable row-level security (RLS) on a table. Optionally use FORCE to apply RLS even to the table owner.

  • pg_role_rls_policies

    List row-level security (RLS) policies for a table or all tables in a schema. Shows policy name, command, roles, USING/WITH CHECK expressions, and permissive/restrictive type.

  • pg_role_set

    Set the session's active role using SET ROLE, or reset to the original session role with RESET ROLE. Session-scoped and reversible.

  • pg_safe_restore_workflow

    Step-by-step playbook for safely restoring a pre-mutation backup snapshot using side-by-side comparison.

  • pg_schema_design

    Design a database schema for a given use case.

  • pg_schema_snapshot

    Get a complete schema snapshot in a single agent-optimized JSON structure. Includes tables, columns, types, constraints, indexes, triggers, sequences, and extensions.

  • pg_security_audit

    Run a comprehensive security audit checking SSL, password encryption, superuser exposure, logging, and HBA rules.

  • pg_security_encryption_status

    Get encryption status including SSL configuration, password encryption method, and pgcrypto availability.

  • pg_security_firewall_rules

    List detailed pg_hba.conf authentication rules with optional filtering by user or rule type.

  • pg_security_firewall_status

    Get PostgreSQL host-based authentication (pg_hba.conf) summary — the PostgreSQL equivalent of a firewall.

  • pg_security_mask_data

    Apply data masking to sensitive values. Supports email, phone, SSN, credit card, and partial masking.

  • pg_security_password_validate

    Validate password strength against configurable policy. Uses local analysis (no database query).

  • pg_security_sensitive_tables

    Identify tables and columns that may contain sensitive data based on column name patterns.

  • pg_security_ssl_status

    Get SSL/TLS connection and certificate status for active connections.

  • pg_security_user_privileges

    Get comprehensive privilege report for PostgreSQL roles including attributes, membership, and object grants.

  • pg_seq_scan_tables

    Find tables with high sequential scan counts (potential missing indexes). Default minScans=10; use higher values (e.g., 100+) for production databases.

  • pg_server_version

    Get PostgreSQL server version information.

  • pg_set_config

    Set a configuration parameter for the current session.

  • pg_setup_citext

    Complete guide for setting up case-insensitive text columns with citext for emails, usernames, and tags.

  • pg_setup_docstore

    Complete PostgreSQL Document Store setup guide using JSONB collections

  • pg_setup_kcache

    Complete guide for setting up OS-level CPU and I/O performance monitoring with pg_stat_kcache.

  • pg_setup_ltree

    Complete guide for setting up hierarchical tree-structured data with ltree for categories, org charts, and file paths.

  • pg_setup_partman

    Complete guide for setting up automated partition lifecycle management with pg_partman including time-based and serial partitioning.

  • pg_setup_pgcron

    Complete guide for setting up job scheduling with pg_cron including cron syntax, common patterns, and monitoring.

  • pg_setup_pgcrypto

    Complete guide for setting up cryptographic functions with pgcrypto including hashing, encryption, and secure password storage.

  • pg_setup_pgvector

    Complete guide for setting up semantic search with pgvector including table design, indexing, and queries.

  • pg_setup_postgis

    Complete guide for setting up geospatial operations with PostGIS including spatial types, indexing, and queries.

  • pg_show_settings

    Show current PostgreSQL configuration settings. Filter by name pattern or exact setting name. Accepts: pattern, setting, or name parameter.

  • pg_spatial_index

    Create a GiST spatial index for geometry column. Uses IF NOT EXISTS to avoid errors on duplicate names.

  • pg_stat_activity

    Get currently running queries and connections.

  • pg_stat_statements

    Get query statistics from pg_stat_statements (requires extension).

  • pg_stats_correlation

    Calculate Pearson correlation coefficient between two numeric columns. Use groupBy to get correlation per category.

  • pg_stats_descriptive

    Calculate descriptive statistics (count, min, max, avg, stddev, variance, sum) for a numeric column. Use groupBy to get statistics per category. Warning: using groupBy on high-cardinality columns will result in large JSON payloads.

  • pg_stats_distinct

    Get distinct values from a column with count. Useful for understanding cardinality and unique value distribution.

  • pg_stats_distribution

    Analyze data distribution with histogram buckets, skewness, and kurtosis. Use groupBy to get distribution per category.

  • pg_stats_frequency

    Get value frequency distribution (count per unique value) ordered by frequency descending. Shows the most common values first.

  • pg_stats_hypothesis

    Perform one-sample t-test or z-test against a hypothesized mean. For z-test, provide populationStdDev (sigma) for accurate results. Use groupBy to test each group separately.

  • pg_stats_lag_lead

    Access data from previous (LAG) or next (LEAD) rows in an ordered set. Useful for comparisons, deltas, and change detection.

  • pg_stats_moving_avg

    Calculate moving average (AVG OVER sliding window) for a numeric column. Specify windowSize for the number of preceding rows to include.

  • pg_stats_ntile

    Divide ordered rows into N equal buckets (e.g., quartiles with buckets=4). Returns bucket assignment per row.

  • pg_stats_outliers

    Detect statistical outliers in a numeric column using IQR (interquartile range) or Z-score method. IQR is robust against non-normal distributions.

  • pg_stats_percentiles

    Calculate percentiles (quartiles, custom percentiles) for a numeric column. Use groupBy to get percentiles per category.

  • pg_stats_rank

    Assign rank within an ordered result set. Supports rank (gaps), dense_rank (no gaps), and percent_rank (0-1). Use partitionBy to rank within groups.

  • pg_stats_regression

    Perform linear regression analysis (y = mx + b) between two columns. Use groupBy to get regression per category.

  • pg_stats_row_number

    Assign sequential row numbers within an ordered result set. Use partitionBy to restart numbering per group.

  • pg_stats_running_total

    Calculate cumulative running total (SUM OVER) for a numeric column. Use partitionBy to reset total per group.

  • pg_stats_sampling

    Get a random sample of rows. Use sampleSize for exact row count (any method), or percentage for approximate sampling with bernoulli/system methods.

  • pg_stats_summary

    Get summary statistics (count, avg, min, max, stddev) for multiple numeric columns. Defaults to all numeric columns if none specified.

  • pg_stats_time_series

    Aggregate data into time buckets for time series analysis. Use groupBy to get separate time series per category.

  • pg_stats_top_n

    Get the top N rows ranked by a column. Auto-excludes long-content columns (text, json, bytea) from output unless selectColumns is specified. Warning: Using a large 'n' (e.g., > 1000) will result in massive JSON payloads.

  • pg_system_health

    Analyze current system health and resource usage including CPU, memory, and I/O patterns.

  • pg_table_sizes

    Get sizes of all tables with indexes and total.

  • pg_table_stats

    Get table access statistics.

  • pg_terminate_backend

    Terminate a database connection (forceful, use with caution).

  • pg_text_headline

    Generate highlighted snippets from full-text search matches. Use select param for stable row identification (e.g., primary key).

  • pg_text_normalize

    Remove accent marks (diacritics) from text using PostgreSQL unaccent extension. Note: Does NOT lowercase or trim—use LOWER()/TRIM() in a query for those operations.

  • pg_text_rank

    Get relevance ranking for full-text search results. Returns matching rows only with rank score.

  • pg_text_search

    Full-text search using tsvector and tsquery.

  • pg_text_search_config

    List available full-text search configurations (e.g., english, german, simple).

  • pg_text_sentiment

    Perform basic sentiment analysis on text using keyword matching.

  • pg_text_to_query

    Convert text to tsquery for full-text search. Modes: plain (default), phrase (proximity matching), websearch (Google-like syntax with AND/OR/-).

  • pg_text_to_vector

    Convert text to tsvector representation for full-text search operations.

  • pg_tool_index

    Get a compact index of all available PostgreSQL tools for discovery.

  • pg_topological_sort

    Get tables in safe DDL execution order. 'create' direction: dependencies first (for CREATE TABLE). 'drop' direction: dependents first (for DROP TABLE).

  • pg_transaction_begin

    Begin a new transaction. Returns a transaction ID for subsequent operations.

  • pg_transaction_commit

    Commit a transaction, making all changes permanent.

  • pg_transaction_execute

    Execute multiple statements atomically in a single transaction.

  • pg_transaction_release

    Release a savepoint, keeping all changes since it was created.

  • pg_transaction_rollback

    Rollback a transaction, undoing all changes.

  • pg_transaction_rollback_to

    Rollback to a savepoint, undoing changes made after it.

  • pg_transaction_savepoint

    Create a savepoint within a transaction for partial rollback.

  • pg_transaction_status

    Check the status of an active transaction without modifying it. Returns whether the transaction is active, aborted (needs rollback), or not found.

  • pg_trigram_similarity

    Find similar strings using pg_trgm trigram matching. Returns similarity score (0-1). Default threshold 0.3; use lower (e.g., 0.1) for partial matches.

  • pg_truncate

    Truncate a table, removing all rows quickly. Use cascade to truncate dependent tables.

  • pg_unused_indexes

    Find indexes that have never been used (idx_scan = 0). Candidates for removal.

  • pg_upsert

    Insert a row or update if it already exists (INSERT ... ON CONFLICT DO UPDATE). Specify conflict columns for uniqueness check. Use data or values for column-value pairs.

  • pg_uptime

    Get server uptime and startup time.

  • pg_user_roles

    List all roles assigned to a user/role, including admin option and SET option (PG 16+).

  • pg_vacuum

    Run VACUUM to reclaim storage and update visibility map. Use analyze: true to also update statistics. Verbose output goes to PostgreSQL server logs.

  • pg_vacuum_analyze

    Run VACUUM and ANALYZE together for optimal performance. Verbose output goes to PostgreSQL server logs.

  • pg_vacuum_stats

    Get detailed vacuum statistics including dead tuples, last vacuum times, and wraparound risk.

  • pg_vector_add_column

    Add a vector column to a table. Requires: table, column, dimensions.

  • pg_vector_aggregate

    Calculate average vector. Requires: table, column. Optional: groupBy, where.

  • pg_vector_batch_insert

    Efficiently insert multiple vectors. vectors param expects array of {vector: [...], data?: {...}} objects, NOT raw arrays. Example: vectors: [{vector: [0.1, 0.2], data: {name: "a"}}]

  • pg_vector_cluster

    Perform K-means clustering on vectors. Returns cluster centroids only (not row assignments). To assign rows to clusters, compare row vectors to centroids using pg_vector_distance.

  • pg_vector_create_extension

    Enable the pgvector extension for vector similarity search.

  • pg_vector_create_index

    Create vector index. Requires: table, column, type (ivfflat or hnsw).

  • pg_vector_dimension_reduce

    Reduce vector dimensions using random projection. Supports direct vector input OR table-based extraction.

  • pg_vector_distance

    Calculate distance between two vectors. Valid metrics: l2 (default), cosine, inner_product.

  • pg_vector_embed

    Generate text embeddings. Returns a simple hash-based embedding for demos (use external APIs for production).

  • pg_vector_index_optimize

    Analyze vector column and recommend optimal index parameters for IVFFlat/HNSW.

  • pg_vector_insert

    Insert a vector into a table, or update an existing row's vector. For upsert: use updateExisting + conflictColumn + conflictValue to UPDATE existing rows (avoids NOT NULL issues).

  • pg_vector_normalize

    Normalize a vector to unit length.

  • pg_vector_performance

    Analyze vector search performance and index effectiveness. Provide testVector for benchmarking (recommended).

  • pg_vector_search

    Search for similar vectors. Requires: table, column, vector. Use select param to include identifying columns (e.g., select: ["id", "name"]).

  • pg_vector_validate

    Validate vector dimensions against column. Pass any combination of: vector (to check), table+column (for column dimensions), dimensions (expected).

  • pg_write_query

    Execute a write SQL query (INSERT, UPDATE, DELETE). Returns affected row count. Pass transactionId to execute within a transaction.

Signals

Stars
12
Forks
3
Open issues
1
Last commit
Sep 21, 2026 (1 month ago)
Last release
May 14, 2026 (5 months ago)

From GitHub (fetched Oct 24, 2026).

Details

Registry name
io.github.neverinfamous/postgres-mcp-server
Version
1.2.0
Auth
No auth
Packages
oci docker.io/writenotenow/postgres-mcp-enhanced:v1.2.0
License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from neverinfamous

Cite this page

PostgreSQL MCP Server. Agent Mart. https://agentmart.dev/connectors/neverinfamous-postgres-mcp-server (last updated 2026-10-24)