get_server_infoLABSCO SUMMARY
Capability gates, not a single read-only switch.
Writes, schema changes, shell operations and LISTEN/NOTIFY are four separate doors, each needing both an access mode and its own environment flag. That granularity is what lets you hand an agent the tuning advisors and the catalog without also handing it run_ddl. The operational plumbing is unusually complete for a database server — OIDC with a role claim mapped to a Postgres role, read-replica round-robin for read-only queries, an IP allowlist applied before auth, and one OpenTelemetry span per call that records the tool name and argument count but never argument values.
What it is
A production-oriented Postgres server. Every user-supplied statement parses through a validated AST allowlist before it executes, identifier interpolation is regex-constrained, and each tool publishes MCP annotations derived from its capability gate so a client knows what is safe to auto-approve.
What you get
- Catalog introspection:
list_schemas,list_tables,describe_table,list_indexes,list_constraints,list_foreign_keys,list_views,list_functions,list_triggers,list_partitions,list_policies,list_extensionsand more, plusget_compact_schemawhen context is tight - Query and cursors:
run_select,run_select_tuned,run_select_parallel,open_cursor/fetch_cursor/close_cursor,explain_query,analyze_query_planandtranslate_nl_to_sql - Health and advisors:
check_database_health,analyze_table_bloat,audit_database,analyze_workload,detect_n_plus_one,recommend_indexes,recommend_index_drops,find_unused_objects,find_sensitive_columns,lint_naming_conventions - Structure work:
compare_schemas,generate_schema_diagram,generate_fk_cascade_graph,generate_schema_docs - Self-description:
get_server_info,describe_self,describe_tool,get_metrics_exposition, pluslist_session_intentsandenable_session_intentfor dynamic toolsets - 256 tools in the generated index, grouped by feature area and labelled with the gate each one needs
Requirements
The PyPI package mcpg, version 0.8.0, over uvx and stdio, or pip install mcpg. Postgres 14 to 19. Read tools work in every access mode; run_write and friends need restricted or higher; DDL, shell and LISTEN each need unrestricted mode plus their own opt-in — MCPG_ALLOW_DDL, MCPG_ALLOW_SHELL, MCPG_ALLOW_LISTEN. The HTTP transport adds its own layer: MCPG_HTTP_AUTH_TOKEN for a static bearer token, or MCPG_AUTH_MODE=oidc with issuer and audience, plus an IP allowlist, TLS and per-request role mapping.
Setup effort
One command plus credentials — uvx mcpg, then supply credentials
USE CASES
Understanding a database you did not design
Walk schemas, tables, constraints and foreign keys, or pull the compact schema when context is tight.
Chasing a slow query
Read the plan, analyse it, and get index recommendations backed by the workload rather than a guess.
Doing a health pass before a release
Check health, bloat and unused objects, and run the advisors in one conversation.
Letting an analyst ask in English
Translate the question to SQL and read it back before anything runs — generation is a read-mode capability.
256 tools
Listed in project docs. Your client may show a different list.
describe_selfdescribe_toolget_metrics_expositionlist_session_intentsenable_session_intentlist_schemaslist_tablesdescribe_tablelist_indexeslist_constraintslist_foreign_keyslist_viewslist_functionslist_triggerslist_partitionslist_roleslist_grantslist_policieslist_sequenceslist_enumslist_domainslist_composite_typeslist_foreign_data_wrapperslist_foreign_serverslist_foreign_tableslist_user_mappingslist_publicationslist_subscriptionslist_extensionslist_available_extensionslist_generated_columnsget_compact_schemagenerate_schema_diagramgenerate_fk_cascade_graphgenerate_schema_docscompare_schemasrun_selectrun_select_tunedrun_select_parallelopen_cursorfetch_cursorclose_cursorlist_cursorsexplain_queryanalyze_query_plantranslate_nl_to_sqlrun_analytical_querycheck_database_healthanalyze_table_bloatlist_databasesaudit_databaseanalyze_workloaddetect_n_plus_oneread_autovacuum_priorityrecommend_indexesrecommend_index_dropsrun_advisorsfind_unused_objectsfind_sensitive_columnslint_naming_conventionstest_rls_for_roleanalyze_session_costrecommend_headline_toolsaudit_sequencesaudit_settingsrecommend_postgres_confoptimize_querysummarize_tablewhy_is_this_slowfuzzy_searchfull_text_searchvector_searchvector_range_searchmmr_searchhybrid_searchgeo_searchseed_table_with_sample_datagenerate_test_datagenerate_test_row_forlist_locksfind_blocking_chainswalk_blocking_chainsread_pg_stat_lockanalyze_lock_hotspotsread_pg_stat_ioread_pg_buffercache_summaryread_pg_buffercache_relationsread_pg_wal_recordsread_pg_wal_statsget_wal_archive_statusget_aio_statusrecommend_io_methodwait_for_lsncheck_pitr_readinessread_pg_stat_recoveryget_wait_for_lsn_statusget_current_wal_lsnrecommend_read_your_writesimport_vectorstune_vector_indexvector_recall_at_kmigrate_vector_to_halfvecanalyze_hnsw_recallrecommend_hnsw_ef_searchrecommend_ivfflat_probesanalyze_distance_metriccross_table_similarityretrieve_with_contextcluster_vectorsdetect_vector_outliersmonitor_embedding_driftrecommend_vector_quantizationanalyze_vector_search_efficiencyanalyze_reranker_liftanalyze_topk_stabilityanalyze_rerank_score_distributionanalyze_rerank_ndcgrecommend_rerank_strategyrecommend_efficiency_thresholdslog_rerank_eventrecord_efficiency_observationsetup_rag_telemetrysetup_efficiency_observationslist_turboquant_indexesget_turboquant_index_metadataget_turboquant_heap_statsget_turboquant_last_scan_statsrecommend_turboquant_maintenanceturboquant_approx_candidatesturboquant_rerank_candidatesrecommend_turboquant_query_knobsmaintain_turboquant_indexcreate_turboquant_indexreindex_turboquant_indexlist_pg_search_indexesget_pg_search_index_metadatarecommend_pg_search_maintenancepg_search_runpg_search_more_like_thispg_search_parse_queryhybrid_bm25_vector_searchcreate_pg_search_indexreindex_pg_search_indexcreate_graphdrop_graphlist_graphsdescribe_graphrun_cyphergenerate_graph_diagramgenerate_graph_projectionget_pgq_statuslist_property_graphsdescribe_property_graphrun_pgqcreate_property_graphdrop_property_graphlist_redis_foreign_serversdescribe_redis_cache_tableget_redis_cache_statsrecommend_redis_cache_targetsenable_redis_fdwcreate_redis_cache_servercreate_redis_user_mappingcreate_redis_cache_tablelist_active_queriesverify_connection_encryptionmonitor_index_buildlist_replicaslist_cron_jobsprune_audit_eventslist_audit_eventsverify_audit_chainexport_queryexport_tableimport_csvimport_jsondump_databaserestore_databasecopy_table_between_databasessubscribe_channelpoll_notificationsunsubscribe_channellist_notification_subscriptionslist_pending_migrationsprepare_migrationvalidate_migrationvalidate_migration_schemacomplete_migrationcancel_migrationlist_unapplied_migration_scriptsread_migration_historygenerate_prisma_schemagenerate_drizzle_schemagenerate_diesel_schemagenerate_jooq_configgenerate_ent_schemasgenerate_ecto_schemasgenerate_sqlalchemy_modelsgenerate_sqlc_schemalist_hypertableslist_chunkscreate_hypertableadd_compression_policyadd_retention_policypartman_create_parentpartman_run_maintenancepartman_drop_partitionget_prewarm_extension_statuslist_prewarmed_relationsrecommend_prewarm_targetslist_autowarm_jobsprewarm_relationprewarm_recommendedschedule_autowarmunschedule_autowarmrepack_tableget_repack_statusschedule_cron_jobunschedule_cron_jobschedule_logical_backupget_data_checksums_statusget_logical_replication_statusenable_data_checksumsdisable_data_checksumsenable_logical_replication_on_demandvalidate_check_constraintget_pg19_ddl_statusget_role_ddlget_database_ddlget_tablespace_ddlget_skip_scan_statusrecommend_skip_scan_indexesget_pg19_partitions_statusmerge_partitionssplit_partitionget_pg19_stats_statusget_warehousepg_statuslist_distribution_policiescheck_segment_healthdescribe_ao_tablelist_resource_groupsanalyze_mpp_query_planrecommend_redistributecreate_publicationdrop_publicationcreate_subscriptiondrop_subscriptionrun_writerun_maintenanceclear_cachecancel_queryterminate_backendrun_ddlenable_extensiondry_run_ddlBEFORE YOU INSTALL
What to know first
Tools you get
256 tools named in the project's documentation.
Requires
- uvx on PATH
- MCPG_DATABASE_URL in your environment
Where it runs
Both documented clients run the server on your machine.
INSTALLATION
Connect your client
Server setup
uvx mcpgMCP Clients
Claude Code
claude mcp add mcpg --env MCPG_DATABASE_URL=postgresql://<YOUR_DB_USER>:<YOUR_DB_PASSWORD>@localhost:5432/<YOUR_DB_NAME> -- uvx mcpgOnly MCPG_DATABASE_URL is required. A vendor key such as ANTHROPIC_API_KEY or OPENAI_API_KEY is needed only for translate_nl_to_sql, and MCPG_HTTP_AUTH_TOKEN only when you run the HTTP transport; everything else has a safe default.
Zed
{
"context_servers": {
"mcpg": {
"command": {
"path": "uvx",
"args": [
"mcpg"
],
"env": {
"MCPG_DATABASE_URL": "postgresql://<YOUR_DB_USER>:<YOUR_DB_PASSWORD>@localhost:5432/<YOUR_DB_NAME>"
}
}
}
}
}Only MCPG_DATABASE_URL is required. A vendor key such as ANTHROPIC_API_KEY or OPENAI_API_KEY is needed only for translate_nl_to_sql, and MCPG_HTTP_AUTH_TOKEN only when you run the HTTP transport; everything else has a safe default.