# Devart MCP Server for PostgreSQL (ADO.NET) [Health: Active]

**Category:** 🗄️ Databases  
**Repository:** https://github.com/devart-ai-connectivity/devart-mcp-server-postgresql  
**GitHub Stars:** 0  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/devart-mcp-server-for-postgresql-ado-net

## Description
Schema-aware read/write access to PostgreSQL through Devart dotConnect ADO.NET data provider.

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/devart-ai-connectivity/devart-mcp-server-postgresql), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Install:

```sh
git clone https://github.com/devart-ai-connectivity/devart-mcp-server-postgresql.git
```

2. Install:

```sh
cd devart-mcp-server-postgresql
```

3. Install:

```sh
dotnet publish Devart.AI.McpServer.AdoNet/Devart.AI.McpServer.AdoNet.PostgreSql/Devart.AI.McpServer.AdoNet.PostgreSql.csproj -c ReleasePostgreSql /p:TargetFramework=net8.0
```

4. Install:

```sh
dotnet publish Devart.AI.McpServer.Odbc/Devart.AI.McpServer.Odbc.PostgreSql/Devart.AI.McpServer.Odbc.PostgreSql.csproj -c ReleasePostgreSql -r "win-x64" /p:TargetFramework=net8.0
```

5. Install:

```sh
dotnet publish Devart.AI.McpServer.Odbc/Devart.AI.McpServer.Odbc.PostgreSql/Devart.AI.McpServer.Odbc.PostgreSql.csproj -c ReleasePostgreSql -r "win-x86" /p:TargetFramework=net8.0
```

## Documentation & README

[![Devart MCP Server for PostgreSQL](https://github.com/devart-ai-connectivity/.github/blob/main/assets/cover-banner-mcp-server-for-postgresql.webp?raw=true)](https://www.devart.com/mcp/postgresql/?utm_source=github&utm_medium=readme&utm_campaign=mcp-postgresql)

[![NuGet](https://img.shields.io/nuget/v/Devart.Mcp.PostgreSql?label=NuGet)](https://www.nuget.org/packages/Devart.Mcp.PostgreSql) [![MCP Registry](https://img.shields.io/badge/MCP_Registry-com.devart%2Fmcp--postgresql-blue)](https://registry.modelcontextprotocol.io/v0.1/servers?search=com.devart/mcp-postgresql)

### Version 1.1.0

**[What's new](https://github.com/devart-ai-connectivity/devart-mcp-server-postgresql/releases/latest)** · [Changelog](https://github.com/devart-ai-connectivity/devart-mcp-server-postgresql/blob/HEAD/CHANGELOG.md)

# Devart MCP Server for PostgreSQL

Devart MCP Server for PostgreSQL is a self-hosted Model Context Protocol (MCP) server that gives AI clients structured access to your PostgreSQL data—schema, queries, and writes. It runs in your environment on Windows and is free to use.

The server comes in two editions built from this repository:

| Edition | How you get it | Connects through |
|---|---|---|
| **ADO.NET** | NuGet .NET tool [`Devart.Mcp.PostgreSql`](https://www.nuget.org/packages/Devart.Mcp.PostgreSql), MCP Registry name `com.devart/mcp-postgresql` | Devart dotConnect for PostgreSQL, included in the package |
| **ODBC** | Windows installer from [devart.com](https://www.devart.com/mcp/postgresql/download.html?utm_source=github&utm_medium=readme&utm_campaign=mcp-postgresql) | Devart ODBC Driver for PostgreSQL, installed with the server |

## Key benefits

Devart MCP Server for PostgreSQL allows you to:

* Work with data intuitively through natural language.
* Retrieve the required data for analysis within minutes.
* Report on your data faster with AI-powered assistance.
* Minimize manual data handling and integration maintenance.

## How it works

The server exposes your PostgreSQL schema—tables, columns, keys, indexes, and routines—to the AI client as MCP tools. The AI client uses this schema to compose SQL queries and sends them to the server as tool calls. The server runs the queries through dotConnect for PostgreSQL or Devart ODBC Driver for PostgreSQL and returns structured results. Nothing is routed through a Devart-hosted service.

![Devart MCP Server architecture](https://raw.githubusercontent.com/devart-ai-connectivity/.github/main/assets/how_mcp_works_single.webp?raw=true)

## Available tools

The server exposes 14 tools. Tool names are prefixed with the connection profile name, for example `my_postgresql_get_tables`.

| Category | Tools |
|---|---|
| Schema | `get_tables`, `get_columns`, `get_primary_keys`, `get_foreign_keys`, `get_indexes`, `get_routines` |
| Read | `execute_reader`, `count_rows` |
| Write | `execute_nonquery`, `add_row`, `execute_routine` |
| Server | `server_version`, `instructions`, `config` |

The server includes write tools: `execute_nonquery` runs INSERT, UPDATE, DELETE, CREATE, ALTER, and DROP statements, and `execute_routine` calls stored procedures. For read-only access, see [Security and access control](#security-and-access-control).

## Transports

| Transport | How it works |
|---|---|
| stdio | The AI client starts the server as a local process. Use it when the AI client runs on the same computer. |
| HTTP | You start the server, and AI clients connect to `http://localhost:8080` (Streamable HTTP) or `http://localhost:8080/sse` (SSE). The HTTP transport doesn't use authentication, so keep the server bound to `localhost`. |

## Quick start

### Option 1: NuGet package (ADO.NET)

**Prerequisites**

* Windows x64.
* .NET 8 or later, including the ASP.NET Core shared framework. `dnx` requires .NET 10 or later. For .NET 8 and .NET 9, see the [package README](https://www.nuget.org/packages/Devart.Mcp.PostgreSql#readme-body-tab).
* A dotConnect for PostgreSQL license key. On the [licensing page](https://secure.devart.com/licenses?product=dotconnect/postgresql&source=activation), sign in to copy your key or register for a free 30-day trial.

**Step 1: Create a connection profile**

```
dnx Devart.Mcp.PostgreSql@1.1.0 config add my_postgresql --connection-string "Server=localhost;Port=5432;Database=your_database;User Id=your_user;Password=your_password;Unicode=True;License Key=your_license_key;" --protocol-type stdio
```

For all connection string parameters, see the [dotConnect for PostgreSQL connection string reference](https://www.devart.com/dotconnect/postgresql/connection-strings.html?utm_source=github&utm_medium=readme&utm_campaign=mcp-postgresql).

**Step 2: Add the server to your AI client**

In Visual Studio Code, run **MCP: Open User Configuration** from the Command Palette and add:

```json
{
  "servers": {
    "devart-postgresql": {
      "type": "stdio",
      "command": "dnx",
      "args": ["Devart.Mcp.PostgreSql@1.1.0", "run", "my_postgresql"]
    }
  }
}
```

The AI client starts the server automatically. Instead of a profile, you can pass the connection string in the `DEVART_MCP_POSTGRESQL_CONNECTION` environment variable.

Configuration examples for Visual Studio, Claude Desktop, Cline, Codex, Cursor, Windsurf, and Zed, the .NET 8 and .NET 9 setup, and the HTTP transport setup are in the [package README on NuGet](https://www.nuget.org/packages/Devart.Mcp.PostgreSql#readme-body-tab).

### Option 2: Windows installer (ODBC)

1\. [Download](https://www.devart.com/mcp/postgresql/download.html?utm_source=github&utm_medium=readme&utm_campaign=mcp-postgresql) and [install](https://docs.devart.com/mcp/installation.html) Devart MCP Server for PostgreSQL. The installer also installs Devart ODBC Driver for PostgreSQL and .NET 8.

2\. In Devart MCP Server for PostgreSQL, [configure your data connection, transport, and integration settings](https://docs.devart.com/mcp/connection-configuration.html). For all connection string parameters, see the [Devart ODBC Driver for PostgreSQL connection string reference](https://docs.devart.com/odbc-driver-for-postgresql/connect-to-postgresql/connection-string-parameters.html).

![Devart MCP Server configuration](https://raw.githubusercontent.com/devart-ai-connectivity/.github/main/assets/mcp-servers-gui.webp?raw=true)

3\. Run your first natural-language query.

[![Need an MCP Server for multiple data sources?](https://github.com/devart-ai-connectivity/.github/blob/main/assets/need-mcp-server-universal.webp?raw=true)](https://www.devart.com/mcp/universal/?utm_source=github&utm_medium=readme&utm_campaign=mcp-postgresql)

## Security and access control

The server includes write tools and can do anything the account in the connection string is allowed to do. To limit an AI client to reading data:

| Edition | Read-only access |
|---|---|
| ADO.NET (NuGet) | Connect with a PostgreSQL role that has only the SELECT privilege |
| ODBC (installer) | Add `Read Only=True` to the connection string |

To limit what an AI client can read, give the account access only to the data it needs.

* **Self-hosted.** The server runs on your computer, not on Devart infrastructure, and connects to PostgreSQL from there. Query results go to your AI client and its AI model provider.
* **Network access.** The HTTP transport doesn't use authentication. Keep the server bound to `localhost`, the default address. See [Transports](#transports).

## Manual installation and configuration 

**Prerequisites** 

Before building and running Devart MCP Server for PostgreSQL, ensure the following components are installed:

* [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0)
* **ADO.NET connection** — **Devart.AI.McpServer.AdoNet.PostgreSql.csproj** Devart dotConnect for PostgreSQL (installed automatically via NuGet during build)
* **ODBC connection** — **Devart.AI.McpServer.Odbc.PostgreSql.csproj** [Devart ODBC Driver for PostgreSQL](https://www.devart.com/odbc/postgresql/download.html) (requires manual download and installation)

**Step 1: Clone the repository**

Clone the project repository and navigate to the project directory:

1\. Open **Command Prompt**.

2\. Enter the following command:

```cmd
git clone https://github.com/devart-ai-connectivity/devart-mcp-server-postgresql.git
cd devart-mcp-server-postgresql
```

**Step 2: Build the MCP Server from source**

You can build Devart MCP Server for PostgreSQL from source using either of the supported database connectivity technologies: ADO.NET or ODBC.

* To build the MCP server with ADO.NET, run the following command:

```cmd
dotnet publish Devart.AI.McpServer.AdoNet/Devart.AI.McpServer.AdoNet.PostgreSql/Devart.AI.McpServer.AdoNet.PostgreSql.csproj -c ReleasePostgreSql /p:TargetFramework=net8.0
```
The Devart dotConnect for PostgreSQL NuGet package is downloaded and restored automatically.

* To build the MCP server with ODBC, select the command based on the bitness of your data source.

For 64-bit data source, run the following command:

```cmd
dotnet publish Devart.AI.McpServer.Odbc/Devart.AI.McpServer.Odbc.PostgreSql/Devart.AI.McpServer.Odbc.PostgreSql.csproj -c ReleasePostgreSql -r "win-x64" /p:TargetFramework=net8.0
```

For 32-bit data source, run the following command:

```cmd
dotnet publish Devart.AI.McpServer.Odbc/Devart.AI.McpServer.Odbc.PostgreSql/Devart.AI.McpServer.Odbc.PostgreSql.csproj -c ReleasePostgreSql -r "win-x86" /p:TargetFramework=net8.0
```
>**Note**
>
>The target platform must match the bitness of your ODBC data source.

**Step 3: Configure the database connection for the MCP Server**

1\. Create an `mcpserver.json` configuration file in the directory containing the built MCP Server executable.

2\. In the file, configure the database connection.

* Configure a connection with ADO.NET.

Add the following configuration to the `mcpserver.json` file:

```json
{
  "Connections": [
    {
      "Name": "my_postgresql",
      "ConnectionString": "Server=localhost;Port=5432;User Id=your_user;Password=your_password;Database=your_database;License Key=your_license_key;",
      "ProtocolType": "stdio"
    }
  ]
}
```

* Configure a connection with ODBC.

Add the following configuration to the `mcpserver.json` file:

```json
{
  "Connections": [
    {
      "Name": "my_postgresql",
      "DsnName": "your_dsn_name",
      "ProtocolType": "stdio"
    }
  ]
}
```

* Configure a connection with ODBC using a connection string.

Add the following configuration to the `mcpserver.json` file:

```json
{
  "Connections": [
    {
      "Name": "my_postgresql",
      "ConnectionString": "Driver={Devart ODBC Driver for PostgreSQL};Server=localhost;User ID=postgres;Password=your_password;Database=your_database;",
      "ProtocolType": "stdio"
    }
  ]
}
```
where:

* `Name` — The connection name.

* `ConnectionString` (applies to ADO.NET) — A database-specific connection string used to establish a connection to the target database.

* `DsnName` (applies to ODBC) — The name of your data source.

* `ProtocolType` — A transport protocol. The possible options are: `stdio` or `http`.

* `HttpPort` (required if `ProtocolType` is set to `http`) — The port number for the `http` protocol. 

**Step 4: Run the MCP server**

After you configure the MCP Server, you can start it. 

>**Note**
>
>This step is required only when `ProtocolType` is configured as `http`. If you use the `stdio` transport protocol, your AI client starts the server automatically.

* To start the server with ADO.NET, run the following command:

```cmd
Devart.AI.McpServer.AdoNet.PostgreSql.exe run my_postgresql
```

* To start the server with ODBC, run the following command:

```cmd
Devart.AI.McpServer.Odbc.PostgreSql.exe run my_postgresql
```

where `my_postgresql` is the name of the ODBC connection.

**Step 5: Integrate with Claude Desktop**

1\. Open `claude_desktop_config.json`, the Claude configuration file.

>**Tip**
>
>If you can't locate the configuration file, it may not exist yet. To create it, open Claude Desktop and navigate to **File** > **Settings** > **Developer**, then click **Edit Config**. The folder with the `claude_desktop_config.json` file opens.

2\. Add one of the following objects, depending on the transport protocol used by MCP Server:

* STDIO

```json
{
  "mcpServers": {
    "devart": {
      "command": "C:\\path\\to\\Devart.AI.McpServer.AdoNet.PostgreSql.exe",
      "args": [
        "run",
        "my_postgresql"
      ]
    }
  }
}
```

 where:

  * `devart` is the connector name that will appear in Claude Desktop.
  * `C:\\path\\to\\Devart.AI.McpServer.AdoNet.PostgreSql.exe` is the path to the executable file. For an ODBC connection, use `Devart.AI.McpServer.Odbc.PostgreSql.exe`.
  * `my_postgresql` is the connection name specified in the `mcpserver.json` configuration file.

* **HTTP**

  ```json
    "mcpServers": {
      "devart": {
        "command": "npx",
        "args": [
          "-y",
          "mcp-remote",
          "http://localhost:5000/sse"
        ]
      }
    }
  ```

  where:

  * `devart` is the connector name that will appear in Claude Desktop.
  * `5000` is the MCP Server listening port.

3\. Save the file.

4\. Restart Claude Desktop.

Devart MCP Server for PostgreSQL is now integrated with Claude, and **devart** appears in the Claude Desktop app in **Customize** > **Connectors**.

You can also [integrate](https://docs.devart.com/mcp/ai-integration/) Devart MCP Server for PostgreSQL with other AI clients such as Cline, Codex, Cursor, Visual Studio Code, Windsurf, Zed.


## Supported clients

Devart MCP Server for PostgreSQL supports integration with the following AI clients:

* Visual Studio
* Visual Studio Code
* Claude Desktop
* Cursor
* Codex
* Windsurf
* Cline
* Zed
* ...and other MCP-compatible AI clients

## Typical use cases

Devart MCP Server for PostgreSQL is a practical fit for teams working with PostgreSQL as their primary data source.

* **Self-service analytics on PostgreSQL data**  
  Let analysts, product managers, sales, finance, and operations teams ask natural-language questions without writing SQL.

* **Developer copilot for production PostgreSQL databases**  
  Help developers and DBAs investigate real data, inspect schemas, explore joins, and troubleshoot anomalies faster.

* **Support and customer operations investigation**  
  Let support teams quickly check orders, subscriptions, payments, statuses, and account history stored in PostgreSQL.

* **Schema exploration and reverse engineering**  
  Use AI to explain tables, relationships, and business logic in legacy or poorly documented PostgreSQL databases.

* **Ad-hoc reporting and internal analysis**  
  Generate one-off reports, investigate trends, and answer business questions from PostgreSQL without building a dashboard first.

* **Secure on-premises AI access to PostgreSQL**  
  Keep PostgreSQL data inside your infrastructure while giving AI tools a controlled path to work with real business data. The AI model provider still receives the data your AI client sends to it.

## Licensing and activation

Devart MCP Server for PostgreSQL is free to use under the [Devart MCP Server License Agreement](https://www.devart.com/mcp/eula.html). See [LICENSE](https://github.com/devart-ai-connectivity/devart-mcp-server-postgresql/blob/HEAD/LICENSE).

To connect to PostgreSQL, each edition needs a licensed Devart connectivity component. Both are commercial products with a free 30-day trial:

* **ADO.NET edition**—a [dotConnect for PostgreSQL](https://www.devart.com/dotconnect/postgresql/?utm_source=github&utm_medium=readme&utm_campaign=mcp-postgresql) license key, passed in the connection string as `License Key=`. [Get a license key or a trial](https://secure.devart.com/licenses?product=dotconnect/postgresql&source=activation).
* **ODBC edition**—a license for [Devart ODBC Driver for PostgreSQL](https://www.devart.com/odbc/postgresql/?utm_source=github&utm_medium=readme&utm_campaign=mcp-postgresql). The server installer installs the driver, and the driver's 30-day trial starts automatically. When the trial ends, [buy a license](https://www.devart.com/odbc/postgresql/ordering.html?utm_source=github&utm_medium=readme&utm_campaign=mcp-postgresql) and activate the license key in the driver settings.

## Support

* [Documentation](https://docs.devart.com/mcp/)
* [Contact Devart](https://www.devart.com/company/contact.html?utm_source=github&utm_medium=readme&utm_campaign=mcp-postgresql)
* [Suggest a feature](https://devart.uservoice.com/)
* [Join our forum](https://support.devart.com/portal/en/community/data-connectivity)

## Other Devart connectivity solutions

* [MCP Server Universal](https://github.com/devart-ai-connectivity/devart-mcp-server-universal)
* [ODBC Driver for PostgreSQL](https://www.devart.com/odbc/postgresql/?utm_source=github&utm_medium=readme&utm_campaign=mcp-postgresql)
* [dotConnect ADO.NET Provider for PostgreSQL](https://www.devart.com/dotconnect/postgresql/?utm_source=github&utm_medium=readme&utm_campaign=mcp-postgresql)

