Skip to main content
Glama

go-mcp-postgres

go-mcp-postgres

개요

https://github.com/Zhwt/go-mcp-mysql/ 에서 코드를 복사하고 AI의 도움을 받아 MySQL에서 Postgres로 DB를 변경했습니다. Postgres와의 상호 작용 및 자동화를 위한 부담 없는 즉시 사용 가능한 모델 컨텍스트 프로토콜(MCP) 서버입니다. Node.js나 Python 환경이 필요하지 않습니다. 이 서버는 MySQL 데이터베이스 및 테이블에 대한 CRUD 작업을 수행하는 도구와 예기치 않은 쓰기 작업을 방지하기 위한 읽기 전용 모드를 제공합니다. --with-explain-check 플래그를 추가하여 쿼리 실행 전에 EXPLAIN 문을 사용하여 MCP 서버가 쿼리 계획을 확인하도록 할 수도 있습니다.

이 기능은 현재 진행 중이므로 아직 생산에 사용할 준비가 되지 않았을 수 있습니다.

설치

  1. 최신 릴리스를 받아서 $PATH 나 쉽게 접근할 수 있는 곳에 넣어두세요.
  2. Go가 설치되어 있다면 소스에서 빌드할 수 있습니다.

지엑스피1

용법

방법 A: stdio 모드에 명령줄 인수 사용

{ "mcpServers": { "postgres": { "command": "go-mcp-postgres", "args": [ "--dsn", "postgresql://user:pass@host:port/db" ] } } }

참고: $PATH 외부에 바이너리를 넣은 경우 go-mcp-postgres 바이너리의 전체 경로로 바꿔야 합니다. 예를 들어, 바이너리를 다운로드 폴더에 넣은 경우 다음 경로를 사용할 수 있습니다.

{ "mcpServers": { "postgres": { "command": "C:\\Users\\<username>\\Downloads\\go-mcp-postgres.exe", "args": [ ... ] } } }

방법 B: sse 모드에 명령줄 인수 사용

./go-mcp-postgres --t sse --ip xxxx --port nnnn --dsn postgresql://user@host/db --lang en

선택적 플래그

  • --lang : 언어 옵션(en/zh-CN)을 설정하고, 기본값은 시스템 언어입니다.
  • --read-only 플래그를 추가하여 읽기 전용 모드를 활성화하세요. 이 모드에서는 list , read_ , desc_ 로 시작하는 도구만 사용할 수 있습니다. 이 플래그를 추가한 후에는 MCP 서버를 새로 고치거나 다시 시작하세요.
  • 기본적으로 CRUD 쿼리는 먼저 EXPLAIN ? 문을 사용하여 생성된 쿼리 계획이 예상 패턴과 일치하는지 확인합니다. 이 동작을 비활성화하려면 --with-explain-check 플래그를 추가하세요.

도구

다국어 지원: 모든 도구 설명은 언어 매개변수를 기반으로 자동으로 현지화됩니다.

자체 언어 지원을 추가하려면 [locales](i18n용) 폴더를 참조하세요. 명령줄에서 사용하려면 새 locales/xxx/active-xx.toml 파일을 생성해야 합니다.

스키마 도구

  1. list_database
    • ${mcp.tool.list_database.desc}
    • 매개변수: 없음
    • 반환값: 일치하는 데이터베이스 이름 목록입니다.
  2. list_table
    • ${mcp.tool.list_table.desc}
    • 매개변수:
      • name : 제공된 경우 지정된 이름을 가진 테이블을 나열하고, 그렇지 않은 경우 모든 테이블을 나열합니다.
    • 반환값: 일치하는 테이블 이름 목록입니다.
  3. create_table
    • ${mcp.tool.create_table.desc}
    • 매개변수:
      • query : 테이블을 생성하기 위한 SQL 쿼리입니다.
    • 반환: 영향을 받은 행 x개.
  4. alter_table
    • Postgres 서버의 기존 테이블을 변경합니다. LLM은 기존 테이블이나 열을 삭제하지 않도록 설정됩니다.
    • 매개변수:
      • query : 테이블을 변경하는 SQL 쿼리입니다.
    • 반환: 영향을 받은 행 x개.
  5. desc_table
    • 표의 구조를 설명하세요.
    • 매개변수:
      • name : 설명하려는 테이블의 이름입니다.
    • 반환값: 테이블의 구조.

데이터 도구

  1. read_query
    • 읽기 전용 SQL 쿼리를 실행합니다.
    • 매개변수:
      • query : 실행할 SQL 쿼리입니다.
    • 반환값: 쿼리 결과.
  2. write_query
    • SQL 쿼리를 실행합니다.
    • 매개변수:
      • query : 실행할 SQL 쿼리입니다.
    • 반환값: 영향을 받은 행 x개, 마지막 삽입 ID: <last_insert_id>.
  3. update_query
    • 업데이트 SQL 쿼리를 실행합니다.
    • 매개변수:
      • query : 실행할 SQL 쿼리입니다.
    • 반환: 영향을 받은 행 x개.
  4. delete_query
    • 삭제 SQL 쿼리를 실행합니다.
    • 매개변수:
      • query : 실행할 SQL 쿼리입니다.
    • 반환: 영향을 받은 행 x개.
  5. count_query
    • 특정 테이블의 행 수를 쿼리합니다.
    • 매개변수:
      • name : 계산할 테이블의 이름입니다.
    • 반환값: 테이블의 행 번호.

https://github.com/Zhwt/go-mcp-mysql/ 에 다시 한번 큰 감사를 드립니다.

특허

MIT

-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

go-mcp-postgres란 무엇인가요? go-mcp-postgres는 Postgres 데이터베이스와 상호 작용하도록 설계된 MCP(Model Context Protocol) 서버로, Node.js나 Python 환경 없이도 간편한 CRUD 작업과 자동화를 지원합니다.

  1. 개요
    1. 설치
      1. 용법
        1. 방법 A: stdio 모드에 명령줄 인수 사용
        2. 방법 B: sse 모드에 명령줄 인수 사용
        3. 선택적 플래그
      2. 도구
        1. 스키마 도구
        2. 데이터 도구
      3. 특허

        Related MCP Servers

        • A
          security
          A
          license
          A
          quality
          A beginner-friendly Model Context Protocol (MCP) server that helps users understand MCP concepts, provides interactive examples, and lists available MCP servers. This server is designed to be a helpful companion for developers working with MCP. Also comes with a huge list of servers you can install.
          Last updated -
          3
          9
          36
          JavaScript
          Apache 2.0
        • -
          security
          F
          license
          -
          quality
          A server implementing the Model Context Protocol (MCP) for Cursor that allows using a PostgreSQL database as storage for model contexts, enabling secure database exploration and querying.
          Last updated -
          JavaScript
          • Linux
          • Apple
        • A
          security
          A
          license
          A
          quality
          A dynamic service that creates and manages Model Context Protocol (MCP) servers, allowing users to spawn, customize, and control multiple MCP servers as child processes.
          Last updated -
          5
          65
          TypeScript
          MIT License
          • Apple
          • Linux
        • -
          security
          F
          license
          -
          quality
          A Model Context Protocol server that enables performing PostgreSQL database operations (create, read, update, delete) on User and Post entities through MCP tools.
          Last updated -
          TypeScript

        View all related MCP servers

        MCP directory API

        We provide all the information about MCP servers via our MCP API.

        curl -X GET 'https://glama.ai/api/mcp/v1/servers/guoling2008/go-mcp-postgres'

        If you have feedback or need assistance with the MCP directory API, please join our Discord server