Download the PHP package momodemo333/php-mcp-postgresql without Composer
On this page you can find all versions of the php package momodemo333/php-mcp-postgresql. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download momodemo333/php-mcp-postgresql
More information about momodemo333/php-mcp-postgresql
Files in momodemo333/php-mcp-postgresql
Package php-mcp-postgresql
Short Description PostgreSQL MCP Server for Claude Code - Secure and configurable PostgreSQL integration via Model Context Protocol
License MIT
Homepage https://github.com/momodemo333/php-mcp-postgresql
Informations about the package php-mcp-postgresql
๐ PHP MCP PostgreSQL Server
PostgreSQL MCP Server for Claude Code - Secure and configurable PostgreSQL integration via Model Context Protocol.
๐ Version 1.0.0-beta: Core functionality complete! Production testing in progress.
๐ Features
- ๐ Secure by Default - Read-only operations by default, write operations require explicit permission
- ๐ฏ PostgreSQL Native - Full support for JSONB, arrays, CTEs, window functions, and more
- โก High Performance - Connection pooling, prepared statements, query timeouts
- ๐ Schema Introspection - Explore databases, tables, columns, indexes
- ๐ง Flexible Configuration - Environment variables, .env files, multi-database support
- ๐ก๏ธ Built-in Protection - SQL injection prevention, dangerous keyword blocking, result limits
๐ฆ Requirements
- PHP 8.1 or higher
- PostgreSQL 12 or higher
- Composer
- PHP extensions:
ext-pdo
,ext-pdo_pgsql
๐ง Installation
1. Clone the Repository
2. Install Dependencies
3. Configure Environment
โ๏ธ Configuration
Environment Variables
Variable | Description | Default |
---|---|---|
PGSQL_HOST |
PostgreSQL server host | localhost |
PGSQL_PORT |
PostgreSQL server port | 5432 |
PGSQL_USER |
Database username | postgres |
PGSQL_PASS |
Database password | (empty) |
PGSQL_DB |
Database name (optional for multi-db) | (empty) |
ALLOW_INSERT_OPERATION |
Enable INSERT queries | false |
ALLOW_UPDATE_OPERATION |
Enable UPDATE queries | false |
ALLOW_DELETE_OPERATION |
Enable DELETE queries | false |
QUERY_TIMEOUT |
Query timeout in seconds | 30 |
MAX_RESULTS |
Maximum rows returned | 1000 |
CONNECTION_POOL_SIZE |
Max concurrent connections | 5 |
LOG_LEVEL |
Logging level (DEBUG/INFO/WARN/ERROR) | INFO |
Claude Code Configuration
Add to your Claude Code settings (claude-code-settings.json
):
See examples/ for more configuration examples.
๐ ๏ธ Available Tools
Database Management
pgsql_list_databases
- List all available databasespgsql_list_tables
- List tables in a databasepgsql_describe_table
- Get detailed table structurepgsql_server_status
- Get server status and statistics
Query Execution
pgsql_select
- Execute SELECT queries safelypgsql_insert
- Insert data (requires permission)pgsql_update
- Update data (requires permission)pgsql_delete
- Delete data (requires permission)pgsql_execute_query
- Execute custom queries (with validation)
๐งช Testing
Quick Test
Docker Test Environment
The project includes a complete Docker test environment:
๐ Security
Default Security Features
- Read-only by default - All write operations disabled unless explicitly enabled
- Prepared statements - Prevents SQL injection attacks
- Query validation - Blocks dangerous keywords and operations
- Result limits - Prevents memory exhaustion from large result sets
- Connection timeouts - Prevents hanging queries
- Schema restrictions - Limit access to specific schemas
Best Practices
- Never enable write operations in production unless absolutely necessary
- Use read-only database users when possible
- Set appropriate
MAX_RESULTS
andQUERY_TIMEOUT
values - Review logs regularly for suspicious activity
- Keep the server updated with security patches
๐ PostgreSQL-Specific Features
JSONB Support
Array Support
Advanced Features
- Common Table Expressions (CTEs)
- Window functions
- RETURNING clause on INSERT/UPDATE/DELETE
- Materialized views
- Full-text search
- Custom types and domains
๐ Documentation
- Installation Guide
- Configuration Reference
- MCP Tools Documentation
- Troubleshooting
- Migration Plan
- Implementation Status
๐ค Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Write tests for new functionality
- Ensure all tests pass
- Submit a pull request
๐ License
MIT License - see LICENSE file for details.
๐ Acknowledgments
- Built with php-mcp/server framework
- Based on php-mcp-mysql architecture
- Thanks to the MCP community for the protocol specification
๐ฌ Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Version: 1.0.0-beta
Status: Production Testing
Last Updated: January 2025