
postgres mcp go
一个用 Go 编写的 PostgreSQL 模型上下文协议 (MCP) 服务器,支持只读查询和表结构导出。
Repository Info
About This Server
一个用 Go 编写的 PostgreSQL 模型上下文协议 (MCP) 服务器,支持只读查询和表结构导出。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
PostgreSQL MCP Server in Go
A Go implementation of a Model Context Protocol (MCP) server for PostgreSQL. This server enables LLMs to inspect database schemas and execute read-only queries against PostgreSQL databases.
Features
- Exposes PostgreSQL table schemas as resources
- Provides a tool to execute read-only SQL queries
- Uses sqlx for PostgreSQL connectivity
- Built with the mcp-go library
Installation
go install github.com/iwanbk/postgres-mcp-go@latest
Or build from source:
git clone https://github.com/iwanbk/postgres-mcp-go.git
cd postgres-mcp-go
go build -v
Usage
Run the server by providing a PostgreSQL connection URL using the -database_url flag:
postgres-mcp-go -database_url=postgresql://username:password@localhost/mydb
You can also view available options with the help flag:
postgres-mcp-go -help
Resources
The server provides schema information for each table in the database:
postgres://<host>/<table>/schema- JSON schema information for each table- Includes column names and data types
- Automatically discovered from database metadata
Tools
query- Execute read-only SQL queries against the connected database- Input:
sql(string): The SQL query to execute - All queries are executed within a READ ONLY transaction
- Input:
Security
This server only allows read-only operations. All queries are executed within a READ ONLY transaction to prevent any data modification.
License
MIT
Quick Start
Clone the repository
git clone https://github.com/iwanbk/postgres-mcp-goInstall dependencies
cd postgres-mcp-go
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.