pg-mcp-bridge
Allows querying and managing a PostgreSQL database through a PHP tunnel, supporting list schemas, tables, describe table, and SQL queries with configurable access modes (readonly, readwrite, full).
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@pg-mcp-bridgeShow me the structure of the users table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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-bridgePHP tunnel: download from Rabin0404/pg-mcp-bridge and upload to your PHP host
Cursor / Claude Code → pg-mcp-bridge → HTTPS → PHP tunnel → PostgreSQLPHP 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.
Related MCP server: PostgreSQL SSH MCP Server
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-bridgeScopes: local (default), project (shared .mcp.json), or user (all projects). See Claude Code MCP docs.
Verify:
claude mcp list
claude mcp get remote-postgresCursor 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.jsEnvironment variables
Variable | Required | Description |
| Yes | Full URL to |
| Yes | Same bearer token as in server |
MCP tools
ping— connectivity +access_modelist_schemaslist_tablesdescribe_tablequery— SQL allowed by serveraccess_mode
License
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Rabin0404/pg-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server