Skip to main content
Glama

PostgreSQL Multi-Schema MCP Server

PostgreSQL 多模式 MCP 服务器

模型上下文协议 (MLM) 服务器提供对 PostgreSQL 数据库的只读访问,并增强了多模式支持。该服务器使 LLM 能够跨多个命名空间检查数据库模式,并执行只读查询,同时保持模式隔离。

主要特点

  • 多模式支持:通过命令行配置明确指定要公开的模式
  • 模式隔离:服务器启动时仅对列出的授权模式进行严格的访问控制
  • 跨模式发现:跨多个模式的表的统一视图,同时保持模式边界
  • 元数据安全:过滤系统目录以仅公开指定模式中的用户定义表

成分

工具

  • 询问
    • 对连接的数据库执行只读 SQL 查询
    • 输入: sql (字符串):要执行的 SQL 查询
    • 所有查询都在只读事务中执行
    • 通过search_path限制维护的架构上下文

资源

服务器为授权架构中的每个表提供架构信息:

  • 表模式postgres://<host>/<db_schema>/<table>/schema
    • 每个表的 JSON 架构信息
    • 包括列名、数据类型和类型修饰符
    • 从数据库元数据中自动发现
    • 具有显式架构允许列表的多架构支持

用法

服务器需要数据库 URL 并接受以逗号分隔的模式列表来公开:

npx -y mcp-server-postgres-multi-schema <database-url> [schemas]
  • database-url :PostgreSQL 连接字符串(例如, postgresql://localhost/mydb
  • schemas :要公开的模式的逗号分隔列表(如果未指定,则默认为“public”)

示例

# Connect with default public schema npx -y mcp-server-postgres-multi-schema postgresql://localhost/mydb # Connect with multiple schemas npx -y mcp-server-postgres-multi-schema postgresql://localhost/mydb public,analytics,staging

与 Claude Desktop 一起使用

claude_desktop_config.json中配置“mcpServers”部分:

NPX

{ "mcpServers": { "postgres": { "command": "npx", "args": [ "-y", "mcp-server-postgres-multi-schema", "postgresql://localhost/mydb", "public,audit" ] } } }

执照

此多架构 MCP 服务器采用 MIT 许可证。您可以根据 LICENSE 文件中的条款使用、修改和分发该软件。

-
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.

模型上下文协议服务器提供对 PostgreSQL 数据库的只读访问,并增强多模式支持,允许 LLM 检查跨多个命名空间的数据库模式并执行只读查询,同时保持模式隔离。

  1. 主要特点
    1. 成分
      1. 工具
      2. 资源
    2. 用法
      1. 示例
    3. 与 Claude Desktop 一起使用
      1. NPX
    4. 执照

      Related MCP Servers

      • -
        security
        A
        license
        -
        quality
        A Model Context Protocol server providing LLMs read-only access to PostgreSQL databases for inspecting schemas and executing queries.
        Last updated -
        16,948
        17
        JavaScript
        MIT License
        • Apple
      • -
        security
        F
        license
        -
        quality
        A Model Context Protocol server providing both read and write access to PostgreSQL databases, enabling LLMs to query data, modify records, and manage database schemas.
        Last updated -
        4
        JavaScript
      • -
        security
        F
        license
        -
        quality
        A Model Context Protocol server that enables interaction with PostgreSQL databases to list tables, retrieve schemas, and execute read-only SQL queries.
        Last updated -
        16,948
        JavaScript
        • Linux
        • Apple
      • -
        security
        F
        license
        -
        quality
        A Model Context Protocol server that provides LLMs with full read-write access to PostgreSQL databases, allowing both querying and modifying database content with transaction management and safety controls.
        Last updated -
        84
        7
        TypeScript
        • Apple

      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/HarjjotSinghh/mcp-server-postgres-multi-schema'

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