pg-logical-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| PG_LOGICAL_MCP_DSN | Yes | PostgreSQL connection string (e.g., host=publisher.internal port=5432 user=replmon dbname=appdb). | |
| PG_LOGICAL_MCP_ALLOW_WRITES | No | Set to '1' to enable remediation tools (e.g., advance_slot, drop_slot). Leave unset for read-only. |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| list_replication_slotsA | List replication slots with the WAL each one pins. Deterministic. Wraps pg_replication_slots and joins in the bytes of WAL held per slot (pg_current_wal_lsn() - restart_lsn), wal_status (reserved/extended/unreserved/lost), safe_wal_size, active state and the holding pid. Run this on the PUBLISHER. |
| assess_slot_riskA | Project which slot is closest to invalidation, and how soon. Judgment tool. Samples the current WAL generation rate (reads pg_current_wal_lsn() twice, sample_interval_seconds apart), reads max_slot_wal_keep_size, and projects a rough time-to-invalidation per slot. Pass available_disk_bytes to also get a time-to-disk-fill estimate. Run this on the PUBLISHER. |
| inspect_walsendersA | Inspect active walsender connections and their lag. Deterministic. Reads pg_stat_replication: per-connection state, write/flush/replay lag (both as time intervals and as LSN byte diffs from sent_lsn), and sync_state. Run this on the PUBLISHER. |
| decoding_statsA | Report logical-decoding spill/stream stats per slot. Deterministic. Reads pg_stat_replication_slots for spill_txns / spill_bytes and streaming stats. Large spill_bytes means big transactions are spilling decode work to disk — an obscure but real cause of replication slowness (e.g. outbox batches that decode badly). Run this on the PUBLISHER. |
| list_publicationsA | List publications and the tables each carries. Deterministic. Enumerates pg_publication and pg_publication_tables with per-table column lists, row filters (PG15+), and the published operations (insert/update/delete/truncate). Run this on the PUBLISHER. |
| check_publication_coverageA | Cross-check published tables against an expected set. Judgment tool. Flags the two silent failures that lose data without erroring: (1) an expected table that no publication carries, and (2) a published table whose REPLICA IDENTITY can't support UPDATE/DELETE (REPLICA IDENTITY NOTHING, or DEFAULT with no primary key). Pass expected_tables as "schema.table" strings (bare names assume public). Run this on the PUBLISHER. |
| inspect_subscriptionsA | Inspect subscriptions and their apply-lag signals. Deterministic. Joins pg_subscription with pg_stat_subscription for worker state, received/latest-end LSNs, and apply-lag signals (last_msg_send_time vs last_msg_receipt_time). The connection string (subconninfo) is deliberately omitted — it holds a password. Reading pg_subscription needs elevated privileges. Run this on the SUBSCRIBER. |
| subscription_errorsA | Report apply and tablesync error counts per subscription. Deterministic. Reads pg_stat_subscription_stats (PG15+) for apply_error_count and sync_error_count. A non-zero apply_error_count is the first sign of a wedged subscription. Run this on the SUBSCRIBER. |
| diagnose_stuck_subscriptionA | Explain why apply is wedged and lay out the two real fixes. Judgment tool (the marquee one). Correlates subscription error state with the LSN apply is stuck at, explains the usual cause (a unique/primary-key conflict on the subscriber), and presents the two options: resolve the conflicting row, or skip the offending transaction. Points you at the subscriber server log for the exact conflicting row. Run this on the SUBSCRIBER. |
| peek_changesA | Peek at pending changes in a slot WITHOUT consuming them. Deterministic. Wraps pg_logical_slot_peek_changes — the peek variant,
not get — so inspecting the queue does not advance the slot or consume
the changes. Returns up to |
| advance_slotA | Advance a replication slot to an EXPLICIT LSN (irreversible). Moves the slot's confirmed position forward, discarding all changes
before |
| skip_apply_transactionA | Skip the transaction wedging a subscription at an EXPLICIT LSN. Issues ALTER SUBSCRIPTION ... SKIP (lsn = ...) so the apply worker steps over the offending transaction. That transaction's changes are discarded PERMANENTLY — use only when you've confirmed (from the subscriber log) that the change is genuinely redundant. Pass the exact LSN from diagnose_stuck_subscription; there is no skip-to-head shortcut. Dry-run unless allow_writes=true AND PG_LOGICAL_MCP_ALLOW_WRITES is set. |
| drop_slotA | Drop a replication slot by EXACT name (irreversible). Removes the slot and releases the WAL it pins. Any subscriber relying on it can no longer resume and must be re-created and re-synced. You must pass the exact slot name. Dry-run unless allow_writes=true AND PG_LOGICAL_MCP_ALLOW_WRITES is set. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/esauro/pg-logical-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server