Cover image
Try Now
2025-04-09

ENCORT DE LA BURDE ZERO, PROTOCOLOLE DE CONTEXION PRÊT À UTILISATION (MCP) pour interagir avec PostgreSQL et Automation avec le mode SSE / STDIO et la prise en charge I18N

3 years

Works with Finder

1

Github Watches

1

Github Forks

4

Github Stars

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

  1. Get the latest release and put it in your $PATH or somewhere you can easily access.

  2. 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 with list, read_ and desc_ 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

  1. list_database

    • ${mcp.tool.list_database.desc}
    • Parameters: None
    • Returns: A list of matching database names.
  2. 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.
  3. create_table

    • ${mcp.tool.create_table.desc}
    • Parameters:
      • query: The SQL query to create the table.
    • Returns: x rows affected.
  4. 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.
  5. 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

  1. read_query

    • Execute a read-only SQL query.
    • Parameters:
      • query: The SQL query to execute.
    • Returns: The result of the query.
  2. write_query

    • Execute a write SQL query.
    • Parameters:
      • query: The SQL query to execute.
    • Returns: x rows affected, last insert id: <last_insert_id>.
  3. update_query

    • Execute an update SQL query.
    • Parameters:
      • query: The SQL query to execute.
    • Returns: x rows affected.
  4. delete_query

    • Execute a delete SQL query.
    • Parameters:
      • query: The SQL query to execute.
    • Returns: x rows affected.
  5. 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

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Yasir Eryilmaz
  • AI scriptwriting assistant for short, engaging video content.

  • J. DE HARO OLLE
  • Especialista en juegos de palabras en varios idiomas.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • apappascs
  • Découvrez la collection la plus complète et la plus à jour de serveurs MCP sur le marché. Ce référentiel sert de centre centralisé, offrant un vaste catalogue de serveurs MCP open-source et propriétaires, avec des fonctionnalités, des liens de documentation et des contributeurs.

  • ShrimpingIt
  • Manipulation basée sur Micropython I2C de l'exposition GPIO de la série MCP, dérivée d'Adafruit_MCP230XX

  • huahuayu
  • Une passerelle API unifiée pour intégrer plusieurs API d'explorateur de blockchain de type étherscan avec la prise en charge du protocole de contexte modèle (MCP) pour les assistants d'IA.

  • deemkeen
  • Contrôlez votre MBOT2 avec un combo d'alimentation: MQTT + MCP + LLM

  • zhaoyunxing92
  • 本项目是一个钉钉 MCP (Protocole de connecteur de message) 服务 , 提供了与钉钉企业应用交互的 API 接口。项目基于 Go 语言开发 , 支持员工信息查询和消息发送等功能。

  • pontusab
  • La communauté du curseur et de la planche à voile, recherchez des règles et des MCP

    Reviews

    3 (1)
    Avatar
    user_fHKh6RH6
    2025-04-16

    I recently started using the OBS MCP Server by royshil and I'm thoroughly impressed. The setup was seamless, and it integrates perfectly with my workflow. The server is incredibly stable and offers excellent performance for live streaming and video recording. Highly recommended for anyone looking for a reliable OBS management solution!