Skip to content

Commit a3dbc9c

Browse files
committed
Clean bill of healhg with strict type checking achieved. Added 10 prompts and 11 resources.
1 parent 8d55e05 commit a3dbc9c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+4282
-790
lines changed

DOCKER_README.md

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# PostgreSQL MCP Server - Enhanced
22

3-
* Last Updated: October 4, 2025 1:22 AM EST *
3+
* Last Updated: October 4, 2025 *
44

55
[![Docker Pulls](https://img.shields.io/docker/pulls/writenotenow/postgres-mcp-enhanced)](https://hub.docker.com/r/writenotenow/postgres-mcp-enhanced)
66
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7-
![Version](https://img.shields.io/badge/version-v1.0.5-green)
7+
![Version](https://img.shields.io/badge/version-v1.1.0-green)
88
[![Security](https://img.shields.io/badge/Security-Enhanced-green.svg)](https://github.com/neverinfamous/postgres-mcp/blob/main/SECURITY.md)
9+
[![Type Safety](https://img.shields.io/badge/Pyright-Strict-blue.svg)](https://github.com/neverinfamous/postgres-mcp)
910
[![GitHub Stars](https://img.shields.io/github/stars/neverinfamous/postgres-mcp?style=social)](https://github.com/neverinfamous/postgres-mcp)
1011

11-
*Enterprise-grade PostgreSQL MCP server with comprehensive security and AI-native operations*
12+
*Enterprise-grade PostgreSQL MCP server with comprehensive security, AI-native operations, and intelligent meta-awareness*
1213

1314
---
1415

@@ -44,13 +45,13 @@ We provide multiple tags for different use cases:
4445
| Tag | Description | Use Case |
4546
|-----|-------------|----------|
4647
| `latest` | Latest stable release | **Recommended for production** |
47-
| `v1.0.5` | Specific version | Pin to exact version |
48+
| `v1.1.0` | Specific version | Pin to exact version |
4849
| `sha-abc1234` | Commit SHA | Development/testing |
4950
| `master-YYYYMMDD-HHMMSS-sha` | Timestamped | Audit trail |
5051

5152
**Pull a specific version:**
5253
```bash
53-
docker pull writenotenow/postgres-mcp-enhanced:v1.0.5
54+
docker pull writenotenow/postgres-mcp-enhanced:v1.1.0
5455
```
5556

5657
---
@@ -97,12 +98,14 @@ services:
9798
9899
---
99100
100-
## 🛡️ Security Features
101+
## 🛡️ Security & Code Quality
101102
102-
This image is built with security as a priority:
103+
This image is built with security and quality as top priorities:
103104
104105
- ✅ **Non-root user** - Runs as user `app` (UID 1000)
105106
- ✅ **Zero critical vulnerabilities** - All dependencies patched
107+
- ✅ **Pyright strict mode** - 2,000+ type issues resolved, 100% type-safe codebase
108+
- ✅ **Zero linter errors** - Clean codebase with comprehensive type checking
106109
- ✅ **Supply chain attestation** - Full SBOM and provenance included
107110
- ✅ **Docker Scout verified** - Continuous security scanning
108111
- ✅ **SQL injection prevention** - All queries use parameter binding
@@ -117,8 +120,9 @@ docker scout cves writenotenow/postgres-mcp-enhanced:latest
117120

118121
## 🏢 What's Included
119122

120-
**63 specialized MCP tools** for comprehensive PostgreSQL operations:
123+
**63 specialized MCP tools** + **10 intelligent resources** + **10 guided prompts** for comprehensive PostgreSQL operations:
121124

125+
### MCP Tools (63)
122126
- **Core Database (9)** - Schema management, SQL execution, health monitoring
123127
- **JSON Operations (11)** - JSONB operations, validation, security scanning
124128
- **Text Processing (5)** - Full-text search, similarity matching
@@ -129,6 +133,20 @@ docker scout cves writenotenow/postgres-mcp-enhanced:latest
129133
- **Backup & Recovery (4)** - Backup planning, restore validation
130134
- **Monitoring & Alerting (5)** - Real-time monitoring, capacity planning
131135

136+
### MCP Resources (10) - NEW in v1.1.0!
137+
Real-time database meta-awareness that AI can access automatically:
138+
- Database schema, capabilities, performance metrics
139+
- Health status, extensions, index statistics
140+
- Connection pool, replication, vacuum status
141+
- Lock information and statistics quality
142+
143+
### MCP Prompts (10) - NEW in v1.1.0!
144+
Guided workflows for complex operations:
145+
- Query optimization, index tuning, health checks
146+
- pgvector and PostGIS setup guides
147+
- JSONB best practices, performance baselines
148+
- Backup strategy and extension setup
149+
132150
---
133151

134152
## 🔌 MCP Client Configuration
@@ -263,6 +281,14 @@ Can't find what you're looking for? Use our AI-powered search to query both Post
263281

264282
## 🆕 Recent Updates
265283

284+
### v1.1.0 (October 4, 2025) 🎉
285+
- ✅ **NEW: MCP Resources (10)** - Real-time database meta-awareness
286+
- ✅ **NEW: MCP Prompts (10)** - Guided workflows for complex operations
287+
- ✅ **Intelligent Assistant** - Transforms from tool collection to database expert
288+
- ✅ **Pyright strict mode** - 2,000+ type issues resolved, 100% type-safe codebase
289+
- ✅ **Zero linter errors** - Clean codebase with comprehensive type checking
290+
- ✅ Zero breaking changes - All existing tools work unchanged
291+
266292
### v1.0.5 (October 3, 2025)
267293
- ✅ Fixed Docker Scout tag format
268294
- ✅ Docker-optimized README for Docker Hub

README.md

Lines changed: 110 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# PostgreSQL MCP Server - Version 1.0.5
1+
# PostgreSQL MCP Server - Version 1.1.0
22

3-
* Last Updated October 3, 2025 7:58 PM EST **
3+
* Last Updated October 4, 2025 **
44

5-
Enterprise-grade PostgreSQL MCP server with enhanced security, comprehensive testing, AI-native database operations, and advanced analytics.
5+
Enterprise-grade PostgreSQL MCP server with enhanced security, comprehensive testing, AI-native database operations, intelligent meta-awareness, and guided workflows.
66

77
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
88
[![Security](https://img.shields.io/badge/Security-Enhanced-green.svg)](SECURITY.md)
@@ -38,7 +38,9 @@ For detailed documentation, examples, and guides, visit our comprehensive wiki:
3838

3939
## 🚀 **Quick Overview**
4040

41-
**63 specialized MCP tools** for PostgreSQL operations:
41+
**63 specialized MCP tools** + **10 intelligent resources** + **10 guided prompts** for PostgreSQL operations:
42+
43+
### MCP Tools (63)
4244
- **Core Database (9)**: Schema management, SQL execution, health monitoring
4345
- **JSON Operations (11)**: JSONB operations, validation, security scanning
4446
- **Text Processing (5)**: Similarity search, full-text search, fuzzy matching
@@ -49,6 +51,31 @@ For detailed documentation, examples, and guides, visit our comprehensive wiki:
4951
- **Backup & Recovery (4)**: Backup planning, restore validation, scheduling
5052
- **Monitoring & Alerting (5)**: Real-time monitoring, capacity planning, alerting
5153

54+
### MCP Resources (10) - Database Meta-Awareness
55+
- **database://schema**: Complete schema with tables, columns, indexes
56+
- **database://capabilities**: Server capabilities and installed extensions
57+
- **database://performance**: Query performance metrics from pg_stat_statements
58+
- **database://health**: Comprehensive health status
59+
- **database://extensions**: Installed extensions with versions
60+
- **database://indexes**: Index usage statistics and recommendations
61+
- **database://connections**: Active connections and pool status
62+
- **database://replication**: Replication status and lag
63+
- **database://vacuum**: Vacuum status and transaction ID wraparound
64+
- **database://locks**: Current lock information
65+
- **database://statistics**: Table statistics quality
66+
67+
### MCP Prompts (10) - Guided Workflows
68+
- **optimize_query**: Step-by-step query optimization
69+
- **index_tuning**: Comprehensive index analysis
70+
- **database_health_check**: Full health assessment
71+
- **setup_pgvector**: Complete pgvector setup guide
72+
- **json_operations**: JSONB best practices
73+
- **performance_baseline**: Establish performance baselines
74+
- **backup_strategy**: Design backup strategy
75+
- **setup_postgis**: PostGIS setup and usage
76+
- **explain_analyze_workflow**: Deep dive into EXPLAIN plans
77+
- **extension_setup**: Extension installation guide
78+
5279
Enhanced with **pg_stat_statements**, **hypopg**, **pgvector**, and **PostGIS** extensions.
5380

5481
---
@@ -101,6 +128,7 @@ uv run pytest -v
101128
- ✅ Dual security modes (restricted/unrestricted)
102129
- ✅ Advanced query validation
103130
- ✅ CodeQL security scanning passing
131+
-**Pyright strict mode** - 2,000+ type issues resolved, 100% type-safe codebase
104132

105133
**Security Modes:**
106134
- **Restricted (Production)**: Read-only, query validation, resource limits
@@ -134,7 +162,9 @@ uv run pytest -v
134162

135163
---
136164

137-
## 📊 **Tool Categories (63 Tools)**
165+
## 📊 **Features Overview**
166+
167+
### MCP Tools (63)
138168

139169
Explore comprehensive documentation for each category:
140170

@@ -150,7 +180,46 @@ Explore comprehensive documentation for each category:
150180
| **Backup & Recovery** | 4 | [Backup Tools →](https://github.com/neverinfamous/postgres-mcp/wiki/Backup-Recovery) |
151181
| **Monitoring & Alerting** | 5 | [Monitoring →](https://github.com/neverinfamous/postgres-mcp/wiki/Monitoring-Alerting) |
152182

153-
**📖 [View All Tools →](https://github.com/neverinfamous/postgres-mcp/wiki/Home)**
183+
### MCP Resources (10) - NEW in v1.1.0! 🎉
184+
185+
Resources provide real-time database meta-awareness - AI can access these automatically without explicit tool calls:
186+
187+
| Resource | Purpose | When to Use |
188+
|----------|---------|-------------|
189+
| **database://schema** | Complete database structure | Understanding database layout before queries |
190+
| **database://capabilities** | Server features and extensions | Checking what operations are available |
191+
| **database://performance** | Query performance metrics | Identifying slow queries proactively |
192+
| **database://health** | Database health status | Proactive monitoring and issue detection |
193+
| **database://extensions** | Extension inventory | Verifying required features are installed |
194+
| **database://indexes** | Index usage statistics | Finding unused or missing indexes |
195+
| **database://connections** | Connection pool status | Monitoring connection utilization |
196+
| **database://replication** | Replication lag and status | Ensuring replica consistency |
197+
| **database://vacuum** | Vacuum and wraparound status | Preventing transaction ID exhaustion |
198+
| **database://locks** | Lock contention information | Diagnosing deadlocks and blocking |
199+
| **database://statistics** | Statistics quality | Ensuring accurate query planning |
200+
201+
**💡 Key Benefit:** Resources reduce token usage by providing cached context vs. repeated queries!
202+
203+
### MCP Prompts (10) - NEW in v1.1.0! 🎉
204+
205+
Prompts provide guided workflows for complex operations - step-by-step instructions with examples:
206+
207+
| Prompt | Purpose | Use Case |
208+
|--------|---------|----------|
209+
| **optimize_query** | Query optimization workflow | Analyzing and improving slow queries |
210+
| **index_tuning** | Index analysis and recommendations | Finding unused/missing/duplicate indexes |
211+
| **database_health_check** | Comprehensive health assessment | Regular maintenance and monitoring |
212+
| **setup_pgvector** | pgvector installation and setup | Implementing semantic search |
213+
| **json_operations** | JSONB best practices | Optimizing JSON queries and indexes |
214+
| **performance_baseline** | Baseline establishment | Setting up performance monitoring |
215+
| **backup_strategy** | Backup planning and design | Designing enterprise backup strategy |
216+
| **setup_postgis** | PostGIS installation and usage | Implementing geospatial features |
217+
| **explain_analyze_workflow** | Deep plan analysis | Understanding query execution |
218+
| **extension_setup** | Extension installation guide | Installing and configuring extensions |
219+
220+
**💡 Key Benefit:** Prompts guide users through complex multi-step operations with PostgreSQL best practices!
221+
222+
**📖 [View Complete Documentation →](https://github.com/neverinfamous/postgres-mcp/wiki/Home)**
154223

155224
---
156225

@@ -176,10 +245,31 @@ CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
176245

177246
## 🆕 **Recent Updates**
178247

248+
### **Version 1.1.0 Release** 🎉 (October 4, 2025)
249+
- **🌟 NEW: MCP Resources (10)**: Real-time database meta-awareness
250+
- Instant access to schema, capabilities, performance, health
251+
- Reduces token usage by providing cached context
252+
- AI can access database state without explicit queries
253+
- **🌟 NEW: MCP Prompts (10)**: Guided workflows for complex operations
254+
- Step-by-step query optimization workflow
255+
- Comprehensive index tuning guide
256+
- Complete database health assessment
257+
- pgvector and PostGIS setup guides
258+
- JSONB best practices and optimization
259+
- **✨ Intelligent Assistant**: Transforms from tool collection to database expert
260+
- Proactive optimization suggestions
261+
- Context-aware recommendations
262+
- PostgreSQL-specific best practices
263+
- **🔒 Code Quality**: Pyright strict mode compliance
264+
- Resolved 2,000+ type issues
265+
- 100% type-safe codebase
266+
- Enhanced reliability and maintainability
267+
- **📦 Zero Breaking Changes**: All existing tools work unchanged
268+
179269
### **Version 1.0.0 Release** 🎉 (October 3, 2025)
180270
- **Production Ready**: Enterprise-grade PostgreSQL MCP server
181271
- **63 Specialized Tools**: Complete feature set across 9 categories
182-
- **Zero Known Vulnerbilities**: Comprehensive security audit passed
272+
- **Zero Known Vulnerabilities**: Comprehensive security audit passed
183273
- **Type Safety**: Pyright strict mode compliance
184274
- **Multi-Platform**: Windows, Linux, macOS (amd64, arm64)
185275

@@ -265,6 +355,7 @@ uv run pytest --cov=src tests/
265355
- ✅ Security: 20/20 passed (100% protection)
266356
- ✅ SQL Injection: All vectors blocked
267357
- ✅ Integration: All operations validated
358+
- ✅ Type Safety: Pyright strict mode (2,000+ issues resolved)
268359
- ✅ Compatibility: PostgreSQL 13-17 supported
269360

270361

@@ -273,13 +364,19 @@ uv run pytest --cov=src tests/
273364
## 🏆 **Why Choose This Server?**
274365

275366
-**Zero Known Vulnerabilities** - Comprehensive security audit passed
367+
-**Pyright Strict Mode** - 2,000+ type issues resolved, 100% type-safe codebase
276368
-**Enterprise-Grade** - Production-ready with advanced features
277369
-**63 Specialized Tools** - Complete database operation coverage
370+
-**10 Intelligent Resources** - Real-time database meta-awareness (NEW in v1.1.0!)
371+
-**10 Guided Prompts** - Step-by-step workflows for complex operations (NEW in v1.1.0!)
372+
-**AI Assistant Capabilities** - Proactive optimization and recommendations
278373
-**Real-Time Analytics** - pg_stat_statements integration
279374
-**AI-Native** - Vector search, semantic operations, ML-ready
280375
-**Active Maintenance** - Regular updates and security patches
281376
-**Comprehensive Documentation** - 16-page wiki with examples
282377

378+
**🌟 v1.1.0 Differentiation:** Only PostgreSQL MCP server with intelligent meta-awareness and guided workflows!
379+
283380
---
284381

285382
## 🔗 **Links**
@@ -304,14 +401,16 @@ uv run pytest --cov=src tests/
304401

305402
## 📈 **Project Stats**
306403

307-
- **Version 1.0.5** - Production ready release (October 3, 2025)
404+
- **Version 1.1.0** - Intelligent assistant release (October 4, 2025)
308405
- **63 MCP Tools** across 9 categories
309-
- **Phase 5 Complete** ✅ - All enterprise features implemented
310-
- **Type Safe** - Pyright strict mode
406+
- **10 MCP Resources** - Database meta-awareness (NEW!)
407+
- **10 MCP Prompts** - Guided workflows (NEW!)
408+
- **100% Type Safe** - Pyright strict mode (2,000+ issues resolved)
311409
- **Zero Known Vulnerabilities** - Security audit passed
410+
- **Zero Linter Errors** - Clean codebase with comprehensive type checking
312411
- **PostgreSQL 13-17** - Full compatibility
313412
- **Multi-platform** - Windows, Linux, macOS (amd64, arm64)
314-
- **6,900+ lines** - 12 modules, comprehensive implementation
413+
- **7,500+ lines** - 14 modules, comprehensive implementation
315414

316415
---
317416

pyproject.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "postgres-mcp-enhanced"
3-
version = "1.0.5"
4-
description = "Enterprise PostgreSQL MCP Server - Enhanced fork with comprehensive security and AI-native operations"
3+
version = "1.1.0"
4+
description = "Enterprise PostgreSQL MCP Server - Enhanced fork with comprehensive security, AI-native operations, and intelligent meta-awareness"
55
readme = "README.md"
66
requires-python = ">=3.12"
77
dependencies = [
@@ -83,9 +83,8 @@ force-single-line = true
8383
known-first-party = ["postgres-mcp"]
8484

8585
[tool.pyright]
86-
typeCheckingMode = "standard"
86+
typeCheckingMode = "strict"
8787
pythonVersion = "3.12"
88-
strictParameterNullChecking = true
8988
reportMissingTypeStubs = false
9089
# reportUnknownMemberType = true
9190
# reportUnknownParameterType = true

security/run_security_test.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import asyncio
2222
import os
2323
import sys
24-
from typing import Any
2524
from typing import Dict
25+
from typing import List
2626

2727
# Fix Windows event loop compatibility with psycopg3
2828
if sys.platform == "win32":
@@ -33,6 +33,8 @@
3333

3434
# Import from the current security directory
3535
from test_sql_injection_security import PostgresSQLInjectionTester
36+
from test_sql_injection_security import SecurityReport
37+
from test_sql_injection_security import TestResult
3638

3739

3840
def print_banner():
@@ -54,7 +56,7 @@ def print_banner():
5456
print()
5557

5658

57-
async def run_quick_test(connection_url: str) -> Dict[str, Any]:
59+
async def run_quick_test(connection_url: str) -> SecurityReport:
5860
"""Run a quick subset of critical security tests"""
5961

6062
print("Running QUICK security test (critical vulnerabilities only)...")
@@ -72,11 +74,11 @@ async def run_quick_test(connection_url: str) -> Dict[str, Any]:
7274
print(" is correctly attempting various attack vectors. The final VULN/SAFE results")
7375
print(" show whether each attack succeeded or was blocked.")
7476

75-
results = {}
77+
results: Dict[str, List[TestResult]] = {}
7678
for mode in ["unrestricted", "restricted"]:
7779
print(f"\nTesting {mode.upper()} mode...")
7880

79-
mode_results = []
81+
mode_results: List[TestResult] = []
8082
for i, test in enumerate(critical_tests, 1):
8183
print(f" [{i:2d}/{len(critical_tests)}] {test.name[:50]}...")
8284

@@ -95,7 +97,7 @@ async def run_quick_test(connection_url: str) -> Dict[str, Any]:
9597
return tester.generate_security_report(results)
9698

9799

98-
async def run_full_test(connection_url: str) -> Dict[str, Any]:
100+
async def run_full_test(connection_url: str) -> SecurityReport:
99101
"""Run the complete comprehensive security test suite"""
100102

101103
print("Running COMPREHENSIVE security test suite...")
@@ -105,7 +107,7 @@ async def run_full_test(connection_url: str) -> Dict[str, Any]:
105107
return await tester.run_comprehensive_test_suite()
106108

107109

108-
def print_summary_report(report: Dict[str, Any], test_type: str):
110+
def print_summary_report(report: SecurityReport, test_type: str):
109111
"""Print a concise summary report"""
110112

111113
print("\n" + "=" * 80)

0 commit comments

Comments
 (0)