
Postgres Scout Mcp
io.github.bluwork由 GitHub 帳號 bluwork 發布v1.0.3更新於 Oct 24, 2026
Scout your PostgreSQL databases with AI - safety features, monitoring, and data quality
概覽
讓助理透過 38 個工具檢查、診斷並可選擇性地修改 PostgreSQL 資料庫,涵蓋健康度、效能與資料品質。
- 可以做什麼
- Postgres Scout 將助理連接到 PostgreSQL 資料庫,提供 38 個工具,分為探索、查詢、診斷、最佳化、監控、資料品質、關聯、時間序列、匯出與寫入等類別。它可以列出資料庫、結構描述與資料表,描述資料表結構,執行並解釋查詢,給出整體健康分數,偵測異常與資料表膨脹,建議索引與分割,檢查鎖定與即時活動,找出重複資料列、缺失值與孤兒記錄,並將資料表匯出為 CSV、JSON、JSONL 或 SQL。safeUpdate、safeDelete、safeInsert 等寫入工具具備試跑預覽與資料列數上限。
- 適用情境
- 適合助理需要回答 PostgreSQL 資料庫維運問題的情境,例如哪些資料表有膨脹、哪些查詢較慢、資料是否有重複或孤兒資料列。適合希望預設以唯讀方式探索、必要時另開實例進行受控寫入的開發者與 DBA。
- 執行需求
- 透過 stdio 在本機執行,通常使用 npx postgres-scout-mcp 並附上 PostgreSQL 連線字串作為參數。需要 Node.js 以及連線資料庫的網路。選用環境變數可設定查詢逾時、結果資料列上限、速率限制、連線池大小與記錄。部分診斷功能(例如 getSlowQueries)需要 pg_stat_statements 擴充功能。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Postgres Scout Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Postgres Scout MCP
Scout your PostgreSQL databases with AI - A production-ready Model Context Protocol server with built-in safety features, monitoring, and data quality tools.
What You Get
You ask:
"How healthy is my production database? Any urgent issues?"
Postgres Scout returns:
Overall Health Score: 78/100
Component Breakdown
Issues Found
- HIGH — Table
ordershas 34% bloat (2.1 GB wasted). VACUUM FULL recommended. - MEDIUM — 3 unused indexes on
sessionsconsuming 890 MB. - LOW — Cache hit ratio for
analytics_eventsis 71% (target: >90%).
Recommendations
- Run
VACUUM FULL ordersduring maintenance window - Drop unused indexes:
idx_sessions_legacy,idx_sessions_old_token,idx_sessions_temp - Consider adding
analytics_eventsto shared_buffers or partitioning by date
That's getHealthScore — one of 38 tools covering exploration, diagnostics, optimization, monitoring, data quality, and safe writes.
Quick Start
Claude Code
Then ask: "Show me the largest tables and whether they have any bloat issues."
Claude Desktop
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
Cursor / VS Code
Add to your MCP settings:
Read-Only vs Read-Write
The server runs in read-only mode by default. For write operations, run a separate instance:
- postgres-scout-readonly: Safe exploration, no risk of data modification
- postgres-scout-readwrite: Write operations when explicitly needed
Tools
Explore — understand your database
listDatabases— databases the user has access togetDatabaseStats— size, cache hit ratio, connection infolistSchemas— all schemas in the current databaselistTables— tables with size and row statisticsdescribeTable— columns, constraints, indexes, and more
Query — run and analyze
executeQuery— run SELECT queries (or writes in read-write mode)explainQuery— EXPLAIN plans for performance analysisoptimizeQuery— optimization recommendations for a specific query
Diagnose — find problems before they find you
getHealthScore— overall health score with component breakdowndetectAnomalies— anomalies in performance, connections, and dataanalyzeTableBloat— bloat analysis for VACUUM planninggetSlowQueries— slow query analysis (requires pg_stat_statements)suggestVacuum— VACUUM recommendations based on dead tuples and bloat
Optimize — make it faster
suggestIndexes— missing index recommendations from query patternssuggestPartitioning— partitioning strategies for large tablesgetIndexUsage— identify unused or underused indexes
Monitor — watch it live
getCurrentActivity— active queries and connectionsanalyzeLocks— lock contention and blocking queriesgetLiveMetrics— real-time metrics over a time windowgetHottestTables— tables with highest activitygetTableMetrics— comprehensive per-table I/O and scan stats
Data Quality — trust your data
findDuplicates— duplicate rows by column combinationfindMissingValues— NULL analysis across columnsfindOrphans— orphaned records with invalid foreign keyscheckConstraintViolations— test constraints before adding themanalyzeTypeConsistency— type inconsistencies in text columns
Relationships — follow the connections
exploreRelationships— multi-hop foreign key traversalanalyzeForeignKeys— foreign key health and performance
Time Series — temporal analysis
findRecent— rows within a time windowanalyzeTimeSeries— window functions and anomaly detectiondetectSeasonality— seasonal pattern detection
Export — get data out
exportTable— CSV, JSON, JSONL, or SQLgenerateInsertStatements— INSERT statements for migration
Write (read-write only) — safe modifications
previewUpdate/previewDelete— see what would change before committingsafeUpdate— UPDATE with dry-run, row limits, empty WHERE protectionsafeDelete— DELETE with dry-run, row limits, empty WHERE protectionsafeInsert— INSERT with validation, batching, ON CONFLICT support
Security
- Read-only by default — write operations must be explicitly enabled
- All queries use parameterized values
- SQL injection prevention with input validation and pattern detection
- Identifier sanitization for table/column names
- Rate limiting on all operations
- Query timeouts to prevent long-running queries
- Response size limits to prevent memory exhaustion
Examples
"What are the largest tables and do they have bloat?"
"Find duplicate emails in the users table."
"Which queries are slowest and how can I speed them up?"
"Show me what's happening on the database right now."
"Find orphaned orders that reference deleted customers."
Configuration
CLI flags: --read-only (default), --read-write, --mode <mode>
Logging
File logging is disabled by default. Set ENABLE_LOGGING=true to enable. Two log files are created in LOG_DIR:
- tool-usage.log — every tool call with timestamp, name, and arguments
- error.log — errors with stack traces
Connection strings are automatically redacted in all output.
Development
License
Apache-2.0
來源:README.md,提交 3cb6fa3
工具
0版本歷史
1- v1.0.3最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分