# remote postgres mcp

> Deploy a PHP PostgreSQL MCP tunnel and connect Cursor or Claude Code to a remote database over HTTPS.

remote postgres mcp is a paid AI agent skill on Agensi by Rabindra Maharjan, in LLM Ops. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $10 (one-time purchase)
- Creator: [Rabindra Maharjan](https://www.agensi.io/creators/rabin)
- Category: [LLM Ops](https://www.agensi.io/skills/llm-ops)
- Version: 1.0
- Last updated: 2026-11-24
- Security: scan passed (2026-11-24); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/remote-postgres-mcp
- Tags: postgresql, mcp, cursor, claude-code, php, database

## About this skill

Connecting an AI agent to a remote database often fails due to firewall restrictions or lack of Node.js support on shared hosting. This skill provides a secure bridge between Cursor or Claude Code and PostgreSQL using a PHP-based HTTP tunnel.

### What it does
- **Deploy tunnel architecture** by setting up the `pg-mcp-bridge` PHP component on any Apache/PHP server to act as a secure gateway.
- **Configure access levels** by defining granular `readonly`, `readwrite`, or `full` permissions to protect your data.
- **Automate client setup** by generating the precise JSON or CLI configurations for Cursor and Claude Code.
- **Verify connectivity** using built-in ping and diagnostic tools to ensure the HTTPS bridge and bearer auth are functional.
- **Enforce security hardening** with `.htaccess` rules and token-based authentication to prevent unauthorized database access.

### How it works
1. **Environment Check**: The skill verifies your server has the `pgsql` extension and HTTPS enabled.
2. **Tunnel Deployment**: You receive the necessary `pg_mcp_tunnel.php` and `config.php` templates for your server.
3. **Verification**: A Python or curl-based ping test validates the tunnel is active and the token is valid.
4. **Client Integration**: The skill provides the `npx` command and environment variables for your specific IDE or CLI tool.

### Frameworks & tools
This skill utilizes PHP and Apache for the server-side tunnel. It integrates with the `pg-mcp-bridge` NPM package and is compatible with PostgreSQL databases. It supports Cursor and Claude Code via the Model Context Protocol (MCP).

### Why this beats prompting it yourself
Manual setup often leads to broken environment variables or insecure configuration files. This skill follows a strict security checklist and architecture pattern that ensures your database credentials never leak into your git history or chat logs.

### Use cases
- Querying a production or staging database directly from your AI code editor.
- Connecting AI agents to databases hosted on PHP-only shared hosting environments.
- Developing database-driven features with real-time schema awareness in Claude Code.
- Securely exposing a remote Postgres instance to local MCP clients over HTTPS.

### Known limitations
The tunnel enforces a limit of one SQL statement per query call. You must have the PHP pgsql extension installed on your hosting provider.

## Requires

- Pg Bridge MCP
- Node.js

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the remote postgres mcp skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### How does this skill solve the problem of connecting AI agents to remote databases?

This skill allows AI agents to interact with PostgreSQL databases behind firewalls or on shared hosting where Node.js isn't available, using a PHP-based bridge to bypass traditional connection hurdles.

### Which AI agents and IDEs are compatible with this MCP bridge?

The skill is specifically designed for Cursor and Claude Code, utilizing the Model Context Protocol (MCP) to provide these tools with real-time schema awareness and query capabilities.

### What are the server-side requirements for the PHP tunnel to function?

It requires a remote server running Apache/PHP with the `pgsql` extension enabled and an active HTTPS certificate to ensure secure data transmission.

### How does the skill ensure my database credentials remain secure?

Security is managed through token-based bearer authentication and server-side `.htaccess` hardening to ensure only authorized MCP clients can access your database.

### What exactly is included in the purchase of this skill?

You receive the PHP tunnel and configuration templates, step-by-step deployment instructions, and the precise JSON/CLI configurations needed to link your AI tools to the bridge.

### Are there any specific limitations to the types of queries the AI can perform?

While powerful for schema exploration and data manipulation, the tunnel is restricted to one SQL statement per call to maintain security and stability.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
