go-mcp-postgres logo

go-mcp-postgres

by guoling2008

Zero burden, ready-to-use Model Context Protocol (MCP) server for interacting with Postgres and automation. No Node.js or Python environment needed.

View on GitHub

Last updated: N/A

What is go-mcp-postgres?

A Model Context Protocol (MCP) server for interacting with Postgres databases. It provides tools to perform CRUD operations and can be configured for read-only mode or with query plan checks.

How to use go-mcp-postgres?

The server can be used via command line arguments in stdio or sse mode. Configuration includes specifying the database DSN and optional flags for language, read-only mode, and explain check.

Key features of go-mcp-postgres

  • CRUD operations on Postgres databases

  • Read-only mode

  • Query plan check using EXPLAIN

  • Multi-language support

  • Schema tools (list, create, alter, describe tables)

  • Data tools (read, write, update, delete, count queries)

Use cases of go-mcp-postgres

  • Automating database interactions

  • Providing a secure interface for LLMs to interact with Postgres

  • Performing read-only queries

  • Managing database schema

  • Executing data manipulation operations

FAQ from go-mcp-postgres

How do I install go-mcp-postgres?

You can download the latest release or build it from source using go install -v github.com/guoling2008/go-mcp-postgres@latest.

How do I configure the database connection?

Use the --dsn flag followed by the Postgres connection string (e.g., postgresql://user:pass@host:port/db).

How do I enable read-only mode?

Add the --read-only flag when starting the server.

How do I disable the EXPLAIN check?

Add the --with-explain-check flag when starting the server.

How do I add my own language support?

Refer to the locales folder and create a new locales/xxx/active-xx.toml file.