home / mcp / postgresql mcp server

PostgreSQL MCP Server

This read-only MCP Server allows you to connect to PostgreSQL data from Claude Desktop through CData JDBC Drivers. For full CRUD support, check out the first managed MCP platform: CData Connect AI (https://www.cdata.com/ai/).

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "cdatasoftware-postgresql-mcp-server-by-cdata": {
      "command": "java",
      "args": [
        "-jar",
        "CDataMCP-jar-with-dependencies.jar",
        "/PATH/TO/postgresql.prp"
      ]
    }
  }
}

You can query live PostgreSQL data through a local MCP Server powered by the CData JDBC Driver. This read-only MCP setup lets you ask natural language questions and receive live data results without writing SQL, making it ideal for AI assistants to access up-to-date PostgreSQL information from your environment.

How to use

Once you have the MCP Server running, connect your AI client (for example Claude Desktop) to the local MCP endpoint. Use the built-in tools to inspect data, read table schemas, and run read-only queries against PostgreSQL through the MCP interface. You can ask questions like which accounts have the highest revenue, what opportunities are open, or which calendar events are scheduled for today. The server exposes tools that retrieve tables, list columns, and run read-only SELECT queries against your PostgreSQL data.

How to install

Prerequisites: You need a Java runtime and Maven to build the server. You also need the CData JDBC Driver for PostgreSQL installed and licensed before running the MCP server.

bash
# 1) Clone the project
 git clone https://github.com/cdatasoftware/postgresql-mcp-server-by-cdata.git
 cd postgresql-mcp-server-by-cdata

# 2) Build the server
 mvn clean install

# This creates the JAR: CDataMCP-jar-with-dependencies.jar

Additional sections

License the CData JDBC Driver to enable full operation in your environment. Install the driver, then run the license command from the driver’s lib directory, and provide your name, email, and license status as prompted.

Configure your JDBC connection to PostgreSQL by running the Connection String utility in the driver package, test the connection, and copy the connection string for later use in the MCP PRP configuration.

Create a PRP file (for example, postgresql.prp) with the required properties to connect through the MCP Server. Include the Prefix, ServerName, ServerVersion, DriverPath, DriverClass, and JdbcUrl. Leave Tables blank to access all data or specify particular tables you want to expose.

To start the MCP Server locally, run the following command using the PRP you created. This server is stdio-based and runs on the same machine as the client.

java -jar /PATH/TO/CDataMCP-jar-with-dependencies.jar /PATH/TO/Salesforce.prp

Available tools

postgresql_get_tables

Retrieves a list of available tables from the PostgreSQL data source. The output is returned in CSV format with column headers.

postgresql_get_columns

Retrieves a list of columns for a specified table. The output is returned in CSV format with column headers.

postgresql_run_query

Executes a SQL SELECT query against the PostgreSQL data source and returns the results.