pg-mcp-bridge
A local stdio MCP bridge that enables Cursor to interact with a remote PostgreSQL database through a PHP/Apache HTTP tunnel.
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.
- This repo: Node MCP bridge source → published as npm
pg-mcp-bridge - PHP tunnel: download from Rabin0404/pg-mcp-bridge and upload to your PHP host
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.phpconfig.example.php→ copy toconfig.phpand set DB credentials + bearer token.htaccess(optional; blocks web access toconfig.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_modelist_schemaslist_tablesdescribe_tablequery— SQL allowed by serveraccess_mode
License
MIT
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
E2B
Using MCP to run code via e2b.