postgresql-mcp
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"postgres": {
"args": [
"-y",
"postgresql-mcp",
"--postgres",
"postgres://user:password@localhost:5432/database"
],
"command": "npx"
}
}
}
服务介绍
postgresql-mcp
UNDER DEVELOPMENT - NOT READY FOR PRODUCTION
An enterprise-focused PostgreSQL MCP server enabling secure, AI-driven database administration, observability, and querying via OAuth 2.0, with connection pooling, OAuth 2.0 and advanced tool filtering.
Features
- Full PostgreSQL Support - 100% coverage of PostgreSQL features
- Connection Pooling - Built-in connection pool management
- Tool Filtering - Filter tools by category or custom patterns
- Extension Support - PostGIS, pgvector, pg_stat_statements, and more
- Code Mode - TypeScript implementation with strict typing
Quick Start
# Install
npm install -g postgresql-mcp
# Run with connection string
postgresql-mcp --postgres postgres://user:password@localhost:5432/database
MCP Client Configuration
Claude Desktop / Cursor
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "postgresql-mcp", "--postgres", "postgres://user:password@localhost:5432/database"]
}
}
}
Tool Categories
| Category | Tools | Description |
|---|---|---|
| Core Database | TBD | Schema, SQL execution, health |
| JSON Operations | TBD | JSONB operations, validation |
| Text Processing | TBD | Similarity, full-text, fuzzy |
| Statistical Analysis | TBD | Stats, correlation, regression |
| Performance | TBD | Query optimization, index tuning |
| Vector/Semantic | TBD | pgvector integration |
| Geospatial | TBD | PostGIS operations |
| Backup & Recovery | TBD | Backup planning, restore |
| Monitoring | TBD | Real-time monitoring, alerting |
Extension Support
| Extension | Purpose |
|---|---|
pg_stat_statements |
Query performance tracking |
pg_trgm |
Text similarity |
fuzzystrmatch |
Fuzzy matching |
hypopg |
Hypothetical indexes |
pgvector |
Vector similarity search |
PostGIS |
Geospatial operations |
Development
# Clone and install
git clone https://github.com/neverinfamous/postgresql-mcp.git
cd postgresql-mcp
npm install
# Build
npm run build
# Run checks
npm run check
License
MIT License - see LICENSE for details.
Contributing
See CONTRIBUTING.md for contribution guidelines.