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

electric-elephant

v0.21.17

Published

Electric Elephant — PostgreSQL-only, readonly-first, token-efficient MCP server

Downloads

317

Readme

Electric Elephant

Electric Elephant is a token-efficient MCP server for exploring and querying PostgreSQL from MCP-capable clients. It is not a generic SQL bridge: only PostgreSQL is supported (not MySQL, SQLite, SQL Server, Oracle, or other engines).

Repository: github.com/ajgreyling/electric-elephant

Purpose

  • Expose PostgreSQL through MCP tools (execute_sql, search_objects, query_insights, schema_diff, observability helpers, and related wiring).
  • PostgreSQL-only: no connectors or compatibility layers for other SQL databases.
  • Provide safe defaults (read-only unless explicitly enabled for destructive SQL).
  • Heuristic PII/clinical guard on execute_sql (wildcards and sensitive-looking columns blocked unless explicitly opted in via TOML, env, or CLI — see docs/tools/execute-sql.mdx and CLAUDE.md).

Repository Landmarks

  • src/index.ts - entrypoint and startup path.
  • src/server.ts - HTTP MCP transport wiring.
  • src/connectors/ - database connector implementations.
  • src/tools/ - MCP tool handlers (execute_sql, search_objects, query_insights, schema_diff, etc.).
  • src/config/ - TOML/config loading and validation.
  • frontend/ - local web workbench UI.
  • CLAUDE.md - architecture and development conventions.

Quick Start

pnpm install
pnpm run dev

Build and test:

pnpm run build
pnpm test

MCP Request Flow

flowchart LR
    A[MCP Client] --> B[Transport: stdio or HTTP]
    B --> C[Tool Router]
    C --> D{Tool}
    D -->|execute_sql| E[Connector Manager]
    D -->|search_objects| E
    E --> F[PostgreSQL connector]
    F --> G[(PostgreSQL)]
    G --> F --> E --> C --> A

Query Execution State Machine

stateDiagram-v2
    [*] --> RequestReceived
    RequestReceived --> ValidatingInput
    ValidatingInput --> SelectingSource
    SelectingSource --> Executing
    Executing --> FormattingResponse
    FormattingResponse --> Completed
    Executing --> Failed
    ValidatingInput --> Failed
    Failed --> [*]
    Completed --> [*]

Human + AI Agent Onboarding Checklist

  1. Read CLAUDE.md before editing connectors/tools.
  2. Prefer tool-level changes in src/tools/ over transport-layer changes.
  3. Keep source_id routing behavior backward compatible.
  4. When changing execute_sql, preserve PII guard semantics (pii-sql-guard.ts, pii-heuristics.ts, PII_ACCESS_VIOLATION).
  5. Run relevant tests (pnpm test, or targeted connector/integration tests).

Tool Schema Examples

execute_sql input (list explicit columns; SELECT * may be rejected when the PII guard is on):

{
  "sql": "SELECT id, status FROM users LIMIT 10;"
}

search_objects input:

{
  "object_type": "column",
  "schema": "public",
  "table": "users",
  "pattern": "%_id",
  "detail_level": "summary",
  "limit": 50
}

Related Docs

  • docs/ for user-facing documentation.
  • dbhub.toml.example for multi-source configuration examples.