postgresql.com
postgresql.com logo

PostgreSQL

Enables secure SQL operations on PostgreSQL databases through a validated API that supports connection management, data...

Created byApr 23, 2025

Postgres MCP

Postgres MCP is a Model Context Protocol (MCP) implementation for PostgreSQL databases. It provides a standardized interface for AI agents to interact with PostgreSQL databases through a set of well-defined commands.

Features

  • Connection Management
  • Database Operations
  • SQL Validation

Installation

Usage

Configuration

Add the following to your MCP configuration file:
or run it in SSE mode:
First, start the postgres-mcp server in SSE mode:
Then, configure the MCP config file to use the SSE mode:
Once you started the postgres-mcp server, you should see the status of the MCP config is green, like this (cursor):
mcp-status
And then you could interact with it via the agent, like this (cursor):
mcp

Commands

Register a Database Connection

Unregister a Connection

Execute a SELECT Query

Insert Data

Update Data

Delete Data

Create a Table

Drop a Table

Create an Index

Drop an Index

Describe a Table

Dependencies

  • Rust 1.70 or later
  • PostgreSQL 12 or later
  • Required Rust crates:

Development

To build from source:

License

MIT license. See LICENSE.md for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

Postgres MCP

Postgres MCP is a Model Context Protocol (MCP) implementation for PostgreSQL databases. It provides a standardized interface for AI agents to interact with PostgreSQL databases through a set of well-defined commands.

Features

  • Connection Management
  • Database Operations
  • SQL Validation

Installation

Usage

Configuration

Add the following to your MCP configuration file:
or run it in SSE mode:
First, start the postgres-mcp server in SSE mode:
Then, configure the MCP config file to use the SSE mode:
Once you started the postgres-mcp server, you should see the status of the MCP config is green, like this (cursor):
mcp-status
And then you could interact with it via the agent, like this (cursor):
mcp

Commands

Register a Database Connection

Unregister a Connection

Execute a SELECT Query

Insert Data

Update Data

Delete Data

Create a Table

Drop a Table

Create an Index

Drop an Index

Describe a Table

Dependencies

  • Rust 1.70 or later
  • PostgreSQL 12 or later
  • Required Rust crates:

Development

To build from source:

License

MIT license. See LICENSE.md for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.