- Home
- MCP servers
- PostgreSQL
PostgreSQL
- javascript
0
GitHub Stars
javascript
Language
6 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"derricksiawor-mav-postgresql-mcp-server": {
"command": "node",
"args": [
"/path/to/mav-postgresql-mcp-server/build/index.js"
],
"env": {
"PG_HOST": "localhost",
"PG_PORT": "5432",
"PG_USER": "postgres",
"PG_SCHEMA": "public",
"MAX_RESULTS": "1000",
"PG_DATABASE": "YOUR_DATABASE",
"PG_PASSWORD": "YOUR_PASSWORD",
"PG_SSL_MODE": "require",
"QUERY_TIMEOUT": "30000",
"PG_SSL_CA_PATH": "/path/to/ca.crt",
"PG_SSL_KEY_PATH": "/path/to/client.key",
"CONNECTION_LIMIT": "10",
"PG_SSL_CERT_PATH": "/path/to/client.crt",
"PG_SSL_MIN_VERSION": "TLSv1.2",
"RATE_LIMIT_PER_HOUR": "1000",
"RATE_LIMIT_CONCURRENT": "10",
"RATE_LIMIT_PER_MINUTE": "60",
"ALLOW_WRITE_OPERATIONS": "false",
"PG_SSL_REJECT_UNAUTHORIZED": "true"
}
}
}
}You can query and manage PostgreSQL databases through a dedicated MCP server that exposes a comprehensive set of tools for read and write operations, SSL-enabled connections, security controls, and audit logging. This MCP server is designed to give you controlled, programmatic access to PostgreSQL data via MCP clients while enforcing safety and performance best practices.
How to use
Install and run the MCP server locally or in your environment, then connect your MCP client to the local stdio server. You will typically enable read-only operations by default and opt into write operations only when you explicitly set ALLOW_WRITE_OPERATIONS to true.
How to install
Prerequisites you need before starting: Node.js and npm are installed on your system.
# Clone or copy to your tools directory
cd /path/to/tools/mav-postgresql-mcp-server
# Install dependencies
npm install
# Build the server
npm run build
Configuration and usage notes
Configure the PostgreSQL connection in a .env file. You will typically copy a template and customize values for your environment.
cp .env.example .env
Security and operational guidance
-
Default blocks prevent dangerous file-system and administrator operations. Avoid granting broad permissions in production unless you explicitly enable them and understand the consequences.
-
Use a dedicated read-only PostgreSQL user for production deployments and limit write permissions unless necessary.
Troubleshooting
If you encounter connection or SSL issues, verify your PostgreSQL host, port, and credentials, then validate SSL configuration and certificate paths.
Available tools
query
Execute SELECT queries to fetch data from PostgreSQL in a read-only manner.
list_tables
List all tables visible in the current schema.
describe_table
Return table structure with column definitions and data types.
database_info
Provide database version, settings, and connection details.
show_indexes
List indexes defined on a specific table.
explain_query
Return the query execution plan for a given statement.
show_constraints
List constraints on a table (primary keys, foreign keys, checks).
list_schemas
List all schemas in the connected database.
get_current_schema
Show the current schema search path.
list_extensions
List installed PostgreSQL extensions.
extension_info
Get detailed information about a specific extension.
list_functions
List user-defined functions in the database.
list_triggers
List triggers defined on a table.
list_views
List views within a schema.
list_sequences
List sequences in a schema.
table_stats
Get statistics for a particular table.
connection_info
Get details about the current database connection.
database_size
Get size information for databases or tables.
jsonb_query
Query JSONB columns with operators and filters.
jsonb_path_query
Execute JSON path queries on JSONB data.
insert
Insert a single row into a table.
update
Update rows matching a condition.
delete
Delete rows matching a condition.
create_table
Create a new table with specified columns.
alter_table
Modify an existing table structure.
drop_table
Remove a table from the database.
bulk_insert
Insert multiple rows in a single operation.
execute_procedure
Call a stored procedure.
add_index
Create a new index on a table.
drop_index
Drop an existing index.
rename_table
Rename a table.
set_search_path
Change the schema search path for queries.
create_schema
Create a new database schema.
drop_schema
Drop an existing schema.
jsonb_update
Update JSONB fields within a row.
vacuum_analyze
Run VACUUM and ANALYZE to optimize table statistics.