Unrestricted PostgreSQL MCP Server
Provides full read-write access to PostgreSQL databases, enabling querying, modifying, and managing database content with transaction management and recovery capabilities.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Unrestricted PostgreSQL MCP Servershow me the users table schema"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Unrestricted PostgreSQL MCP Server
Fork of mcp-postgres-full-access by Syahiid Nur Kamil - Enhanced with modern tooling, transaction recovery tools, and improved developer experience.
A powerful Model Context Protocol (MCP) server that provides full read-write access to PostgreSQL databases. Unlike read-only MCP servers, this implementation enables Large Language Models to safely query, modify, and manage database content with comprehensive transaction management and recovery capabilities.
✨ Key Features
🔐 Safe Full Database Access
Read Operations: Execute SELECT queries with automatic read-only transaction protection
Write Operations: Safely perform INSERT, UPDATE, DELETE with explicit transaction management
Schema Management: Create, alter, and drop database objects with DDL operations
Maintenance Commands: Execute VACUUM, ANALYZE, and CREATE DATABASE operations
🛡️ Advanced Transaction Management
Explicit Commit/Rollback: Two-step process requiring user confirmation for all changes
Transaction Recovery: Tools to recover from aborted transaction states
Timeout Protection: Automatic rollback of abandoned transactions
Session Reset: Complete session reset capabilities for stuck connections
Connection Status: Real-time monitoring of database connection state
📊 Rich Schema Information
Comprehensive Metadata: Detailed column information, data types, constraints
Relationship Mapping: Primary keys, foreign keys, and index information
Performance Insights: Row count estimates and table statistics
Documentation Support: Table and column descriptions when available
🔧 Developer Experience
Modern Build System: Powered by Vite for fast development and building
TypeScript Support: Full type safety and IntelliSense support
Hot Reload: Instant development server with
vite-nodeComprehensive Tooling: 10+ specialized tools for database operations
Related MCP server: Postgres MCP Server
🚀 Quick Start
Prerequisites
Node.js 18.0.0 or higher
PostgreSQL 12.0 or higher
Claude Desktop (for MCP integration)
Installation
# Install globally
npm install -g unrestricted-postgres-mcp
# Or use with npx (recommended)
npx unrestricted-postgres-mcp postgresql://user:password@localhost:5432/databaseClaude Desktop Configuration
Add to your claude_desktop_config.json:
{
"mcpServers": {
"postgres-unrestricted": {
"command": "npx",
"args": [
"-y",
"unrestricted-postgres-mcp",
"postgresql://username:password@localhost:5432/database"
],
"env": {
"TRANSACTION_TIMEOUT_MS": "60000",
"MAX_CONCURRENT_TRANSACTIONS": "5",
"PG_STATEMENT_TIMEOUT_MS": "30000"
}
}
}
}🛠️ Available Tools
Query & Analysis Tools
Tool | Purpose | Parameters |
| Execute read-only SELECT queries |
|
| Get comprehensive database schema overview | None |
| Search text across tables using full-text search |
|
| List all tables in a schema |
|
| Get detailed table schema information |
|
Data Modification Tools
Tool | Purpose | Parameters |
| Execute data modification operations (auto-committed) |
|
| Run maintenance commands (VACUUM, ANALYZE) |
|
| Rollback a pending transaction |
|
Transaction Management & Recovery
Tool | Purpose | Parameters |
| List all active transactions | None |
| Force rollback aborted transactions | None |
| Reset database session completely | None |
🔄 Workflow Examples
Typical Usage Pattern
Query data to understand current state
Execute modifications (automatically committed)
Query again to verify changes
Recovery from Stuck Transactions
Diagnose: Use
list_transactionsto check stateList: Use
list_transactionsto see active transactionsRecover: Use
force_rollbackto clear aborted stateReset: If needed, use
reset_sessionfor complete reset
Schema Exploration
Discover: Use
list_tablesto see available tablesExamine: Use
describe_tablefor detailed schema informationQuery: Use
execute_queryto explore data patterns
⚙️ Configuration
Environment Variables
Variable | Default | Description |
|
| Transaction timeout in milliseconds |
|
| Maximum concurrent transactions |
|
| SQL statement execution timeout |
|
| Maximum PostgreSQL connections |
|
| Enable transaction monitoring |
|
| Transaction monitor check interval |
Security Best Practices
Create Dedicated Database User:
CREATE USER mcp_user WITH PASSWORD 'secure_password'; GRANT SELECT, INSERT, UPDATE, DELETE ON specific_tables TO mcp_user;Use "Allow Once" for All Operations:
Never select "Always allow" for database modifications
Review all SQL operations before approval
Test with Non-Production Data:
Use a development database for initial testing
Implement regular backups before extensive use
🏗️ Development
Prerequisites
Node.js 18+
pnpm (recommended) or npm
PostgreSQL database
Setup
# Clone the repository
git clone https://github.com/your-username/unrestricted-postgres-mcp.git
cd unrestricted-postgres-mcp
# Install dependencies
pnpm install
# Create environment file
cp .env.example .env
# Edit .env with your database connection details
# Start development server
pnpm run dev
# Build for production
pnpm run buildAvailable Scripts
Script | Purpose |
| Start development server with hot reload |
| Build for production |
| Run production build |
| Run TypeScript type checking |
Project Structure
src/
├── index.ts # Main server entry point
├── lib/
│ ├── config.ts # Configuration management
│ ├── tool-handlers.ts # Tool implementation functions
│ ├── transaction-manager.ts # Transaction lifecycle management
│ ├── types.ts # TypeScript type definitions
│ └── utils.ts # Utility functions
└── types.ts # Additional type definitions🔍 Troubleshooting
Common Issues
"Current transaction is aborted" Error:
Use
list_transactionsto diagnoseUse
force_rollbackto clear aborted stateIf still stuck, use
reset_session
Connection Timeouts:
Check
PG_STATEMENT_TIMEOUT_MSsettingIncrease
TRANSACTION_TIMEOUT_MSif neededVerify database connection limits
Permission Errors:
Verify database user permissions
Check table-specific access rights
Ensure user has necessary schema access
📊 Comparison with Official MCP Servers
Feature | This Server | Official PostgreSQL MCP |
Read Access | ✅ Enhanced | ✅ Basic |
Write Access | ✅ Full Support | ❌ Not Available |
Transaction Management | ✅ Advanced | ❌ Not Available |
Schema Details | ✅ Comprehensive | ✅ Basic |
Recovery Tools | ✅ Multiple Options | ❌ Not Available |
Type Safety | ✅ Full TypeScript | ❌ Not Available |
Modern Tooling | ✅ Vite + Hot Reload | ❌ Not Available |
🤝 Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
Quick Contribution Guide
Fork the repository
Create a feature branch:
git checkout -b feature/amazing-featureMake your changes
Run tests:
pnpm run type-check && pnpm run buildCommit changes:
git commit -m 'Add amazing feature'Push to branch:
git push origin feature/amazing-featureOpen a Pull Request
📄 License
This project is licensed under the Apache License Version 2.0 - see the LICENSE file for details.
👥 Credits
Original Creator: Syahiid Nur Kamil - mcp-postgres-full-access
Current Maintainer: Jonas Lindberg - Enhanced version with modern tooling and recovery capabilities
🙏 Acknowledgments
Model Context Protocol for the MCP specification
Anthropic for Claude and MCP integration
PostgreSQL for the excellent database system
Vite for the modern build tooling
⚠️ Important: This server provides full database access. Always review operations before committing changes and use appropriate database user permissions for security.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/startino/unrestricted-postgres-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server