Skip to content

Commit 362f93c

Browse files
author
Temp
committed
feat: implement PostgresAdapter with pg_partman and pg_stat_kcache tools, updating documentation and tool filtering.
1 parent 327aca4 commit 362f93c

8 files changed

Lines changed: 1220 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3535
- `pg_cron_job_run_details` — View execution history
3636
- `pg_cron_cleanup_history` — Clean old history records
3737
- New `cron` tool-filtering group for pg_cron tools
38+
- **10 pg_partman tools** — Automated partition lifecycle management
39+
- `pg_partman_create_extension` — Enable pg_partman
40+
- `pg_partman_create_parent` — Create partition set with automatic child creation
41+
- `pg_partman_run_maintenance` — Execute partition maintenance
42+
- `pg_partman_show_partitions` — List managed partitions
43+
- `pg_partman_show_config` — View partition configuration
44+
- `pg_partman_check_default` — Check for data in default partition
45+
- `pg_partman_partition_data` — Move data to child partitions
46+
- `pg_partman_set_retention` — Configure retention policies
47+
- `pg_partman_undo_partition` — Convert back to regular table
48+
- `pg_partman_analyze_partition_health` — Health check with recommendations
49+
- New `partman` tool-filtering group for pg_partman tools
50+
- **7 pg_stat_kcache tools** — OS-level performance visibility
51+
- `pg_kcache_create_extension` — Enable pg_stat_kcache
52+
- `pg_kcache_query_stats` — Query stats with CPU/IO metrics
53+
- `pg_kcache_top_cpu` — Top CPU-consuming queries
54+
- `pg_kcache_top_io` — Top I/O-consuming queries
55+
- `pg_kcache_database_stats` — Database-level aggregated stats
56+
- `pg_kcache_resource_analysis` — CPU-bound vs I/O-bound classification
57+
- `pg_kcache_reset` — Reset statistics
58+
- New `kcache` tool-filtering group for pg_stat_kcache tools
3859

3960
### Changed
4061
- Restructured resources into modular files for maintainability
4162
- Resource count from 6 to 14
4263
- Prompt count from 7 to 13
4364
- Restructured prompts into modular files for maintainability
44-
- Tool count from 146 to 154 (added pg_cron tools)
65+
- Tool count from 146 to 171 (added pg_cron, pg_partman, and pg_stat_kcache tools)
4566

4667
### Planned
4768
- Verify prompts and resources from old Python server are ported

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44

55
*Last updated December 14, 2025 - Initial Implementation Complete*
66

7-
*Enterprise-grade PostgreSQL MCP Server with OAuth 2.0 authentication, connection pooling, tool filtering, plus support for pg_cron, pgvector, PostGIS, and advanced PostgreSQL features - TypeScript Edition*
7+
*Enterprise-grade PostgreSQL MCP Server with OAuth 2.0 authentication, connection pooling, tool filtering, plus support for pg_cron, pg_stat_kcache, pgvector, PostGIS, and advanced PostgreSQL features - TypeScript Edition*
88

9-
> **✅ Initial Implementation Complete** - 154 tools, 14 resources, and 13 prompts. Thorough testing before release in progress.
9+
> **✅ Initial Implementation Complete** - 171 tools, 14 resources, and 13 prompts. Thorough testing before release in progress.
1010
1111
[![GitHub](https://img.shields.io/badge/GitHub-neverinfamous/postgres--mcp-blue?logo=github)](https://github.com/neverinfamous/postgres-mcp)
1212
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
1313
[![TypeScript](https://img.shields.io/badge/TypeScript-5.9-blue.svg)](https://www.typescriptlang.org/)
1414
[![MCP](https://img.shields.io/badge/MCP-Compatible-green.svg)](https://modelcontextprotocol.io/)
1515
![Status](https://img.shields.io/badge/status-Testing-blue)
1616

17-
A **PostgreSQL MCP Server** that enables AI assistants (Claude, Cursor, etc.) to interact with PostgreSQL databases through the Model Context Protocol. Provides **154 specialized tools**, **14 resources**, and **13 AI-powered prompts**.
17+
A **PostgreSQL MCP Server** that enables AI assistants (Claude, Cursor, etc.) to interact with PostgreSQL databases through the Model Context Protocol. Provides **171 specialized tools**, **14 resources**, and **13 AI-powered prompts**.
1818

1919
---
2020

@@ -102,7 +102,7 @@ node dist/cli.js --transport stdio --postgres postgres://user:password@localhost
102102

103103
## 🛠️ Tool Categories
104104

105-
This server provides **154 tools** across 14 categories:
105+
This server provides **171 tools** across 16 categories:
106106

107107
| Category | Tools | Description |
108108
|----------|-------|-------------|
@@ -120,13 +120,15 @@ This server provides **154 tools** across 14 categories:
120120
| PostGIS | 12 | Geospatial operations - distance, transform, clustering, index optimization |
121121
| Partitioning | 6 | Range/list/hash partitioning management |
122122
| Cron | 8 | pg_cron extension - job scheduling, monitoring, cleanup |
123+
| Partman | 10 | pg_partman extension - automated partition lifecycle management |
124+
| Kcache | 7 | pg_stat_kcache extension - OS-level CPU/memory/I/O stats per query |
123125

124126
---
125127

126128
## 🎛️ Tool Filtering
127129

128130
> [!IMPORTANT]
129-
> **AI-enabled IDEs like Cursor have tool limits.** With 154 tools, you should use tool filtering to stay within limits.
131+
> **AI-enabled IDEs like Cursor have tool limits.** With 171 tools, you should use tool filtering to stay within limits.
130132
131133
### Tool Groups
132134

@@ -146,6 +148,8 @@ This server provides **154 tools** across 14 categories:
146148
| `postgis` | 12 | PostGIS extension |
147149
| `partitioning` | 6 | Partition management |
148150
| `cron` | 8 | pg_cron job scheduling |
151+
| `partman` | 10 | pg_partman partition lifecycle |
152+
| `kcache` | 7 | pg_stat_kcache OS-level stats |
149153

150154
### Filter Presets
151155

@@ -161,7 +165,7 @@ This server provides **154 tools** across 14 categories:
161165

162166
**DBA (~75 tools):**
163167
```json
164-
"--tool-filter", "-vector,-postgis,-cron"
168+
"--tool-filter", "-vector,-postgis,-cron,-partman,-kcache"
165169
```
166170

167171
### Custom Filtering Syntax
@@ -229,6 +233,8 @@ This server provides **14 resources** for structured data access:
229233
| `pgvector` | Vector similarity search | 14 vector tools |
230234
| `PostGIS` | Geospatial operations | 12 postgis tools |
231235
| `pg_cron` | Job scheduling | 8 cron tools |
236+
| `pg_partman` | Automated partition management | 10 partman tools |
237+
| `pg_stat_kcache` | OS-level CPU/memory/I/O stats | 7 kcache tools |
232238

233239
> Extension tools gracefully handle cases where extensions are not installed.
234240

src/adapters/postgresql/PostgresAdapter.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ import { getPostgisTools } from './tools/postgis.js';
4040
import { getPartitioningTools } from './tools/partitioning.js';
4141
import { getStatsTools } from './tools/stats.js';
4242
import { getCronTools } from './tools/cron.js';
43+
import { getPartmanTools } from './tools/partman.js';
44+
import { getKcacheTools } from './tools/kcache.js';
4345
import { getPostgresResources } from './resources/index.js';
4446
import { getPostgresPrompts } from './prompts/index.js';
4547

@@ -537,7 +539,9 @@ export class PostgresAdapter extends DatabaseAdapter {
537539
'postgis',
538540
'partitioning',
539541
'stats',
540-
'cron'
542+
'cron',
543+
'partman',
544+
'kcache'
541545
];
542546
}
543547

@@ -560,7 +564,9 @@ export class PostgresAdapter extends DatabaseAdapter {
560564
...getPostgisTools(this),
561565
...getPartitioningTools(this),
562566
...getStatsTools(this),
563-
...getCronTools(this)
567+
...getCronTools(this),
568+
...getPartmanTools(this),
569+
...getKcacheTools(this)
564570
];
565571
}
566572

0 commit comments

Comments
 (0)