pg-mcp-bridge

pg-mcp-bridge

A local stdio MCP bridge that enables Cursor to interact with a remote PostgreSQL database through a PHP/Apache HTTP tunnel.

Category
Visit Server

README

pg-mcp-bridge (MCP server source)

Local stdio MCP bridge for Cursor and Claude Code so you can talk to a remote PostgreSQL database through a PHP/Apache HTTP tunnel.

Cursor / Claude Code  →  pg-mcp-bridge  →  HTTPS  →  PHP tunnel  →  PostgreSQL

PHP tunnel (required on your server)

Upload the PHP files from https://github.com/Rabin0404/pg-mcp-bridge:

  • pg_mcp_tunnel.php
  • config.example.php → copy to config.php and set DB credentials + bearer token
  • .htaccess (optional; blocks web access to config.php)

See that repo’s README for access_mode (readonly | readwrite | full) and curl test steps.

Claude Code setup

Option A — project .mcp.json

Copy examples/claude.mcp.json to your project root as .mcp.json (or merge into an existing one), then set the env values:

{
  "mcpServers": {
    "remote-postgres": {
      "command": "npx",
      "args": ["-y", "pg-mcp-bridge"],
      "env": {
        "PG_MCP_TUNNEL_URL": "https://your-domain.com/pg_mcp_tunnel.php",
        "PG_MCP_TOKEN": "your-bearer-token"
      }
    }
  }
}

Claude Code also supports ${VAR} expansion, for example:

"env": {
  "PG_MCP_TUNNEL_URL": "${PG_MCP_TUNNEL_URL}",
  "PG_MCP_TOKEN": "${PG_MCP_TOKEN}"
}

Option B — CLI

claude mcp add --transport stdio remote-postgres \
  --env PG_MCP_TUNNEL_URL=https://your-domain.com/pg_mcp_tunnel.php \
  --env PG_MCP_TOKEN=your-bearer-token \
  -- npx -y pg-mcp-bridge

Scopes: local (default), project (shared .mcp.json), or user (all projects). See Claude Code MCP docs.

Verify:

claude mcp list
claude mcp get remote-postgres

Cursor setup

Add to Cursor MCP settings (mcp.json):

{
  "mcpServers": {
    "remote-postgres": {
      "command": "npx",
      "args": ["-y", "pg-mcp-bridge"],
      "env": {
        "PG_MCP_TUNNEL_URL": "https://your-domain.com/pg_mcp_tunnel.php",
        "PG_MCP_TOKEN": "your-bearer-token"
      }
    }
  }
}

Develop locally

npm install
npm run build
node dist/index.js

Environment variables

Variable Required Description
PG_MCP_TUNNEL_URL Yes Full URL to pg_mcp_tunnel.php
PG_MCP_TOKEN Yes Same bearer token as in server config.php

MCP tools

  • ping — connectivity + access_mode
  • list_schemas
  • list_tables
  • describe_table
  • query — SQL allowed by server access_mode

License

MIT

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

E2B

Using MCP to run code via e2b.

Official
Featured