npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

db4app-mcp-server

v0.1.9

Published

MCP server for db4.app - enables LLMs to interact with browser-based Postgres databases via Model Context Protocol

Readme

db4app-mcp-server

MCP server for db4.app - enables LLMs to interact with browser-based Postgres databases via Model Context Protocol using the Postgres TCP protocol.

Installation

npm install -g db4app-mcp-server

Or use with npx (no installation needed):

npx db4app-mcp-server

Usage

Important: This MCP server uses the Postgres TCP protocol to connect directly to your browser database, just like psql or other Postgres clients. It uses TLS encryption and password authentication.

With LM Studio

  1. Locate your mcp.json file:

    • macOS: ~/Library/Application Support/LM Studio/mcp.json
    • Windows: %APPDATA%\LM Studio\mcp.json
    • Linux: ~/.config/LM Studio/mcp.json
  2. Get your Connection ID and Auth Token:

    • Open the Database page in your browser
    • Your Connection ID is displayed in the Connection Info section
    • Your Auth Token is also shown in the Connection Info section (this is your password)
  3. Add this to the mcpServers object in your mcp.json:

{
  "mcpServers": {
    "db4app": {
      "command": "npx",
      "args": [
        "-y",
        "[email protected]"
      ],
      "env": {
        "MCP_POSTGRES_URL": "postgres://postgres:YOUR_AUTH_TOKEN@YOUR_CONNECTION_ID.pg.db4.app",
        "LM_STUDIO_EMBEDDING_URL": "http://localhost:1234/v1/embeddings",
        "LM_STUDIO_EMBEDDING_MODEL": "text-embedding-qwen3-embedding-4b",
        "MCP_SCHEMA": "rag_mcp"
      }
    }
  }
}

Note:

  • Replace YOUR_AUTH_TOKEN with your actual auth token from step 2
  • Replace YOUR_CONNECTION_ID with your Connection ID from step 2
  • The connection string format is: postgres://postgres:AUTH_TOKEN@CONNECTION_ID.pg.db4.app
  • Postgres TCP Protocol: This server uses the standard Postgres wire protocol with TLS encryption, just like psql or DBeaver
  1. Install an Embedding Model (Required for RAG features):

    • Open LM Studio → Search tab
    • Search for embedding models (e.g., "bge", "e5", "text-embedding")
    • Download and load an embedding-capable model
    • Update LM_STUDIO_EMBEDDING_MODEL in your mcp.json with the exact model name
    • Enable headless server mode in LM Studio
  2. Restart LM Studio to load the configuration.

With Claude Desktop

  1. Get your Connection ID and Auth Token (same as LM Studio setup above)

  2. Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "db4app": {
      "command": "npx",
      "args": [
        "-y",
        "[email protected]"
      ],
      "env": {
        "MCP_POSTGRES_URL": "postgres://postgres:YOUR_AUTH_TOKEN@YOUR_CONNECTION_ID.pg.db4.app",
        "LM_STUDIO_EMBEDDING_URL": "http://localhost:1234/v1/embeddings",
        "LM_STUDIO_EMBEDDING_MODEL": "text-embedding-qwen3-embedding-4b",
        "MCP_SCHEMA": "rag_mcp"
      }
    }
  }
}

Note:

  • Replace YOUR_AUTH_TOKEN with your actual auth token
  • Replace YOUR_CONNECTION_ID with your Connection ID
  • The connection string format is: postgres://postgres:AUTH_TOKEN@CONNECTION_ID.pg.db4.app

Configuration

All configuration is done via environment variables:

  • MCP_POSTGRES_URL - Required: Postgres connection string. Format: postgres://postgres:AUTH_TOKEN@CONNECTION_ID.pg.db4.app. Get your Connection ID and Auth Token from the Database page → Connection Info section.
  • MCP_CONNECTION_ID - Optional: Browser connection ID. Used to construct connection URL if MCP_POSTGRES_URL is not provided (requires MCP_AUTH_TOKEN).
  • MCP_AUTH_TOKEN - Optional: Auth token for authentication. Used to construct connection URL if MCP_POSTGRES_URL is not provided (requires MCP_CONNECTION_ID).
  • LM_STUDIO_EMBEDDING_URL - LM Studio embedding API endpoint (default: http://localhost:1234/v1/embeddings)
  • LM_STUDIO_EMBEDDING_MODEL - Optional model name for embeddings
  • MCP_SCHEMA - Optional: Schema name for RAG functions (remember, search_memory). Defaults to public. For recipes, set this to the recipe's schema (e.g., rag_mcp).
  • POSTHOG_API_KEY - Optional: PostHog API key for performance tracking. If provided, the server will track query performance metrics (connection time, query time, array sizes, timeouts) to help diagnose performance issues.
  • POSTHOG_HOST - Optional: PostHog host URL (default: https://us.i.posthog.com). Only used if POSTHOG_API_KEY is set.

Note: This MCP server uses the Postgres TCP protocol with TLS encryption, just like standard Postgres clients. No HTTP or RSA-OAEP encryption is used.

Available Tools

  • query_database - Execute SQL queries against the database
  • list_tables - List tables in the database
  • remember - Store information in memory with automatic embedding (uses MCP_SCHEMA for the target schema)
  • search_memory - Search through stored memories using semantic similarity (uses MCP_SCHEMA for the target schema)

Security

This MCP server uses the standard Postgres TCP protocol with:

  • TLS encryption: All connections are encrypted using TLS (same as psql with SSL)
  • Password authentication: Uses the auth token as the password

Note: With password authentication, anyone with the auth token can connect with any Postgres client and access all tables. The security model relies on:

  • Not sharing the auth token
  • Schema isolation (recipes operate in their own schemas)
  • Standard Postgres access control (if you have the password, you have access)

Requirements

  • Node.js 18+
  • Browser tab with db4.app open and relay connected
  • Connection ID and Auth Token from the Database page
  • For RAG features: LM Studio with embedding-capable model loaded

Connection String Format

The connection string follows the standard Postgres URL format:

postgres://postgres:AUTH_TOKEN@CONNECTION_ID.pg.db4.app

Where:

  • postgres is the username (fixed)
  • AUTH_TOKEN is your auth token (password)
  • CONNECTION_ID is your connection ID (hostname)
  • Port defaults to 5432 (standard Postgres port)

License

MIT