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

orcaq-mcp

v1.0.1

Published

OrcaQ MCP Server — Connect AI agents to PostgreSQL databases with powerful schema introspection, query execution, and database management tools

Downloads

226

Readme


orcaq-mcp is a Model Context Protocol (MCP) server that gives AI agents full access to PostgreSQL databases — schema introspection, query execution, performance analysis, and database management, all through a standardized tool interface.

Built by the OrcaQ team. Full TypeScript. Zero config friction.

Features

  • 22 powerful tools for complete database interaction
  • Schema introspection — tables, views, functions, columns, foreign keys, indexes
  • Query execution — safe read-only queries + confirmed mutations
  • Performance analysis — EXPLAIN ANALYZE, active queries, database stats
  • Database management — roles, databases, RLS policies, triggers
  • Connection options — connection string, individual params, SSL, SSH tunnels
  • Secure by default — read queries are separated from mutations, mutations require explicit confirmation
  • Full TypeScript — exported types for programmatic use

Quick Start

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "orcaq": {
      "command": "npx",
      "args": ["-y", "orcaq-mcp"],
      "env": {
        "DATABASE_URL": "postgres://user:password@localhost:5432/mydb"
      }
    }
  }
}

Cursor

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "orcaq": {
      "command": "npx",
      "args": ["-y", "orcaq-mcp"],
      "env": {
        "DATABASE_URL": "postgres://user:password@localhost:5432/mydb"
      }
    }
  }
}

VS Code (GitHub Copilot)

Add to .vscode/mcp.json:

{
  "servers": {
    "orcaq": {
      "command": "npx",
      "args": ["-y", "orcaq-mcp"],
      "env": {
        "DATABASE_URL": "postgres://user:password@localhost:5432/mydb"
      }
    }
  }
}

Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "orcaq": {
      "command": "npx",
      "args": ["-y", "orcaq-mcp"],
      "env": {
        "DATABASE_URL": "postgres://user:password@localhost:5432/mydb"
      }
    }
  }
}

Command Line

# Via connection string
npx orcaq-mcp --connection-string "postgres://user:pass@localhost:5432/mydb"

# Via environment variable
DATABASE_URL="postgres://user:pass@localhost/mydb" npx orcaq-mcp

# Via individual parameters
npx orcaq-mcp --host localhost --port 5432 --database mydb --username user --password pass

Connection Configuration

Environment Variables

| Variable | Description | Default | | --- | --- | --- | | DATABASE_URL | Full PostgreSQL connection URL | — | | PGHOST | Database host | — | | PGPORT | Database port | 5432 | | PGDATABASE | Database name | — | | PGUSER | Username | — | | PGPASSWORD | Password | — | | SSL_MODE | SSL mode: disable, require, verify-ca, verify-full | disable | | SSH_HOST | SSH tunnel host | — | | SSH_PORT | SSH tunnel port | 22 | | SSH_USERNAME | SSH username | — | | SSH_PASSWORD | SSH password | — | | SSH_PRIVATE_KEY | SSH private key (raw content) | — |

CLI Arguments

--connection-string   Full PostgreSQL connection URL
--host                Database host
--port                Database port (default: 5432)
--database            Database name
--username            Username
--password            Password
--ssl-mode            SSL mode
--help                Show help

Priority: CLI arguments > Environment variables

SSL Connection

{
  "mcpServers": {
    "orcaq": {
      "command": "npx",
      "args": ["-y", "orcaq-mcp"],
      "env": {
        "PGHOST": "db.example.com",
        "PGPORT": "5432",
        "PGDATABASE": "production",
        "PGUSER": "readonly_user",
        "PGPASSWORD": "secret",
        "SSL_MODE": "require"
      }
    }
  }
}

SSH Tunnel

{
  "mcpServers": {
    "orcaq": {
      "command": "npx",
      "args": ["-y", "orcaq-mcp"],
      "env": {
        "PGHOST": "10.0.0.5",
        "PGPORT": "5432",
        "PGDATABASE": "mydb",
        "PGUSER": "admin",
        "PGPASSWORD": "secret",
        "SSH_HOST": "bastion.example.com",
        "SSH_PORT": "22",
        "SSH_USERNAME": "ubuntu",
        "SSH_PRIVATE_KEY": "-----BEGIN OPENSSH PRIVATE KEY-----\n..."
      }
    }
  }
}

Available Tools

Connection

| Tool | Description | | --- | --- | | test_connection | Test database connectivity |

Schema Introspection

| Tool | Description | | --- | --- | | list_schemas | List all accessible schemas | | list_tables | List tables in a schema with size/row estimates | | describe_table | Get columns, types, defaults, foreign keys, comments | | get_table_indexes | Get all indexes on a table | | get_table_size | Get table, data, and index sizes | | get_table_ddl | Generate CREATE TABLE DDL | | get_table_rls | Get Row-Level Security status and policies | | get_table_triggers | List table triggers | | get_schema_metadata | Complete metadata for all schemas (tables, views, functions, columns, FKs, PKs) |

Views

| Tool | Description | | --- | --- | | list_views | List views and materialized views | | get_view_definition | Get SQL definition of a view | | get_view_columns | Get column definitions for a view |

Functions

| Tool | Description | | --- | --- | | list_functions | List functions and procedures | | get_function_definition | Get full function source code |

Query Execution

| Tool | Description | | --- | --- | | execute_query | Execute read-only SQL (SELECT/WITH/EXPLAIN), max 5000 rows | | execute_mutation | Execute write SQL (INSERT/UPDATE/DELETE/CREATE/ALTER/DROP) — requires confirm: true | | explain_query | EXPLAIN ANALYZE with JSON output |

Roles & Databases

| Tool | Description | | --- | --- | | list_roles | List all database roles and users | | list_databases | List all databases with size info |

Instance Monitoring

| Tool | Description | | --- | --- | | get_active_queries | Show currently running queries | | get_database_stats | Connection count, cache hit ratio, tuple stats | | cancel_query | Cancel a running query by PID | | terminate_connection | Terminate a connection by PID — requires confirm: true |

Safety

  • execute_query only allows SELECT, WITH, TABLE, VALUES, and EXPLAIN statements
  • execute_mutation requires explicit confirm: true parameter — agents must ask for user approval
  • terminate_connection requires explicit confirm: true
  • All queries are parameterized to prevent SQL injection
  • Connection pooling with automatic cleanup (5-minute idle timeout)

Programmatic Usage

import { createOrcaqMcpServer } from 'orcaq-mcp';

const { server, cleanup } = createOrcaqMcpServer({
  connectionString: 'postgres://user:pass@localhost:5432/mydb',
});

// Use with any MCP transport
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
const transport = new StdioServerTransport();
await server.connect(transport);

// Cleanup on shutdown
process.on('SIGTERM', async () => {
  await cleanup();
  await server.close();
});

Development

# Install dependencies
npm install

# Build
npm run build

# Watch mode
npm run dev

# Type check
npm run typecheck

Requirements

  • Node.js >= 18
  • PostgreSQL database

License

MIT — OrcaQ