Postgresql Sharp MCP logo

Postgresql Sharp MCP

by @codegiveness

Discover PostgreSQL databases, inspect schemas, run bounded SQL, review plans, analyze indexes, and check database health over MCP.

Install Postgresql Sharp MCP

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "codegiveness-postgresql-sharp-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "--allow-scripts=@codegiveness/postgresql-sharp-mcp",
        "@codegiveness/postgresql-sharp-mcp@0.7.1"
      ],
      "env": {
        "POSTGRES_DATABASE_LOCK_MODE": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

Claude Code command
claude mcp add --env POSTGRES_DATABASE_LOCK_MODE=YOUR_VALUE_HERE --transport stdio codegiveness-postgresql-sharp-mcp -- npx -y --allow-scripts=@codegiveness/postgresql-sharp-mcp @codegiveness/postgresql-sharp-mcp@0.7.1

Run in your terminal. Add --scope project to share it with your team through .mcp.json.

We couldn’t confirm it starts correctly

We hit an unexpected error while testing this listing automatically.

npx -y --allow-scripts=@codegiveness/postgresql-sharp-mcp @codegiveness/postgresql-sharp-mcp@0.7.1

Rate limit exceeded, please try again later - you have reached the maximum number of concurrent E2B sandboxes (20). If you need more, please visit 'https://e2b.dev/docs/billing'

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

@codegiveness/postgresql-sharp-mcp connects MCP-compatible AI assistants and coding agents to PostgreSQL through a local stdio process. It discovers databases and schema objects, executes parameterized SQL, explains queries, analyzes indexes, reports top queries, and checks database health. SQL execution is read-only by default, with explicitly requested writes allowed by the default access mode. The package can run through npx with a bundled .NET runtime, or through a .NET tool or standalone archive.

Use cases

  • Browse accessible PostgreSQL databases and schemas
  • Inspect table columns, indexes, constraints, and triggers
  • Run parameterized read-only SQL queries
  • Investigate slow queries with execution plans
  • Review index usage and database health

Key features

  • Live PostgreSQL database and schema discovery
  • Bounded, paginated tool results
  • Parameterized SQL with read-only default behavior
  • Query plans with optional HypoPG indexes
  • Index, query-statistics, and health analysis
  • Bundled .NET runtime for npm installation

Tools9

What Postgresql Sharp MCP lets your agent do. Expand a tool for its parameters.

Self-reported~173 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

6/6 checks healthy over the last 23d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 6d ago via OSV.dev · @codegiveness/postgresql-sharp-mcp@0.7.1 (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars1Stargazers on the source repository.
npm downloads879Package downloads in the last 30 days.
Last commit8d agoMost recent push to the default branch.
Install checkInconclusiveWe hit an unexpected error running the automated check.
Tools exposed9Callable tools this server registers over MCP.

How Postgresql Sharp MCP works

What @codegiveness/postgresql-sharp-mcp does

@codegiveness/postgresql-sharp-mcp exposes PostgreSQL administration and query-inspection functions as MCP tools. It is aimed at developers, DBAs, and data engineers who already have access to a PostgreSQL database and want an AI assistant or coding agent to inspect and work with it.

The server can enumerate accessible databases, browse schemas and objects, retrieve details for tables and other database objects, execute SQL, inspect query plans, review index usage, rank statements from query statistics, and examine database health. It connects to an existing PostgreSQL installation; it does not provision a database.

SQL calls use read-only behavior by default. The default access mode permits explicitly requested writes, so a least-privileged login and deliberate access restrictions are appropriate for shared or production data.

How it works

An MCP client starts the application as a local stdio server. The server uses a PostgreSQL connection string supplied during client setup, then sends tool results back to the assistant. Results are bounded by rows and bytes rather than returned without limit. Larger responses can be continued with the returned next_offset value.

The discovery tools support targeted database, schema, and object selection. Object inspection can focus on columns, constraints, indexes, triggers, definitions, or parameters. SQL parameters map to PostgreSQL $1 through $n placeholders. Query plans can be returned as a summary or JSON, with optional analysis and hypothetical indexes when HypoPG is available. Query ranking can use total time, mean time, call count, rows, or reads; health checks cover areas such as vacuum, indexes, constraints, sequences, replication, and blocking.

Setup and configuration

The quickest installation uses Node.js 22 or newer and npm. Running the package with npx installs the platform-specific package and bundles the .NET runtime, so the resulting server does not require a separate .NET installation or runtime download. The installed native command also runs without Node.js after setup.

A global .NET tool installation is another option, but it requires the .NET 10 runtime and SDK. Standalone archives are available for Linux x64 and ARM64, macOS x64 and ARM64, and Windows x64; these archives include the runtime and do not require Node.js, npm, or the .NET SDK.

Register the resulting command with an MCP client and provide a connection string for an existing PostgreSQL database. The server supports Linux, macOS, and Windows. Use --validate to check configuration and receive advisory warnings. POSTGRES_DATABASE_LOCK_MODE=strict preserves strict database-lock behavior for installations that need it.

Tools and capabilities

  • list_databases enumerates accessible databases with bounded selection.
  • list_schemas and list_objects browse schemas and database objects, including optional system-object filtering and search.
  • get_object_details returns selected metadata sections such as columns, constraints, indexes, triggers, definitions, and parameters.
  • execute_sql runs SQL with $1-style parameter values and a read-only control.
  • explain_query returns summary or JSON plans, with optional analysis and HypoPG indexes.
  • analyze_indexes examines indexes for a selected table.
  • get_top_queries orders query statistics by time, calls, rows, or reads.
  • analyze_db_health checks selected database-health areas, including vacuum, blocking, and replication.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Postgresql Sharp MCP

@codegiveness/postgresql-sharp-mcp is an MCP server that connects AI assistants and coding agents to existing PostgreSQL databases. Its main tools discover databases and schemas, inspect objects, execute parameterized SQL, explain queries, analyze indexes, rank top queries, and check database health through a local stdio process.

Install it with npx, a .NET tool, or a standalone archive. The npx package requires Node.js 22+ and npm and bundles the .NET runtime; the .NET tool requires the .NET 10 runtime and SDK. Archives include the runtime for supported Linux, macOS, and Windows platforms.

Yes, SQL calls are read-only by default. The default access mode permits explicitly requested writes, so use a least-privileged PostgreSQL login and configure stricter access boundaries when writes must be refused entirely.

Results are bounded by both row count and byte size. Tool responses provide a `next_offset` value so an MCP client can request subsequent pages instead of receiving an unbounded result.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewPostgresql Sharp MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/codegiveness-postgresql-sharp-mcp?style=directory)](https://allmcps.com/mcp/codegiveness-postgresql-sharp-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/codegiveness-postgresql-sharp-mcp"><img src="https://allmcps.com/api/badge/codegiveness-postgresql-sharp-mcp?style=directory" alt="Postgresql Sharp MCP on AllMCPs" /></a>