PostgreSQL
About
Enables secure interaction with PostgreSQL databases for schema management and CRUD operations with safety features like read-only mode and query plan validation
Details
- Author
- guoling2008
- Repository
- guoling2008/go-mcp-postgres
- GitHub stars
- 4
- License
- MIT License
- Categories
- Database, Other, Productivity, Design, Developer Tools, Search, Frontend, Infrastructure, Project Management
Jump to
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
PostgreSQLCommand (node, npx, python, etc.)npxArguments-
Argument 1
-y -
Argument 2
@highlight/mcp-server
Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
-
Argument 1
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
list_database
Returns a list of matching database names. Parameters: None
list_table
Returns a list of matching table names. Parameters: name (optional string) - If provided, list tables with the specified name, otherwise, list all tables.
create_table
Creates a new table in the database. Parameters: query (string) - The SQL query to create the table. Returns: x rows affected.
alter_table
Alters an existing table in the Postgres server. Parameters: query (string) - The SQL query to alter the table. Returns: x rows affected.
desc_table
Describes the structure of a table. Parameters: name (string) - The name of the table to describe. Returns: The structure of the table.
read_query
Executes a read-only SQL query. Parameters: query (string) - The SQL query to execute. Returns: The result of the query.
write_query
Executes a write SQL query. Parameters: query (string) - The SQL query to execute. Returns: x rows affected, last insert id: <last_insert_id>.
update_query
Executes an update SQL query. Parameters: query (string) - The SQL query to execute. Returns: x rows affected.
delete_query
Executes a delete SQL query. Parameters: query (string) - The SQL query to execute. Returns: x rows affected.
count_query
Queries the number of rows in a certain table. Parameters: name (string) - The name of the table to count. Returns: The row number of the table.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"postgresql": {
"env": {},
"args": [
"-y",
"@highlight/mcp-server"
],
"command": "npx"
}
}
}
Linux
{
"env": [],
"args": [
"-y",
"@highlight/mcp-server"
],
"command": "npx"
}
Macos
{
"env": [],
"args": [
"-y",
"@highlight/mcp-server"
],
"command": "npx"
}
Windows
{
"env": [],
"args": [
"/c",
"npx",
"-y",
"@highlight/mcp-server"
],
"command": "cmd"
}
Please note that this is a work in progress and may not yet be ready for production use.
-
Get the latestreleaseand put it in your$PATHor somewhere you can easily access.
Or if you have Go installed, you can build it from source:
go install -v github.com/guoling2008/go-mcp-postgres@latest
Method A: Using Command Line Arguments for stdio mode
{ "mcpServers": { "postgres": { "command": "go-mcp-postgres", "args": [ "--dsn", "postgresql://user:pass@host:port/db" ] } } }
Note: For those who put the binary outside of your$PATH, you need to replacego-mcp-postgreswith the full path to the binary: e.g.: if you put the binary in theDownloadsfolder, you may use the following path:
{ "mcpServers": { "postgres": { "command": "C:\\Users\\<username>\\Downloads\\go-mcp-postgres.exe", "args": [ ... ] } } }
Method B: Using Command Line Arguments for sse mode
./go-mcp-postgres --t sse --ip x.x.x.x --port nnnn --dsn postgresql://user:pass@host:port/db --lang en
- --lang: Set language option (en/zh-CN), defaults to system language
- Add a--read-onlyflag to enable read-only mode. In this mode, only tools beginning withlist,read_anddesc_are available. Make sure to refresh/restart the MCP server after adding this flag.
- By default, CRUD queries will be first executed with aEXPLAIN ?statement to check whether the generated query plan matches the expected pattern. Add a--with-explain-checkflag to disable this behavior.
Multi-language support: All tool descriptions will automatically localize based on lang parameter
If you want to add your own language support, please refer to the locales folder. The new locales/xxx/active-xx.toml file should be created if you want to use it in command line.
- ${mcp.tool.list_database.desc}
- Parameters: None
- Returns: A list of matching database names.
- ${mcp.tool.list_table.desc}
- Parameters:
- name: If provided, list tables with the specified name, Otherwise, list all tables.
- ${mcp.tool.create_table.desc}
- Parameters:
- query: The SQL query to create the table.
- Alter an existing table in the Postgres server. The LLM is informed not to drop an existing table or column.
- Parameters:
- query: The SQL query to alter the table.
- Describe the structure of a table.
- Parameters:
- name: The name of the table to describe.
- Execute a read-only SQL query.
- Parameters:
- query: The SQL query to execute.
- Execute a write SQL query.
- Parameters:
- query: The SQL query to execute.
- Execute an update SQL query.
- Parameters:
- query: The SQL query to execute.
- Execute a delete SQL query.
- Parameters:
- query: The SQL query to execute.
- Query the number of rows in a certain table..
- Parameters:
- name: The name of the table to count.
Big thanks tohttps://github.com/Zhwt/go-mcp-mysql/again.
Multi-database agent access (PostgreSQL, SQLite, MySQL, Oracle, SQL Server) with batch queries, pre-configured connections, and SQLGlot-enforced read-only safety
A read-only MCP server for querying AWS PostgreSQL databases.
A read-only MCP server for AlloyDB, enabling LLMs to query live data directly from AlloyDB databases.
A read-only MCP server by CData that enables LLMs to query live data from EnterpriseDB databases.
A server for direct interaction with CockroachDB databases.
Database MCP server for MySQL, MariaDB, PostgreSQL & SQLite
A single-binary MCP server for MySQL, MariaDB, PostgreSQL, and SQLite
A Model Context Protocol (MCP) server that provides multi-database query execution capabilities with support for SQLite, PostgreSQL, and MySQL databases. Includes a built-in Web UI for managing database connections.
Update various databases (PostgreSQL, MySQL, MongoDB, SQLite) using data from CSV and Excel files.
Expert-level PostgreSQL database analysis MCP server for AI assistants.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





