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

@hinha/libsql-mcp

v0.0.1

Published

libSQL/Turso MCP server — full CRUD connector for AI agents

Downloads

18

Readme

@hinha/libsql-mcp

libSQL/Turso MCP server for AI agents. Provides full CRUD database operations as Model Context Protocol tools and resources, enabling AI assistants like Claude and Cursor to directly query and manage your libSQL/Turso databases.

Features

  • 7 MCP Tools — execute, batch, transaction, list_tables, describe_table, migrate, database_overview
  • 3 MCP Resources — database schema, table listing, individual table schemas
  • Dual Transport — stdio (local CLI) and HTTP (remote/network access)
  • Remote Turso & Self-hosted — supports libsql://, https://, and wss:// URLs
  • TypeScript — strict mode, ESM, full type declarations

Quick Start

Using with npx (Recommended)

No install needed. Run directly:

npx -y @hinha/libsql-mcp@latest

Or add to your MCP client config:

{
  "mcpServers": {
    "libsql": {
      "command": "npx",
      "args": ["-y", "@hinha/libsql-mcp@latest"],
      "env": {
        "LIBSQL_URL": "https://your-db.sqlite.turso.io",
        "LIBSQL_AUTH_TOKEN": "your-auth-token"
      }
    }
  }
}

Install globally

npm install -g @hinha/libsql-mcp
LIBSQL_URL=https://your-db.sqlite.turso.io LIBSQL_AUTH_TOKEN=your-token libsql-mcp

Build from source

git clone https://github.com/hinha/libsql-client.git
cd libsql-client
npm install
npm run build
npm start

Configuration

Set via environment variables or .env file:

| Variable | Required | Default | Description | |---|---|---|---| | LIBSQL_URL | Yes | — | Database URL (https://, libsql://, wss://) | | LIBSQL_AUTH_TOKEN | Yes | — | Auth token (JWT or Turso platform token) | | TRANSPORT | No | stdio | Transport mode: stdio or http | | PORT | No | 3000 | HTTP port (when TRANSPORT=http) |

MCP Client Configuration

Claude Code

Add to your settings.json:

{
  "mcpServers": {
    "libsql": {
      "command": "npx",
      "args": ["-y", "@hinha/libsql-mcp@latest"],
      "env": {
        "LIBSQL_URL": "https://your-db.sqlite.turso.io",
        "LIBSQL_AUTH_TOKEN": "your-auth-token"
      }
    }
  }
}

Cursor

Add to your .cursor/mcp.json:

{
  "mcpServers": {
    "libsql": {
      "command": "npx",
      "args": ["-y", "@hinha/libsql-mcp@latest"],
      "env": {
        "LIBSQL_URL": "https://your-db.sqlite.turso.io",
        "LIBSQL_AUTH_TOKEN": "your-auth-token"
      }
    }
  }
}

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "libsql": {
      "command": "npx",
      "args": ["-y", "@hinha/libsql-mcp@latest"],
      "env": {
        "LIBSQL_URL": "https://your-db.sqlite.turso.io",
        "LIBSQL_AUTH_TOKEN": "your-auth-token"
      }
    }
  }
}

HTTP mode (remote access)

TRANSPORT=http PORT=3000 npx -y @hinha/libsql-mcp@latest

MCP Tools

execute

Execute a single SQL statement.

{
  "sql": "SELECT * FROM users WHERE active = ?",
  "args": [1]
}

batch

Execute multiple SQL statements atomically. All succeed or all fail.

{
  "statements": [
    "CREATE TABLE IF NOT EXISTS products (id INTEGER PRIMARY KEY, name TEXT, price REAL)",
    { "sql": "INSERT INTO products (name, price) VALUES (?, ?)", "args": ["Widget", 9.99] },
    { "sql": "INSERT INTO products (name, price) VALUES (?, ?)", "args": ["Gadget", 14.99] }
  ],
  "mode": "write"
}

transaction

Execute multiple SQL statements in an interactive transaction with explicit commit/rollback.

{
  "statements": [
    { "sql": "UPDATE accounts SET balance = balance - ? WHERE id = ?", "args": [100, 1] },
    { "sql": "UPDATE accounts SET balance = balance + ? WHERE id = ?", "args": [100, 2] }
  ],
  "mode": "write"
}

list_tables

List all tables and views in the database.

describe_table

Get column schema for a specific table.

{ "table": "users" }

migrate

Run database migrations sequentially.

{
  "migrations": [
    { "sql": "CREATE TABLE IF NOT EXISTS logs (id INTEGER PRIMARY KEY, message TEXT, created_at TEXT)" },
    { "sql": "CREATE INDEX IF NOT EXISTS idx_logs_created ON logs(created_at)" }
  ]
}

database_overview

Get an overview of the database — all tables with row counts.

MCP Resources

| Resource | URI | Description | |---|---|---| | Schema | turso://schema | Full database schema (all tables + columns) | | Tables | turso://tables | List of all tables with metadata | | Table Detail | turso://tables/{name} | Schema for a specific table |

Project Structure

src/
├── connector/index.ts           # LibsqlConnector wrapper class
├── mcp/
│   ├── server.ts                # MCP server setup & registration
│   ├── tools/
│   │   ├── execute.ts           # Execute single SQL
│   │   ├── batch.ts             # Atomic batch operations
│   │   ├── transaction.ts       # Interactive transactions
│   │   ├── list-tables.ts       # List tables & views
│   │   ├── describe-table.ts    # Table schema introspection
│   │   ├── migrate.ts           # Database migrations
│   │   ├── database-overview.ts # Database statistics
│   │   └── index.ts
│   └── resources/
│       ├── schema.ts            # turso://schema resource
│       ├── tables.ts            # turso://tables resource
│       ├── table-detail.ts      # turso://tables/{name} resource
│       └── index.ts
├── transport/
│   ├── stdio.ts                 # Stdio transport (Claude Code, Cursor)
│   └── http.ts                  # HTTP transport (remote access)
└── index.ts                     # Entry point

Development

npm install
npm run build
npm run dev        # watch mode
npm start          # run server

Release

Push a version tag to trigger the release workflow:

# Bump version in package.json
npm version patch  # or minor, major
git push --follow-tags

The CI workflow will:

  1. Build standalone binaries for Linux, macOS (ARM64), and Windows
  2. Publish to npm
  3. Create a GitHub Release with binaries

Download binary

Download the latest binary for your platform from Releases:

# macOS ARM64
curl -L -o libsql-mcp https://github.com/hinha/libsql-client/releases/latest/download/libsql-mcp-macos-arm64
chmod +x libsql-mcp

# Linux x64
curl -L -o libsql-mcp https://github.com/hinha/libsql-client/releases/latest/download/libsql-mcp-linux-x64
chmod +x libsql-mcp

# Windows x64
curl -L -o libsql-mcp.exe https://github.com/hinha/libsql-client/releases/latest/download/libsql-mcp-win-x64.exe

Then run:

LIBSQL_URL=https://your-db.sqlite.turso.io LIBSQL_AUTH_TOKEN=your-token ./libsql-mcp

# Check version
./libsql-mcp --version

Note: NPM_TOKEN must be set as a GitHub Actions secret for publishing.

Security

  • Table names are validated against sqlite_master before use in PRAGMA queries
  • SQL is passed through as-is — the AI agent is the trusted user
  • Auth tokens are never logged or returned in tool output