Skip to content

Commit 327aca4

Browse files
author
Temp
committed
feat: Add PostgreSQL adapter with tools for pg_cron job scheduling and management.
1 parent c5ea4da commit 327aca4

7 files changed

Lines changed: 463 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525
- `pg_extension_setup` — Extension installation guides
2626
- `pg_setup_pgvector` — Complete pgvector setup for semantic search
2727
- `pg_setup_postgis` — Complete PostGIS setup for geospatial operations
28+
- **8 pg_cron tools** — Job scheduling extension support
29+
- `pg_cron_create_extension` — Enable pg_cron
30+
- `pg_cron_schedule` — Schedule cron jobs
31+
- `pg_cron_schedule_in_database` — Cross-database scheduling
32+
- `pg_cron_unschedule` — Remove jobs
33+
- `pg_cron_alter_job` — Modify existing jobs
34+
- `pg_cron_list_jobs` — List scheduled jobs
35+
- `pg_cron_job_run_details` — View execution history
36+
- `pg_cron_cleanup_history` — Clean old history records
37+
- New `cron` tool-filtering group for pg_cron tools
2838

2939
### Changed
3040
- Restructured resources into modular files for maintainability
3141
- Resource count from 6 to 14
3242
- Prompt count from 7 to 13
3343
- Restructured prompts into modular files for maintainability
44+
- Tool count from 146 to 154 (added pg_cron tools)
3445

3546
### Planned
3647
- Verify prompts and resources from old Python server are ported

README.md

Lines changed: 11 additions & 8 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 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, pgvector, PostGIS, and advanced PostgreSQL features - TypeScript Edition*
88

9-
> **✅ Initial Implementation Complete** - 146 tools, 14 resources, and 13 prompts. Thorough testing before release in progress.
9+
> **✅ Initial Implementation Complete** - 154 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 **146 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 **154 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 **146 tools** across 13 categories:
105+
This server provides **154 tools** across 14 categories:
106106

107107
| Category | Tools | Description |
108108
|----------|-------|-------------|
@@ -119,13 +119,14 @@ This server provides **146 tools** across 13 categories:
119119
| Vector | 14 | pgvector extension - similarity search, clustering, hybrid search |
120120
| PostGIS | 12 | Geospatial operations - distance, transform, clustering, index optimization |
121121
| Partitioning | 6 | Range/list/hash partitioning management |
122+
| Cron | 8 | pg_cron extension - job scheduling, monitoring, cleanup |
122123

123124
---
124125

125126
## 🎛️ Tool Filtering
126127

127128
> [!IMPORTANT]
128-
> **AI-enabled IDEs like Cursor have tool limits.** With 146 tools, you should use tool filtering to stay within limits.
129+
> **AI-enabled IDEs like Cursor have tool limits.** With 154 tools, you should use tool filtering to stay within limits.
129130
130131
### Tool Groups
131132

@@ -144,6 +145,7 @@ This server provides **146 tools** across 13 categories:
144145
| `vector` | 14 | pgvector extension |
145146
| `postgis` | 12 | PostGIS extension |
146147
| `partitioning` | 6 | Partition management |
148+
| `cron` | 8 | pg_cron job scheduling |
147149

148150
### Filter Presets
149151

@@ -159,7 +161,7 @@ This server provides **146 tools** across 13 categories:
159161

160162
**DBA (~75 tools):**
161163
```json
162-
"--tool-filter", "-vector,-postgis"
164+
"--tool-filter", "-vector,-postgis,-cron"
163165
```
164166

165167
### Custom Filtering Syntax
@@ -226,6 +228,7 @@ This server provides **14 resources** for structured data access:
226228
| `hypopg` | Hypothetical indexes | `pg_index_recommendations` |
227229
| `pgvector` | Vector similarity search | 14 vector tools |
228230
| `PostGIS` | Geospatial operations | 12 postgis tools |
231+
| `pg_cron` | Job scheduling | 8 cron tools |
229232

230233
> Extension tools gracefully handle cases where extensions are not installed.
231234
@@ -252,9 +255,9 @@ This server provides **14 resources** for structured data access:
252255
## 🏆 Why Choose postgres-mcp?
253256

254257
**TypeScript Native** - Full type safety with strict mode
255-
**146 Specialized Tools** - Comprehensive PostgreSQL coverage
258+
**154 Specialized Tools** - Comprehensive PostgreSQL coverage
256259
**Connection Pooling** - Efficient PostgreSQL connection management
257-
**Extension Support** - pgvector, PostGIS, pg_stat_statements
260+
**Extension Support** - pgvector, PostGIS, pg_stat_statements, pg_cron
258261
**Tool Filtering** - Stay within AI IDE tool limits
259262
**Modern Architecture** - Built on MCP SDK
260263

src/adapters/postgresql/PostgresAdapter.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import { getVectorTools } from './tools/vector.js';
3939
import { getPostgisTools } from './tools/postgis.js';
4040
import { getPartitioningTools } from './tools/partitioning.js';
4141
import { getStatsTools } from './tools/stats.js';
42+
import { getCronTools } from './tools/cron.js';
4243
import { getPostgresResources } from './resources/index.js';
4344
import { getPostgresPrompts } from './prompts/index.js';
4445

@@ -535,7 +536,8 @@ export class PostgresAdapter extends DatabaseAdapter {
535536
'vector',
536537
'postgis',
537538
'partitioning',
538-
'stats'
539+
'stats',
540+
'cron'
539541
];
540542
}
541543

@@ -557,7 +559,8 @@ export class PostgresAdapter extends DatabaseAdapter {
557559
...getVectorTools(this),
558560
...getPostgisTools(this),
559561
...getPartitioningTools(this),
560-
...getStatsTools(this)
562+
...getStatsTools(this),
563+
...getCronTools(this)
561564
];
562565
}
563566

0 commit comments

Comments
 (0)