Postgres
what is go-mcp-postgres? go-mcp-postgres is a Model Context Protocol (MCP) server designed for interacting with Postgres databases, allowing for easy CRUD operations and automation without the need for a Node.js or Python environment.
guoling2008
README
go-mcp-postgres
Overview
Copy code from https://github.com/Zhwt/go-mcp-mysql/ and with AI help, I change db from mysql to postgres.
Zero burden, ready-to-use Model Context Protocol (MCP) server for interacting with Postgres and automation. No Node.js or Python environment needed. This server provides tools to do CRUD operations on MySQL databases and tables, and a read-only mode to prevent surprise write operations. You can also make the MCP server check the query plan by using a EXPLAIN
statement before executing the query by adding a --with-explain-check
flag.
Please note that this is a work in progress and may not yet be ready for production use.
Installation
-
Get the latest release and put it in your
$PATH
or 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
Usage
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 replace go-mcp-postgres
with the full path to the binary: e.g.: if you put the binary in the Downloads folder, 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
Optional Flags
--lang
: Set language option (en/zh-CN), defaults to system language- Add a
--read-only
flag 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 a
EXPLAIN ?
statement to check whether the generated query plan matches the expected pattern. Add a--with-explain-check
flag to disable this behavior.
Tools
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](for i18n) folder. The new locales/xxx/active-xx.toml file should be created if you want to use it in command line.
Schema Tools
-
list_database
- ${mcp.tool.list_database.desc}
- Parameters: None
- Returns: A list of matching database names.
-
list_table
- ${mcp.tool.list_table.desc}
- Parameters:
name
: If provided, list tables with the specified name, Otherwise, list all tables.
- Returns: A list of matching table names.
-
create_table
- ${mcp.tool.create_table.desc}
- Parameters:
query
: The SQL query to create the table.
- Returns: x rows affected.
-
alter_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.
- Returns: x rows affected.
-
desc_table
- Describe the structure of a table.
- Parameters:
name
: The name of the table to describe.
- Returns: The structure of the table.
Data Tools
-
read_query
- Execute a read-only SQL query.
- Parameters:
query
: The SQL query to execute.
- Returns: The result of the query.
-
write_query
- Execute a write SQL query.
- Parameters:
query
: The SQL query to execute.
- Returns: x rows affected, last insert id: <last_insert_id>.
-
update_query
- Execute an update SQL query.
- Parameters:
query
: The SQL query to execute.
- Returns: x rows affected.
-
delete_query
- Execute a delete SQL query.
- Parameters:
query
: The SQL query to execute.
- Returns: x rows affected.
-
count_query
- Query the number of rows in a certain table..
- Parameters:
name
: The name of the table to count.
- Returns: The row number of the table.
Big thanks to https://github.com/Zhwt/go-mcp-mysql/ again.
License
MIT
Recommended Servers

Supabase MCP Server
A Model Context Protocol (MCP) server that provides programmatic access to the Supabase Management API. This server allows AI models and other clients to manage Supabase projects and organizations through a standardized interface.
MCP DuckDB Knowledge Graph Memory Server
A memory server for Claude that stores and retrieves knowledge graph data in DuckDB, enhancing performance and query capabilities for conversations with persistent user information.
dbt Semantic Layer MCP Server
A server that enables querying the dbt Semantic Layer through natural language conversations with Claude Desktop and other AI assistants, allowing users to discover metrics, create queries, analyze data, and visualize results.
Metabase MCP Server
Enables AI assistants to interact with Metabase databases and dashboards, allowing users to list and execute queries, access data visualizations, and interact with database resources through natural language.

Airtable MCP Server
A Model Context Protocol server that provides tools for programmatically managing Airtable bases, tables, fields, and records through Claude Desktop or other MCP clients.
mcp-shodan
MCP server for querying the Shodan API and Shodan CVEDB. This server provides tools for IP lookups, device searches, DNS lookups, vulnerability queries, CPE lookups, and more.
Verodat MCP Server
An MCP server that integrates Verodat's data management capabilities with AI systems like Claude Desktop, enabling users to manage accounts, workspaces, and datasets, as well as perform AI-powered queries on their data.

Tembo MCP Server
An MCP server that enables Claude to interact with Tembo Cloud platform API, allowing users to manage Tembo Cloud resources through natural language.
MongoDB MCP Server
Provides read-only access to MongoDB databases for LLMs to inspect collection schemas and execute aggregation pipelines.
nile-mcp
MCP server for Nile Database - Manage and query databases, tenants, users, auth using LLMs