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
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.
About
Reviews
Write a reviewNo 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_healthpg_analyze_query_indexespg_analyze_workload_indexespg_audit_diff_backuppg_audit_list_backupspg_bloat_checkpg_bounding_boxpg_cache_hit_ratiopg_capacity_planningpg_citext_analyze_candidatespg_citext_comparepg_citext_convert_column
Show 130 more tools
pg_citext_list_columnspg_citext_schema_advisorpg_connection_pool_optimizepg_connection_statspg_constraint_analysispg_countpg_cron_list_jobspg_database_sizepg_dependency_graphpg_describe_tablepg_detect_bloat_riskpg_detect_connection_spikepg_detect_query_anomaliespg_distancepg_doc_collection_infopg_doc_findpg_doc_list_collectionspg_dump_schemapg_duplicate_indexespg_existspg_explainpg_explain_bufferspg_geo_index_optimizepg_geometry_intersectionpg_get_indexespg_hybrid_searchpg_index_recommendationspg_index_statspg_intersectionpg_jsonb_containspg_jsonb_diffpg_jsonb_extractpg_jsonb_index_suggestpg_jsonb_keyspg_jsonb_path_querypg_jsonb_prettypg_jsonb_security_scanpg_jsonb_statspg_jsonb_typeofpg_jsonb_validate_pathpg_kcache_database_statspg_kcache_query_statspg_kcache_resource_analysispg_kcache_top_cpupg_kcache_top_iopg_list_constraintspg_list_extensionspg_list_functionspg_list_objectspg_list_partitionspg_list_schemaspg_list_sequencespg_list_tablespg_list_triggerspg_list_viewspg_ltree_convert_columnpg_ltree_lcapg_ltree_list_columnspg_ltree_querypg_ltree_subpathpg_migration_historypg_migration_riskspg_migration_statuspg_object_detailspg_partition_infopg_partition_strategy_suggestpg_partman_analyze_partition_healthpg_partman_check_defaultpg_partman_show_configpg_partman_show_partitionspg_partman_undo_partitionpg_performance_analysispg_performance_baselinepg_pgcrypto_hmacpg_point_in_polygonpg_query_plan_comparepg_query_plan_statspg_quick_querypg_recovery_statuspg_replication_statuspg_role_attributespg_role_listpg_role_rls_policiespg_schema_snapshotpg_security_encryption_statuspg_security_firewall_rulespg_security_firewall_statuspg_security_password_validatepg_security_sensitive_tablespg_security_ssl_statuspg_security_user_privilegespg_seq_scan_tablespg_server_versionpg_show_settingspg_stat_activitypg_stat_statementspg_stats_correlationpg_stats_descriptivepg_stats_distinctpg_stats_distributionpg_stats_frequencypg_stats_hypothesispg_stats_lag_leadpg_stats_moving_avgpg_stats_ntilepg_stats_outlierspg_stats_percentilespg_stats_regressionpg_stats_running_totalpg_stats_samplingpg_stats_summarypg_stats_time_seriespg_stats_top_npg_system_healthpg_table_sizespg_table_statspg_tool_indexpg_topological_sortpg_transaction_statuspg_trigram_similaritypg_unused_indexespg_uptimepg_user_rolespg_vacuum_statspg_vector_aggregatepg_vector_distancepg_vector_index_optimizepg_vector_performancepg_vector_searchpg_vector_validate
Write 80 · Create, change, send or run things.
pg_alert_threshold_setpg_append_insightpg_attach_partitionpg_backup_physicalpg_backup_schedule_optimizepg_backup_strategypg_batch_insertpg_bufferpg_cancel_backendpg_citext_create_extensionpg_copy_importpg_create_backup_plan
Show 68 more tools
pg_create_fts_indexpg_create_indexpg_create_partitionpg_create_partitioned_tablepg_create_schemapg_create_sequencepg_create_tablepg_create_viewpg_cron_alter_jobpg_cron_create_extensionpg_cron_job_run_detailspg_cron_schedulepg_cron_schedule_in_databasepg_detach_partitionpg_doc_addpg_doc_create_collectionpg_doc_create_indexpg_doc_modifypg_geometry_bufferpg_geometry_columnpg_jsonb_arraypg_jsonb_insertpg_jsonb_mergepg_jsonb_objectpg_jsonb_setpg_kcache_create_extensionpg_like_searchpg_lockspg_ltree_create_extensionpg_ltree_create_indexpg_migration_applypg_migration_recordpg_partman_create_extensionpg_partman_create_parentpg_partman_partition_datapg_partman_run_maintenancepg_partman_set_retentionpg_pgcrypto_create_extensionpg_postgis_create_extensionpg_restore_commandpg_restore_validatepg_role_assignpg_role_createpg_role_grantspg_role_rls_enablepg_role_setpg_safe_restore_workflowpg_security_mask_datapg_set_configpg_spatial_indexpg_text_headlinepg_text_rankpg_text_searchpg_text_search_configpg_text_sentimentpg_text_to_querypg_text_to_vectorpg_transaction_commitpg_transaction_executepg_transaction_releasepg_transaction_savepointpg_upsertpg_vacuumpg_vector_add_columnpg_vector_batch_insertpg_vector_create_extensionpg_vector_create_indexpg_vector_insert
Delete 24 · Delete, drop, revoke or wipe things.
pg_cron_cleanup_historypg_cron_unschedulepg_doc_drop_collectionpg_doc_removepg_drop_indexpg_drop_schemapg_drop_sequencepg_drop_tablepg_drop_viewpg_execute_codepg_jsonb_deletepg_jsonb_strip_nulls
Show 12 more tools
pg_kcache_resetpg_migration_rollbackpg_reset_statspg_role_droppg_role_grantpg_role_revokepg_terminate_backendpg_text_normalizepg_transaction_rollbackpg_transaction_rollback_topg_truncatepg_write_query
Not yet classified 50 · We could not tell from the name and description.
pg_analyzepg_audit_restore_backuppg_cascade_simulatorpg_clusterpg_copy_exportpg_diagnose_database_performancepg_dump_tablepg_explain_analyzepg_fuzzy_matchpg_geo_clusterpg_geo_transformpg_geocode
Show 38 more tools
pg_geometry_transformpg_jsonb_aggpg_jsonb_normalizepg_ltree_matchpg_migrationpg_migration_initpg_pgcrypto_cryptpg_pgcrypto_decryptpg_pgcrypto_encryptpg_pgcrypto_gen_random_bytespg_pgcrypto_gen_random_uuidpg_pgcrypto_gen_saltpg_pgcrypto_hashpg_query_builderpg_quick_schemapg_read_querypg_regexp_matchpg_reindexpg_reload_confpg_schema_designpg_security_auditpg_setup_citextpg_setup_docstorepg_setup_kcachepg_setup_ltreepg_setup_partmanpg_setup_pgcronpg_setup_pgcryptopg_setup_pgvectorpg_setup_postgispg_stats_rankpg_stats_row_numberpg_transaction_beginpg_vacuum_analyzepg_vector_clusterpg_vector_dimension_reducepg_vector_embedpg_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_setGet 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_analyzeUpdate table statistics for the query planner.
pg_analyze_db_healthComprehensive database health analysis including cache hit ratio, bloat, replication, and connection stats.
pg_analyze_query_indexesAnalyze a specific query for index recommendations using EXPLAIN ANALYZE.
pg_analyze_workload_indexesAnalyze database workload using pg_stat_statements to recommend missing indexes.
pg_append_insightAppend InsightAppend 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_partitionAttach an existing table as a partition.
pg_audit_diff_backupCompare a backup snapshot's DDL against the current live schema to show drift since the snapshot was taken.
pg_audit_list_backupsList available pre-mutation backup snapshots with metadata (tool, target, timestamp, type, size).
pg_audit_restore_backupRestore a pre-mutation backup snapshot. Executes the captured DDL (and optional data INSERTs) within a transaction.
pg_backup_physicalGenerate pg_basebackup command for physical (binary) backup.
pg_backup_schedule_optimizeAnalyze database activity patterns and recommend optimal backup schedule.
pg_backup_strategyDesign enterprise backup strategy with logical, physical, and continuous archiving options.
pg_batch_insertInsert multiple rows in a single statement. More efficient than individual inserts. Rows array must not be empty.
pg_bloat_checkCheck for table and index bloat. Returns tables with dead tuples.
Show 281 more tools
pg_bounding_boxFind geometries within a bounding box. Swapped min/max values are auto-corrected. Default limit: 10 rows.
pg_bufferCreate 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_ratioGet buffer cache hit ratio statistics.
pg_cancel_backendCancel a running query (graceful, preferred over terminate).
pg_capacity_planningAnalyze 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_simulatorSimulate the impact of DELETE, DROP, or TRUNCATE on a table. Returns affected tables, estimated row counts, cascade paths, and severity assessment.
pg_citext_analyze_candidatesFind TEXT columns that may benefit from case-insensitive comparisons. Looks for common patterns like email, username, name, slug, etc.
pg_citext_compareCompare two values using case-insensitive semantics. Useful for testing citext behavior before converting columns.
pg_citext_convert_columnConvert 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_extensionEnable 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_columnsList all columns using the citext type in the database. Useful for auditing case-insensitive columns.
pg_citext_schema_advisorAnalyze 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_clusterPhysically reorder table data based on an index. Call with no args to re-cluster all previously-clustered tables.
pg_connection_pool_optimizeAnalyze connection usage and provide pool optimization recommendations.
pg_connection_statsGet connection statistics by database and state.
pg_constraint_analysisAnalyze all constraints for issues: redundant indexes, missing foreign keys, missing NOT NULL, missing primary keys, and unindexed foreign keys.
pg_copy_exportExport query results using COPY TO. Use query/sql for custom query or table for SELECT *.
pg_copy_importGenerate COPY FROM command for importing data.
pg_countCount rows in a table, optionally with a WHERE clause or specific column.
pg_create_backup_planGenerate a backup strategy recommendation with cron schedule.
pg_create_fts_indexCreate a GIN index for full-text search on a column.
pg_create_indexCreate an index on a table. Supports btree, hash, gin, gist, brin index types.
pg_create_partitionCreate a partition. Use subpartitionBy/subpartitionKey to make it sub-partitionable for multi-level partitioning.
pg_create_partitioned_tableCreate a partitioned table. Columns: notNull, primaryKey, unique, default. Note: primaryKey/unique must include the partition key column.
pg_create_schemaCreate a new schema.
pg_create_sequenceCreate a new sequence with optional START, INCREMENT, MIN/MAX, CACHE, CYCLE, and OWNED BY.
pg_create_tableCreate a new table with specified columns and constraints. Supports composite primary keys and table-level constraints.
pg_create_viewCreate a view or materialized view.
pg_cron_alter_jobModify an existing cron job. Can change schedule, command, database, username, or active status. Only specify the parameters you want to change.
pg_cron_cleanup_historyDelete 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_extensionEnable the pg_cron extension for job scheduling. Requires superuser privileges.
pg_cron_job_run_detailsView 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_jobsList 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_scheduleSchedule 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_databaseSchedule a cron job to run in a different database. Useful for cross-database maintenance tasks. Returns the job ID.
pg_cron_unscheduleRemove 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_sizeGet the size of a database.
pg_dependency_graphGet the full foreign key dependency graph with cascade paths, row counts, circular dependency detection, and severity assessment. Agent-optimized structured output.
pg_describe_tableGet detailed table structure including columns, types, and constraints. For tables/views only, not sequences.
pg_detach_partitionDetach a partition. Use concurrently: true for non-blocking. Use finalize: true only after an interrupted CONCURRENTLY detach.
pg_detect_bloat_riskScores 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_spikeDetects 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_anomaliesDetects 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_performanceConsolidates 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_distanceFind nearby geometries within a distance from a point. Output distance_meters is always in meters; unit parameter only affects the filter threshold.
pg_doc_addAdd one or more JSON documents to a collection.
pg_doc_collection_infoGet document collection statistics: row count, size, and indexes.
pg_doc_create_collectionCreate a new JSONB document collection (table with doc JSONB + generated _id primary key).
pg_doc_create_indexCreate an expression index on document fields for faster queries. Uses PostgreSQL expression indexes on JSONB paths.
pg_doc_drop_collectionDrop a document collection (table).
pg_doc_findQuery documents in a JSONB collection with optional filter, field projection, and pagination.
pg_doc_list_collectionsList JSONB document collections in a schema. Collections are tables with a 'doc' JSONB column and '_id' text column.
pg_doc_modifyUpdate documents matching a filter. Set fields with 'set' and remove fields with 'unset'.
pg_doc_removeRemove documents matching a filter from a collection.
pg_drop_indexDrop an index from a table. Supports IF EXISTS, CASCADE, and CONCURRENTLY options.
pg_drop_schemaDrop a schema (optionally with all objects).
pg_drop_sequenceDrop a sequence. Supports IF EXISTS and CASCADE options.
pg_drop_tableDrop a table from the database.
pg_drop_viewDrop a view or materialized view. Supports IF EXISTS and CASCADE options.
pg_dump_schemaGet the pg_dump command for a schema or database.
pg_dump_tableGenerate DDL for a table or sequence. Returns CREATE TABLE for tables, CREATE SEQUENCE for sequences.
pg_duplicate_indexesFind duplicate or overlapping indexes (same leading columns). Candidates for consolidation.
pg_execute_codeExecute Codecan change or delete dataExecute 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_existsCheck 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_explainShow query execution plan without running the query.
pg_explain_analyzeRun query and show actual execution plan with timing.
pg_explain_buffersShow query plan with buffer usage statistics.
pg_fuzzy_matchFuzzy 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_clusterPerform 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_optimizeAnalyze spatial indexes and provide optimization recommendations.
pg_geo_transformTransform geometry from one spatial reference system (SRID) to another.
pg_geocodeCreate a point geometry from latitude/longitude coordinates. The SRID parameter sets output metadata only; input coordinates are always WGS84 lat/lng.
pg_geometry_bufferCreate a buffer zone around a WKT or GeoJSON geometry. Returns the buffered geometry as GeoJSON and WKT.
pg_geometry_columnAdd a geometry column to a table. Returns alreadyExists: true if column exists.
pg_geometry_intersectionCompute the intersection of two WKT or GeoJSON geometries. Returns the intersection geometry and whether they intersect.
pg_geometry_transformTransform a WKT or GeoJSON geometry from one SRID to another. Common SRIDs: 4326 (WGS84/GPS), 3857 (Web Mercator).
pg_get_indexesList indexes with usage statistics. When table is omitted, lists ALL database indexes (can be large). Use schema/limit to filter.
pg_hybrid_searchCombined vector similarity and full-text search with weighted scoring.
pg_index_recommendationsSuggest 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_statsGet index usage statistics.
pg_intersectionFind geometries that intersect with a given geometry. Auto-detects SRID from target column if not specified. Default limit: 10 rows.
pg_jsonb_aggAggregate rows into a JSONB array. With groupBy, returns all groups with their aggregated items.
pg_jsonb_arrayBuild a JSONB array from values. Accepts {values: [...]} or {elements: [...]}. Returns {array: [...]}.
pg_jsonb_containsFind rows where JSONB column contains the specified value. Note: Empty object {} matches all rows.
pg_jsonb_deleteDelete 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_diffCompare two JSONB objects. Returns top-level key differences only (shallow comparison, not recursive).
pg_jsonb_extractExtract 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_suggestAnalyze JSONB column and suggest indexes. Only works on object-type JSONB (not arrays).
pg_jsonb_insertInsert 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_keysGet all unique keys from a JSONB object column (deduplicated across rows).
pg_jsonb_mergeMerge two JSONB objects. deep=true (default) recursively merges. mergeArrays=true concatenates arrays.
pg_jsonb_normalizeNormalize JSONB to key-value pairs. Use idColumn to specify row identifier (default: "id" if exists, else ctid).
pg_jsonb_objectBuild a JSONB object. Use data: {name: "John", age: 30} or parallel arrays keys: ["name"], values: ["John"]. Returns {object: {...}}.
pg_jsonb_path_queryQuery JSONB using SQL/JSON path expressions (PostgreSQL 12+). Note: Recursive descent (..) syntax is not supported by PostgreSQL.
pg_jsonb_prettyFormat 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_scanScan JSONB for security issues. Only works on object-type JSONB (not arrays). Use larger sampleSize for thorough scans.
pg_jsonb_setSet 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_statsGet statistics about JSONB column usage. Note: topKeys only applies to object-type JSONB, not arrays.
pg_jsonb_strip_nullsRemove null values from a JSONB column. Use preview=true to see changes without modifying data.
pg_jsonb_typeofGet JSONB type at path. Uses dot-notation (a.b.c), not JSONPath ($). Response includes columnNull to distinguish NULL columns.
pg_jsonb_validate_pathValidate a JSONPath expression and test it against sample data. Supports vars for parameterized paths.
pg_kcache_create_extensionEnable 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_statsGet aggregated OS-level statistics for a database. Shows total CPU time, I/O, and page faults across all queries.
pg_kcache_query_statsGet 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_resetReset pg_stat_kcache statistics. Use this to start fresh measurements. Note: This also resets pg_stat_statements statistics.
pg_kcache_resource_analysisAnalyze 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_cpuGet top CPU-consuming queries. Shows which queries spend the most time in user CPU (application code) vs system CPU (kernel operations).
pg_kcache_top_ioGet top I/O-consuming queries. Shows filesystem-level reads and writes, which represent actual disk access (not just shared buffer hits).
pg_like_searchSearch text using LIKE patterns. Case-insensitive (ILIKE) by default.
pg_list_constraintsList table constraints (primary keys, foreign keys, unique, check).
pg_list_extensionsList installed PostgreSQL extensions with versions.
pg_list_functionsList 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_objectsList 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_partitionsList all partitions of a partitioned table. Returns warning if table is not partitioned.
pg_list_schemasList all schemas in the database.
pg_list_sequencesList all sequences in the database.
pg_list_tablesList all tables, views, and materialized views with metadata. Use limit to restrict results.
pg_list_triggersList all triggers.
pg_list_viewsList all views and materialized views.
pg_locksView current lock information.
pg_ltree_convert_columnConvert 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_extensionEnable the ltree extension for hierarchical tree-structured labels.
pg_ltree_create_indexCreate a GiST index on an ltree column for efficient tree queries.
pg_ltree_lcaFind the longest common ancestor of multiple ltree paths.
pg_ltree_list_columnsList all columns using the ltree type in the database.
pg_ltree_matchMatch ltree paths using lquery pattern syntax.
pg_ltree_queryQuery hierarchical relationships in ltree columns. Supports exact paths (descendants/ancestors) and lquery patterns with wildcards.
pg_ltree_subpathExtract a portion of an ltree path.
pg_migrationGenerate a migration plan for a schema change.
pg_migration_applyExecute 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_historyQuery migration history with optional filtering by status and source system. Returns paginated results ordered by applied_at descending.
pg_migration_initInitialize or verify the schema version tracking table (_mcp_schema_versions). Idempotent — safe to call repeatedly. Returns current tracking state.
pg_migration_recordRecord 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_risksAnalyze proposed DDL statements for risks: data loss, lock contention, constraint violations, and breaking changes. Pre-flight check before executing migrations.
pg_migration_rollbackRoll 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_statusGet 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_detailsGet detailed metadata for a specific database object (table, view, function, sequence, index).
pg_partition_infoGet detailed information about a partitioned table. Returns warning if table is not partitioned.
pg_partition_strategy_suggestAnalyze a table and suggest optimal partitioning strategy.
pg_partman_analyze_partition_healthAnalyze 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_defaultCheck 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_extensionEnable the pg_partman extension for automated partition management. Requires superuser privileges.
pg_partman_create_parentCreate 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_dataMove data from the default partition to appropriate child partitions. Creates new partitions if needed for the data being moved.
pg_partman_run_maintenanceRun 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_retentionConfigure retention policy for a partition set. Partitions older than the retention period will be dropped or detached during maintenance.
pg_partman_show_configView the configuration for a partition set from part_config table.
pg_partman_show_partitionsList all child partitions for a partition set managed by pg_partman.
pg_partman_undo_partitionConvert 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_analysisAnalyze a slow query and suggest optimizations.
pg_performance_baselineCapture current database performance metrics as a baseline for comparison.
pg_pgcrypto_create_extensionEnable the pgcrypto extension for cryptographic functions.
pg_pgcrypto_cryptHash a password using crypt() with a salt from gen_salt().
pg_pgcrypto_decryptDecrypt data that was encrypted with pg_pgcrypto_encrypt.
pg_pgcrypto_encryptEncrypt data using PGP symmetric encryption.
pg_pgcrypto_gen_random_bytesGenerate cryptographically secure random bytes.
pg_pgcrypto_gen_random_uuidGenerate a cryptographically secure UUID v4.
pg_pgcrypto_gen_saltGenerate a salt for use with crypt() password hashing.
pg_pgcrypto_hashHash data using various algorithms (SHA-256, SHA-512, MD5, etc.).
pg_pgcrypto_hmacCompute HMAC for data with a secret key.
pg_point_in_polygonCheck 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_extensionEnable the PostGIS extension for geospatial operations.
pg_query_builderBuild a PostgreSQL query based on requirements. Specify tables and operation type.
pg_query_plan_compareCompare execution plans of two SQL queries to identify performance differences.
pg_query_plan_statsGet query plan statistics showing planning time vs execution time (requires pg_stat_statements).
pg_quick_queryQuick SQL query guidance for common operations.
pg_quick_schemaQuick reference for exploring database schema.
pg_read_queryExecute a read-only SQL query (SELECT, WITH). Returns rows as JSON. Pass transactionId to execute within a transaction.
pg_recovery_statusCheck if server is in recovery mode (replica).
pg_regexp_matchMatch text using POSIX regular expressions.
pg_reindexRebuild indexes to improve performance. For target: database, name defaults to the current database if omitted.
pg_reload_confReload PostgreSQL configuration without restart.
pg_replication_statusCheck replication status and lag.
pg_reset_statsReset statistics counters (requires superuser).
pg_restore_commandGenerate pg_restore command for restoring backups.
pg_restore_validateGenerate commands to validate backup integrity and restorability.
pg_role_assignAssign (grant) a role to a user/role, establishing role membership. Optionally with ADMIN OPTION to allow re-granting.
pg_role_attributesGet detailed attributes for a PostgreSQL role: login, superuser, createdb, createrole, replication, bypassrls, inherit, connection limit, expiration, and OID.
pg_role_createCreate a new PostgreSQL role with optional attributes (LOGIN, PASSWORD, SUPERUSER, CREATEDB, CREATEROLE, REPLICATION, BYPASSRLS, CONNECTION LIMIT, VALID UNTIL).
pg_role_dropDrop a PostgreSQL role. Use ifExists (default: true) to skip gracefully if the role does not exist.
pg_role_grantGrant privileges (SELECT, INSERT, UPDATE, DELETE, ALL, etc.) on tables, schemas, sequences, or functions to a PostgreSQL role.
pg_role_grantsShow privileges and memberships for a PostgreSQL role. Includes role attributes, membership in other roles, and optionally table-level grants.
pg_role_listList PostgreSQL roles with attributes (login, superuser, createdb, etc.) and optional name filtering.
pg_role_revokeRevoke 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_enableEnable or disable row-level security (RLS) on a table. Optionally use FORCE to apply RLS even to the table owner.
pg_role_rls_policiesList 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_setSet 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_workflowStep-by-step playbook for safely restoring a pre-mutation backup snapshot using side-by-side comparison.
pg_schema_designDesign a database schema for a given use case.
pg_schema_snapshotGet a complete schema snapshot in a single agent-optimized JSON structure. Includes tables, columns, types, constraints, indexes, triggers, sequences, and extensions.
pg_security_auditRun a comprehensive security audit checking SSL, password encryption, superuser exposure, logging, and HBA rules.
pg_security_encryption_statusGet encryption status including SSL configuration, password encryption method, and pgcrypto availability.
pg_security_firewall_rulesList detailed pg_hba.conf authentication rules with optional filtering by user or rule type.
pg_security_firewall_statusGet PostgreSQL host-based authentication (pg_hba.conf) summary — the PostgreSQL equivalent of a firewall.
pg_security_mask_dataApply data masking to sensitive values. Supports email, phone, SSN, credit card, and partial masking.
pg_security_password_validateValidate password strength against configurable policy. Uses local analysis (no database query).
pg_security_sensitive_tablesIdentify tables and columns that may contain sensitive data based on column name patterns.
pg_security_ssl_statusGet SSL/TLS connection and certificate status for active connections.
pg_security_user_privilegesGet comprehensive privilege report for PostgreSQL roles including attributes, membership, and object grants.
pg_seq_scan_tablesFind tables with high sequential scan counts (potential missing indexes). Default minScans=10; use higher values (e.g., 100+) for production databases.
pg_server_versionGet PostgreSQL server version information.
pg_set_configSet a configuration parameter for the current session.
pg_setup_citextComplete guide for setting up case-insensitive text columns with citext for emails, usernames, and tags.
pg_setup_docstoreComplete PostgreSQL Document Store setup guide using JSONB collections
pg_setup_kcacheComplete guide for setting up OS-level CPU and I/O performance monitoring with pg_stat_kcache.
pg_setup_ltreeComplete guide for setting up hierarchical tree-structured data with ltree for categories, org charts, and file paths.
pg_setup_partmanComplete guide for setting up automated partition lifecycle management with pg_partman including time-based and serial partitioning.
pg_setup_pgcronComplete guide for setting up job scheduling with pg_cron including cron syntax, common patterns, and monitoring.
pg_setup_pgcryptoComplete guide for setting up cryptographic functions with pgcrypto including hashing, encryption, and secure password storage.
pg_setup_pgvectorComplete guide for setting up semantic search with pgvector including table design, indexing, and queries.
pg_setup_postgisComplete guide for setting up geospatial operations with PostGIS including spatial types, indexing, and queries.
pg_show_settingsShow current PostgreSQL configuration settings. Filter by name pattern or exact setting name. Accepts: pattern, setting, or name parameter.
pg_spatial_indexCreate a GiST spatial index for geometry column. Uses IF NOT EXISTS to avoid errors on duplicate names.
pg_stat_activityGet currently running queries and connections.
pg_stat_statementsGet query statistics from pg_stat_statements (requires extension).
pg_stats_correlationCalculate Pearson correlation coefficient between two numeric columns. Use groupBy to get correlation per category.
pg_stats_descriptiveCalculate 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_distinctGet distinct values from a column with count. Useful for understanding cardinality and unique value distribution.
pg_stats_distributionAnalyze data distribution with histogram buckets, skewness, and kurtosis. Use groupBy to get distribution per category.
pg_stats_frequencyGet value frequency distribution (count per unique value) ordered by frequency descending. Shows the most common values first.
pg_stats_hypothesisPerform 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_leadAccess data from previous (LAG) or next (LEAD) rows in an ordered set. Useful for comparisons, deltas, and change detection.
pg_stats_moving_avgCalculate moving average (AVG OVER sliding window) for a numeric column. Specify windowSize for the number of preceding rows to include.
pg_stats_ntileDivide ordered rows into N equal buckets (e.g., quartiles with buckets=4). Returns bucket assignment per row.
pg_stats_outliersDetect statistical outliers in a numeric column using IQR (interquartile range) or Z-score method. IQR is robust against non-normal distributions.
pg_stats_percentilesCalculate percentiles (quartiles, custom percentiles) for a numeric column. Use groupBy to get percentiles per category.
pg_stats_rankAssign 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_regressionPerform linear regression analysis (y = mx + b) between two columns. Use groupBy to get regression per category.
pg_stats_row_numberAssign sequential row numbers within an ordered result set. Use partitionBy to restart numbering per group.
pg_stats_running_totalCalculate cumulative running total (SUM OVER) for a numeric column. Use partitionBy to reset total per group.
pg_stats_samplingGet a random sample of rows. Use sampleSize for exact row count (any method), or percentage for approximate sampling with bernoulli/system methods.
pg_stats_summaryGet summary statistics (count, avg, min, max, stddev) for multiple numeric columns. Defaults to all numeric columns if none specified.
pg_stats_time_seriesAggregate data into time buckets for time series analysis. Use groupBy to get separate time series per category.
pg_stats_top_nGet 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_healthAnalyze current system health and resource usage including CPU, memory, and I/O patterns.
pg_table_sizesGet sizes of all tables with indexes and total.
pg_table_statsGet table access statistics.
pg_terminate_backendTerminate a database connection (forceful, use with caution).
pg_text_headlineGenerate highlighted snippets from full-text search matches. Use select param for stable row identification (e.g., primary key).
pg_text_normalizeRemove 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_rankGet relevance ranking for full-text search results. Returns matching rows only with rank score.
pg_text_searchFull-text search using tsvector and tsquery.
pg_text_search_configList available full-text search configurations (e.g., english, german, simple).
pg_text_sentimentPerform basic sentiment analysis on text using keyword matching.
pg_text_to_queryConvert text to tsquery for full-text search. Modes: plain (default), phrase (proximity matching), websearch (Google-like syntax with AND/OR/-).
pg_text_to_vectorConvert text to tsvector representation for full-text search operations.
pg_tool_indexGet a compact index of all available PostgreSQL tools for discovery.
pg_topological_sortGet tables in safe DDL execution order. 'create' direction: dependencies first (for CREATE TABLE). 'drop' direction: dependents first (for DROP TABLE).
pg_transaction_beginBegin a new transaction. Returns a transaction ID for subsequent operations.
pg_transaction_commitCommit a transaction, making all changes permanent.
pg_transaction_executeExecute multiple statements atomically in a single transaction.
pg_transaction_releaseRelease a savepoint, keeping all changes since it was created.
pg_transaction_rollbackRollback a transaction, undoing all changes.
pg_transaction_rollback_toRollback to a savepoint, undoing changes made after it.
pg_transaction_savepointCreate a savepoint within a transaction for partial rollback.
pg_transaction_statusCheck the status of an active transaction without modifying it. Returns whether the transaction is active, aborted (needs rollback), or not found.
pg_trigram_similarityFind 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_truncateTruncate a table, removing all rows quickly. Use cascade to truncate dependent tables.
pg_unused_indexesFind indexes that have never been used (idx_scan = 0). Candidates for removal.
pg_upsertInsert 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_uptimeGet server uptime and startup time.
pg_user_rolesList all roles assigned to a user/role, including admin option and SET option (PG 16+).
pg_vacuumRun VACUUM to reclaim storage and update visibility map. Use analyze: true to also update statistics. Verbose output goes to PostgreSQL server logs.
pg_vacuum_analyzeRun VACUUM and ANALYZE together for optimal performance. Verbose output goes to PostgreSQL server logs.
pg_vacuum_statsGet detailed vacuum statistics including dead tuples, last vacuum times, and wraparound risk.
pg_vector_add_columnAdd a vector column to a table. Requires: table, column, dimensions.
pg_vector_aggregateCalculate average vector. Requires: table, column. Optional: groupBy, where.
pg_vector_batch_insertEfficiently 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_clusterPerform 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_extensionEnable the pgvector extension for vector similarity search.
pg_vector_create_indexCreate vector index. Requires: table, column, type (ivfflat or hnsw).
pg_vector_dimension_reduceReduce vector dimensions using random projection. Supports direct vector input OR table-based extraction.
pg_vector_distanceCalculate distance between two vectors. Valid metrics: l2 (default), cosine, inner_product.
pg_vector_embedGenerate text embeddings. Returns a simple hash-based embedding for demos (use external APIs for production).
pg_vector_index_optimizeAnalyze vector column and recommend optimal index parameters for IVFFlat/HNSW.
pg_vector_insertInsert 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_normalizeNormalize a vector to unit length.
pg_vector_performanceAnalyze vector search performance and index effectiveness. Provide testVector for benchmarking (recommended).
pg_vector_searchSearch for similar vectors. Requires: table, column, vector. Use select param to include identifying columns (e.g., select: ["id", "name"]).
pg_vector_validateValidate vector dimensions against column. Pass any combination of: vector (to check), table+column (for column dimensions), dimensions (expected).
pg_write_queryExecute 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
- Repository
- github.com/neverinfamous/postgres-mcp
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
More from neverinfamous
- 0.603score
MySQL MCP
neverinfamous
Enterprise-grade MySQL MCP Server with OAuth 2.0, 106 tools, and Docker deployment
ConnectorBFreshness: BLocal★ 11Claude Code +5 - 0.585score
PostgreSQL MCP Server
neverinfamous
PostgreSQL MCP server with 203 tools, connection pooling, HTTP/SSE, OAuth 2.1, and tool filtering
ConnectorBFreshness: BLocal★ 12↓ 37/wkClaude Code +5 - 0.562score
Memory Journal MCP
neverinfamous
Developer journal with knowledge graphs, relationships, Git context, and semantic search
ConnectorCFreshness: CLocal★ 20Claude Code +5 - 0.561score
db-mcp (SQLite MCP Server)
neverinfamous
SQLite MCP server with OAuth 2.1, HTTP/SSE, 122 tools, and smart tool filtering
ConnectorCFreshness: CLocal★ 13Claude Code +5 - 0.375score
SQLite MCP Server
neverinfamous
SQLite MCP server with 73 tools for JSONB, full-text search, geospatial, and analytics.
ConnectorFFreshness: FLocalClaude Code +5
Cite this page
PostgreSQL MCP Server. Agent Mart. https://agentmart.dev/connectors/neverinfamous-postgres-mcp-server (last updated 2026-10-24)