agr_postgres_mcp

agr_postgres_mcp

Enables interaction with PostgreSQL databases via psql, supporting SQL queries, table management, and database insights.

Category
Visit Server

README

agr_postgres_mcp

MCP server for interacting with PostgreSQL databases via psql. Designed for use with Claude Code as a Model Context Protocol (MCP) server.

Configuration

The server is configured entirely through environment variables:

Variable Required Default Description
PG_HOST Yes — PostgreSQL hostname
PG_USER No postgres Database username
PG_PASSWORD Yes — Database password
PG_DATABASE Yes — Database name
PG_PORT No 5432 Database port
PG_SERVER_NAME No postgres MCP server name (used in logs and tool prefixes)
PSQL_PATH No auto-detect Full path to the psql binary

If PSQL_PATH is not set, the server searches common locations:

  • /opt/homebrew/opt/postgresql@15/bin/psql
  • /opt/homebrew/opt/postgresql@13/bin/psql
  • /Applications/Postgres.app/Contents/Versions/15/bin/psql
  • /Applications/Postgres.app/Contents/Versions/14/bin/psql
  • /usr/local/bin/psql
  • /usr/bin/psql

Tools

Tool Description
query Execute arbitrary SQL with configurable output format (table/csv/expanded) and timeout
list_tables List all tables in a schema
describe_table Describe a table's columns, types, constraints, and indexes (\d+ equivalent)
list_indexes List indexes, optionally filtered by table
table_sizes Show table sizes (data, index, total) sorted by size
table_stats Show live/dead tuples, last vacuum/analyze times
active_connections Show active database connections from pg_stat_activity
locks Show current locks with blocking information
explain Show query execution plan (EXPLAIN / EXPLAIN ANALYZE)
database_size Show total database size and object counts
row_counts Estimated row counts for all tables
foreign_keys List foreign key constraints, optionally filtered by table
index_usage Index scan statistics for identifying unused indexes
schema_search Search for tables or columns by LIKE pattern

Setup

npm install
npm run build

MCP Configuration

Add an entry to .mcp.json for each database instance:

{
  "mcpServers": {
    "pg-alpha": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/agr_postgres_mcp/dist/index.js"],
      "env": {
        "PG_SERVER_NAME": "alpha",
        "PG_HOST": "your-db-host.example.com",
        "PG_USER": "postgres",
        "PG_PASSWORD": "your-password",
        "PG_DATABASE": "your-database",
        "PSQL_PATH": "/path/to/psql"
      }
    }
  }
}

Multiple instances can be configured by adding additional entries with different PG_SERVER_NAME and PG_HOST values.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured