Cloudflare Remote PostgreSQL

Delivers a remote MCP server that connects to PostgreSQL with GitHub OAuth for authentication and controlled write access.
  • typescript

1

GitHub Stars

typescript

Language

6 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "technophile-04-sre-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/mcp-remote",
        "https://mcp-github-oauth.<your-subdomain>.workers.dev/mcp"
      ],
      "env": {
        "NODE_ENV": "development",
        "SENTRY_DSN": "https://example@sentry.io/project",
        "DATABASE_URL": "postgresql://username:password@host:5432/database",
        "GITHUB_CLIENT_ID": "YOUR_CLIENT_ID",
        "GITHUB_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
        "COOKIE_ENCRYPTION_KEY": "YOUR_COOKIE_KEY"
      }
    }
  }
}

You can run a Cloudflare Workers–based MCP server that lets you chat with a PostgreSQL database using GitHub OAuth. This setup gives you read access to your schema and data from any MCP client, with write access tightly controlled for specific GitHub users. It’s designed for secure, scalable access to your database through an MCP interface.

How to use

Authenticate with GitHub to unlock tools for your account. After you sign in, you gain access to read-only tools for exploring your database and, if you have permission, write tools for inserting, updating, or deleting data. You can connect from MCP clients like the Inspector or Claude Desktop using the remote MCP URL and the standard command to start the remote MCP.

How to install

Prerequisites you need before starting:

  • Node.js installed on your machine
  • A Cloudflare account (free tier works)
  • A GitHub account for OAuth setup
  • A PostgreSQL database (local or hosted)

Install the Wrangler CLI globally to manage your Cloudflare Workers and dependencies, then authenticate with Cloudflare.

npm install -g wrangler
wrangler login

Clone the project (or set up your own copy with the same structure) and install dependencies.

git clone https://example.com/your-mcp-project.git
cd your-mcp-project
npm install

Create the environment configuration file from the example and fill in the required secrets and database URL.

cp .dev.vars.example .dev.vars

Set up GitHub OAuth credentials for local development and add them to your environment file.

# In .dev.vars
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret
COOKIE_ENCRYPTION_KEY=your_random_encryption_key
DATABASE_URL=postgresql://username:password@localhost:5432/database_name
SENTRY_DSN=https://your-sentry-dsn@sentry.io/project-id
NODE_ENV=development

Generate a secure cookie encryption key if you don’t have one already.

openssl rand -hex 32

Start the development server to test locally.

wrangler dev

Configuration and security notes

The server uses GitHub usernames to control who can write data to the database. All authenticated users can read data, while a curated set of usernames can perform write operations. SQL injection protection and query validation are built in to help keep your data safe.

Optional monitoring with Sentry is supported. If you enable it, you’ll get error tracking and performance insights for production deployments.

Deployment and runtime details

For production, deploy the MCP server as a Cloudflare Worker and provide the required OAuth and database connection secrets via Wrangler.

The server exposes tools to discover the database schema, run read-only queries, and perform privileged write operations when permitted.

Available tools

listTables

Discover database schema and structure by listing tables and columns in the connected PostgreSQL database.

queryDatabase

Execute read-only SQL queries against the database with read permissions.

executeDatabase

Execute write/DDL operations against the database for privileged users only.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational