home / mcp / postgresql mcp server
Mcp server for postgres
Configuration
View docs{
"mcpServers": {
"1levick3-postgresql-mcp-server": {
"command": "node",
"args": [
"/Users/1Levick3/Desktop/postgresql-mcp-server/build/index.js"
],
"env": {
"POSTGRES_SSL_CERT_PATH": "/Users/1levick3/Desktop/root.crt",
"POSTGRES_CONNECTION_STRING": "postgresUrl"
}
}
}
}You can run direct PostgreSQL queries from MCP clients through this server, enabling parameterized SQL execution with configurable timeouts. It’s designed to work with MCP environments and the Cursor IDE, allowing you to connect securely to PostgreSQL databases and perform query operations from your MCP workflow.
Connect your MCP client to the PostgreSQL MCP Server using the stdio configuration defined in your MCP settings. You will run the server as a local process and provide the necessary connection details via environment variables. The server exposes direct SQL query execution against your target PostgreSQL databases, with support for parameterized queries and configurable timeouts. Ensure your client supplies SQL statements and parameters, and the server will execute them against the database you specify via the connection string.
Prerequisites you need before setup:
- Node.js >= 18.0.0
- PostgreSQL server (for target database operations)
- Network access to target PostgreSQL instances
Concrete steps to install and configure the MCP server locally are shown below. You will build the server and add an MCP configuration entry to enable runtime usage.
1. Clone the PostgreSQL MCP Server repository
2. Install dependencies
npm install3. Build the server
npm run build4. Add the MCP configuration for the server. Use the following settings to run the server locally with Node and point to the built index file. The environment variables specify how to reach the PostgreSQL database and how to validate the SSL certificate if used.
{
"mcpServers": {
"postgresql_mcp": {
"command": "node",
"args": ["/Users/1Levick3/Desktop/postgresql-mcp-server/build/index.js"],
"disabled": false,
"alwaysAllow": [],
"env": {
"POSTGRES_CONNECTION_STRING": "postgresUrl",
"POSTGRES_SSL_CERT_PATH": "/Users/1levick3/Desktop/root.crt"
}
}
}
}