mcp-pg-schema logo

mcp-pg-schema

by vinsidious

A Model Context Protocol server that provides read-only access to PostgreSQL databases. This server enables LLMs to inspect database schemas and execute read-only queries.

View on GitHub

Last updated: N/A

What is mcp-pg-schema?

This is a Model Context Protocol (MCP) server designed to provide read-only access to PostgreSQL databases. It allows Large Language Models (LLMs) to inspect database schemas and execute read-only SQL queries.

How to use mcp-pg-schema?

The server can be used with the Claude Desktop app by adding a configuration to the 'mcpServers' section of the claude_desktop_config.json file. It can be run using Docker or NPX, with connection details to the PostgreSQL database provided in the configuration.

Key features of mcp-pg-schema

  • Provides read-only access to PostgreSQL databases

  • Allows LLMs to inspect database schemas

  • Enables execution of read-only SQL queries

  • Automatically discovers table schemas from database metadata

  • Offers a 'query' tool for executing SQL queries within a READ ONLY transaction

Use cases of mcp-pg-schema

  • Allowing LLMs to answer questions based on data in a PostgreSQL database

  • Enabling LLMs to generate reports from PostgreSQL data

  • Providing LLMs with context about the structure of a PostgreSQL database

  • Integrating PostgreSQL data into LLM-powered applications

FAQ from mcp-pg-schema

What is the purpose of this server?

To provide read-only access to PostgreSQL databases for LLMs.

What kind of queries can be executed?

Only read-only SQL queries can be executed.

How do I connect to my database?

By configuring the connection string in the claude_desktop_config.json file, using either Docker or NPX.

Where can I find the table schemas?

The server provides schema information for each table in the database at the postgres://<host>/<table>/schema endpoint.

What license is this server released under?

This MCP server is licensed under the MIT License.