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 🙏

© 2025 – Pkg Stats / Ryan Hefner

tablr-mcp

v1.0.30

Published

MCP server for PostgreSQL database management with natural language interface

Downloads

78

Readme

Tablr MCP Server

MCP server for managing PostgreSQL databases with natural language through AI assistants like Claude, Cursor, and VS Code.

Quick Start

Prerequisites

  • Node.js 18.0.0+
  • PostgreSQL database
  • Tablr API key (Get one here)

Installation

npm install -g tablr-mcp

Configuration

Create a .env file:

TABLR_API_KEY=tb_12345678_your_api_key_here
PG_CONNECTION_STRING=postgresql://username:password@hostname:port/database

MCP Setup

Option A: Using .env file (Recommended)

{
  "mcpServers": {
    "tablr": {
      "command": "tablr-mcp",
      "args": ["/absolute/path/to/your/.env"]
    }
  }
}

Option B: Auto-detect .env

{
  "mcpServers": {
    "tablr": {
      "command": "tablr-mcp"
    }
  }
}

Option C: Direct environment variables

{
  "mcpServers": {
    "tablr": {
      "command": "tablr-mcp",
      "env": {
        "TABLR_API_KEY": "your-api-key",
        "PG_CONNECTION_STRING": "your-connection-string"
      }
    }
  }
}

Usage

Start using natural language commands:

"Show me all tables"
"Create a users table with email, name, and created_at columns"
"Insert a user with email '[email protected]'"
"Add an index on the email column"

Available Tools (15 total)

Database Discovery

  1. list_tables - List all database tables
  2. get_table_schema - Get table structure and constraints

Schema Management

  1. create_table - Create new tables with columns/constraints
  2. alter_table - Modify table structures
  3. alter_column - Change column properties
  4. rename_table - Rename existing tables
  5. drop_table - Remove tables

Data Operations

  1. query_records - Query and filter data
  2. insert_records - Insert new data
  3. update_records - Update existing records
  4. delete_records - Delete records with conditions

Index Management

  1. add_index - Create database indexes
  2. drop_index - Remove database indexes

Constraint Management

  1. add_constraint - Add table constraints

Advanced Tools

  1. execute_sql - Run custom SQL queries

Environment Variables

| Variable | Required | Description | |----------|----------|-------------| | TABLR_API_KEY | Yes | Tablr API key for usage tracking | | PG_CONNECTION_STRING | Yes | PostgreSQL connection string |

Usage Examples

Table Management

"Create a posts table with title (varchar), content (text), and published_at (timestamp)"
"Rename the posts table to articles"
"Add a unique constraint on the email column"

Data Operations

"Insert: email='[email protected]', name='John', active=true"
"Show users created in the last 7 days"
"Update user 123 to set email_verified=true"

Schema Changes

"Add a nullable bio column to users table"
"Create an index on the created_at column"
"Drop the old_column from users table"

Architecture

AI Assistant ──► MCP Server ──► PostgreSQL
    │              │
    └──────────────► Tablr API (usage tracking)
  • MCP Server: Handles AI communication and tool execution
  • PostgreSQL Client: Direct database operations
  • Usage Tracker: Sends metrics to Tablr for billing
  • Schema Discovery: Auto-detects tables via information_schema

Security

  • Local Processing: Database operations run on your machine
  • Secure Credentials: PostgreSQL credentials stay local
  • Parameterized Queries: SQL injection protection
  • Environment Files: Store secrets in .env files, never commit to git

Troubleshooting

Connection Issues

  • Verify PG_CONNECTION_STRING format
  • Check database accessibility and permissions
  • Ensure PostgreSQL is running

Authentication Problems

  • Validate TABLR_API_KEY format (starts with tb_)
  • Check API key hasn't expired
  • Verify environment variables are loaded

Debug Mode

npm start -- --debug

Development

git clone https://github.com/yourusername/tablr-mcp.git
cd tablr-mcp
npm install
npm run build
npm start

Support

License

MIT License - see LICENSE file for details.