iwanbk
MCP Serveriwanbkpublic

postgres mcp go

一个用 Go 编写的 PostgreSQL 模型上下文协议 (MCP) 服务器,支持只读查询和表结构导出。

Repository Info

0
Stars
0
Forks
0
Watchers
0
Issues
Go
Language
-
License

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

Go CI

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

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

1

Clone the repository

git clone https://github.com/iwanbk/postgres-mcp-go
2

Install dependencies

cd postgres-mcp-go
npm install
3

Follow the documentation

Check the repository's README.md file for specific installation and usage instructions.

Repository Details

Owneriwanbk
Repopostgres-mcp-go
LanguageGo
License-
Last fetched8/10/2025

Recommended MCP Servers

💬

Discord MCP

Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.

integrationsdiscordchat
🔗

Knit MCP

Connect AI agents to 200+ SaaS applications and automate workflows.

integrationsautomationsaas
🕷️

Apify MCP Server

Deploy and interact with Apify actors for web scraping and data extraction.

apifycrawlerdata
🌐

BrowserStack MCP

BrowserStack MCP Server for automated testing across multiple browsers.

testingqabrowsers

Zapier MCP

A Zapier server that provides automation capabilities for various apps.

zapierautomation