-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathpostgresql.yaml
More file actions
94 lines (63 loc) · 4.04 KB
/
postgresql.yaml
File metadata and controls
94 lines (63 loc) · 4.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: PostgreSQL
shortDescription: Analyze performance, optimize queries, and tune PostgreSQL databases with health checks
description: '[](https://opensource.org/licenses/MIT)
[](https://pypi.org/project/postgres-mcp/)
[](https://github.com/crystaldba/postgres-mcp/graphs/contributors)
A Model Context Protocol (MCP) server designed for deep SQL performance analysis and optimization. It delivers advanced index tuning, workload-aware query insights, safe execution controls, and schema-aware SQL generation—backed by comprehensive database health diagnostics and EXPLAIN plan simulation.
## Features
- **Database Health Analysis**: Comprehensive health checks including index health, connection utilization, buffer cache analysis, vacuum health, and replication lag monitoring
- **Advanced Index Tuning**: Industrial-strength algorithms that explore thousands of possible indexes using proven optimization techniques
- **Query Performance Optimization**: EXPLAIN plan analysis and hypothetical index simulation for performance validation
- **Schema Intelligence**: Context-aware SQL generation based on detailed database schema understanding
- **Safe SQL Execution**: Configurable access control with read-only mode and SQL parsing for both development and production environments
- **Workload Analysis**: Identify resource-intensive queries and get targeted optimization recommendations
## What you''ll need to connect
**Required:**
- **Database URI**: PostgreSQL connection string (e.g., `postgresql://username:password@localhost:5432/dbname`)
## Example Usage
- "Check the health of my database and identify any issues"
- "What are the slowest queries in my database? And how can I speed them up?"
- "Analyze my database workload and suggest indexes to improve performance"
- "Help me optimize this query: SELECT * FROM orders JOIN customers ON orders.customer_id = customers.id WHERE orders.created_at > ''2023-01-01''"
## Known Issues
Some tools require extensions to be installed in the target postgres instance:
- `get_top_queries` requires the `pg_stat_statements` extension
- `analyze_workload_indexes` and `analyze_query_indexes` require the `hypopg` extension
'
metadata:
categories: Databases
icon: https://avatars.githubusercontent.com/u/177543?s=48&v=4
repoURL: https://github.com/crystaldba/postgres-mcp
env:
- key: DATABASE_URI
name: Database URI
required: true
sensitive: false
description: The connection string for your Postgres database; e.g. "postgresql://username:password@localhost:5432/dbname"
toolPreview:
- name: list_schemas
description: Lists all database schemas available in the PostgreSQL instance
- name: list_objects
description: Lists database objects (tables, views, sequences, extensions) within a specified schema
- name: get_object_details
description: Provides detailed information about a specific database object including columns, constraints, and indexes
- name: execute_sql
description: Executes SQL statements with read-only limitations in restricted mode
- name: explain_query
description: Shows execution plan for SQL queries and can simulate hypothetical indexes
- name: get_top_queries
description: Reports slowest SQL queries based on execution statistics from pg_stat_statements
- name: analyze_workload_indexes
description: Analyzes database workload to identify resource-intensive queries and recommends optimal indexes
- name: analyze_query_indexes
description: Analyzes specific SQL queries (up to 10) and recommends optimal indexes for them
- name: analyze_db_health
description: Performs comprehensive health checks including cache hit rates, connections, indexes, and vacuum status
runtime: containerized
containerizedConfig:
image: ghcr.io/obot-platform/mcp-images/postgresql:0.3.0
port: 8099
path: /
args:
- postgres-mcp
- --access-mode=unrestricted