PostgreSQL MCP Server
PostgreSQL MCP server with 203 tools, connection pooling, HTTP/SSE, OAuth 2.1, and tool filtering
12 stars65 downloads/wk
Reviews
Write oneNobody has reviewed PostgreSQL MCP Server yet.
If you have run it, two minutes of your experience saves the next person an afternoon.
PostgreSQL MCP Server tools (100, 26 write)
write = sends, deletes, buys or postsRead from the package source without running it. The installed server may list more.
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_analyzewrite actionUpdate 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_backup_physicalGenerate pg_basebackup command for physical (binary) backup.
pg_backup_schedule_optimizeAnalyze database activity patterns and recommend optimal backup schedule.
pg_batch_insertwrite actionInsert multiple rows in a single statement. More efficient than individual inserts. Rows array must not be empty.
pg_cancel_backendwrite actionCancel 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_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_extensionwrite actionEnable 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_statsGet connection statistics by database and state.
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_planwrite actionGenerate a backup strategy recommendation with cron schedule.
pg_create_indexwrite actionCreate an index on a table. Supports btree, hash, gin, gist, brin index types.
pg_create_tablewrite actionCreate a new table with specified columns and constraints. Supports composite primary keys and table-level constraints.
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_historywrite actionDelete 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_extensionwrite actionEnable the pg_cron extension for job scheduling. Requires superuser privileges.
pg_cron_job_run_detailswrite actionView execution history for cron jobs. Shows start/end times, status, and return messages. Useful for monitoring and debugging scheduled jobs.
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_unschedulewrite actionRemove 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_describe_tableGet detailed table structure including columns, types, and constraints. For tables/views only, not sequences.
pg_drop_indexwrite actionDrop an index from a table. Supports IF EXISTS, CASCADE, and CONCURRENTLY options.
pg_drop_tablewrite actionDrop a table from the database.
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_execute_codewrite actionExecute 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.te
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_get_indexesList indexes with usage statistics. When table is omitted, lists ALL database indexes (can be large). Use schema/limit to filter.
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_deletewrite actionDelete 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_insertwrite actionInsert value into JSONB array. Index -1 inserts BEFORE last element; use insertAfter:true with -1 to append at end.
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 object: {name: "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_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_nullswrite actionRemove 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_extensionwrite actionEnable 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_list_extensionsList installed PostgreSQL extensions with versions.
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_tablesList all tables, views, and materialized views with metadata. Use limit to restrict results.
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_extensionwrite actionEnable the ltree extension for hierarchical tree-structured labels.
pg_ltree_create_indexwrite actionCreate 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_object_detailsGet detailed metadata for a specific database object (table, view, function, sequence, index).
pg_read_querywrite actionExecute 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_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_resource_usage_analyzeAnalyze current resource usage including CPU, memory, and I/O patterns.
pg_restore_commandGenerate pg_restore command for restoring backups.
pg_restore_validateGenerate commands to validate backup integrity and restorability.
pg_server_versionGet PostgreSQL server version information.
pg_set_configSet a configuration parameter for the current session.
pg_show_settingsShow current PostgreSQL configuration settings. Filter by name pattern or exact setting name. Accepts: pattern, setting, or name parameter.
pg_table_sizesGet sizes of all tables with indexes and total.
pg_terminate_backendTerminate a database connection (forceful, use with caution).
pg_truncatewrite actionTruncate a table, removing all rows quickly. Use cascade to truncate dependent tables.
pg_upsertwrite actionInsert 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_vacuumwrite actionRun VACUUM to reclaim storage and update visibility map. Use analyze: true to also update statistics. Verbose output goes to PostgreSQL server logs.
pg_vacuum_analyzewrite actionRun VACUUM and ANALYZE together for optimal performance. Verbose output goes to PostgreSQL server logs.
pg_write_querywrite actionExecute a write SQL query (INSERT, UPDATE, DELETE). Returns affected row count. Pass transactionId to execute within a transaction.
Public scan report
scanner v0.1.10 · 2026-10-01 · same rubric, same numbers if you re-run it
- Code scan279 source files scanned20/25
- –Live reliabilityno gateway calls yet and no remote to proben/a
- –Tool poisoningtools not inspected (local package is not executed); not countedn/a
- Auth qualitylocal package, no credentials required12/15
- Maintenancelast push 3 days ago15/15
- Maintainer identityregistry namespace matches repository owner; GitHub account older than a year8/10
Findings (1)
- mediumeval / new Function used
exec.evaldist/codemode/types.js: …his access /\beval\s*\(/, // No eval() /\bFunction\s*\(/, // No Funct…
Install PostgreSQL MCP Server in Claude Code, Cursor or VS Code
Runs npx -y @neverinfamous/postgres-mcp on your machine. Read the scan report first; the gateway never runs local packages.
claude mcp add postgres-mcp -- npx -y @neverinfamous/postgres-mcp
What the publisher says
From the PostgreSQL MCP Server repository's README, as published. We do not edit it. Read it on GitHub
postgres-mcp
<!-- mcp-name: io.github.neverinfamous/postgres-mcp -->
PostgreSQL MCP Server binding the Model Context Protocol to a secure PostgreSQL sandbox.
Features Code Mode — a revolutionary approach that provides access to all 278 tools through a secure, true V8 isolate (workerthreads), eliminating the massive token overhead of multi-step tool calls. Also includes schema introspection, migration tracking, smart tool filtering, deterministic error handling, connection pooling, HTTP/SSE Transport, OAuth 2.1 authentication, and extension support for citext, ltree, pgcrypto, pgcron, pgstatkcache, pgvector, PostGIS, and HypoPG.
278 Specialized Tools · 24 Resources · 21 AI-Powered Prompts
Docker Hub • npm Package • MCP Registry • Wiki • Tool Reference • Changelog
🎯 What Sets Us Apart
Shortened. The full README is on GitHub.
Nothing above is checked by us. What we check is on the safety report.
PostgreSQL MCP Server: common questions
- Is PostgreSQL MCP Server safe?
- Yes, by our scan: it is graded A (85/100). Read the PostgreSQL MCP Server safety report
- How do I install PostgreSQL MCP Server?
- It runs on your machine. Copy the Claude Code, Cursor, VS Code or Claude Desktop config from the install section.
- Does PostgreSQL MCP Server need an API key?
- Not as far as the registry entry and our scan can tell: no credentials are declared or required.
- Is PostgreSQL MCP Server maintained?
- The last commit was 15 days ago (2026-09-28). The latest release is v1.0.2.
- What can I use instead of PostgreSQL MCP Server?
- Servers from other publishers that do the same job: PostgreSQL MCP server, PostgreSQL MCP Server and Postgres MCP server. Compare all PostgreSQL MCP Server alternatives.
Alternatives to PostgreSQL MCP Server
Same job from other publishers: the closest match first, then the best rated.
- PostgreSQLMCP server for PostgreSQL: local, Docker, RDS, Neon, Supabase, or behind an SSH bastion.not reviewedEstablishedB
- PostgreSQL MCP ServerPostgreSQL MCP server - query, schema introspection, explain, and health checks for AI assistantsnot reviewedEstablishedB
- PostgresEnterprise PostgreSQL MCP server with NL queries, hybrid search (pgvector+BM25), and web UInot reviewedGrowingA
- PostgreSQL (hardened, read-only)Read-only PostgreSQL over MCP. Writes refused at the parsed SQL, plus a READ ONLY transaction.not reviewedGrowingC
- Read Only Local PostgresMCP server for read-only PostgreSQL database queries in Claude Desktopnot reviewedGrowingA