

Version 1.1.0
What's new · Changelog
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, MCP Registry name com.devart/mcp-postgresql | Devart dotConnect for PostgreSQL, included in the package |
| ODBC | Windows installer from devart.com | 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.

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.
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.
- A dotConnect for PostgreSQL license key. On the licensing page, 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.
Step 2: Add the server to your AI client
In Visual Studio Code, run MCP: Open User Configuration from the Command Palette and add:
{
"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.
Option 2: Windows installer (ODBC)
1. Download and install 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. For all connection string parameters, see the Devart ODBC Driver for PostgreSQL connection string reference.

3. Run your first natural-language query.

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.
Manual installation and configuration
Prerequisites
Before building and running Devart MCP Server for PostgreSQL, ensure the following components are installed:
- .NET 8 SDK
- 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 (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:
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:
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:
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:
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: