Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
Your own AI agent, running 24/7 with QwikClaw logoYour own AI agent, running 24/7 with QwikClaw

QwikClaw sets up and runs an always-on OpenClaw agent for you. One click, no config files, no server setup.

Deploy now
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 47,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

Provides database schema management, query execution, and schema introspection through Drizzle ORM and drizzle-kit CLI tools, supporting SQLite and PostgreSQL.

README.md

Drizzle MCP Server

A Model Context Protocol (MCP) server that provides access to Drizzle ORM database operations and drizzle-kit CLI tools.

Features

  • Database Schema Management: Generate and run migrations using drizzle-kit
  • Query Execution: Execute raw SQL queries with parameter support
  • Schema Introspection: Explore database tables and schema information
  • Database Resources: Browse tables and schema through MCP resources
  • Cross-Project Compatibility: Works with any existing Drizzle project
  • Multi-Database Support: SQLite and PostgreSQL with automatic driver detection
  • Environment Variable Support: Automatic .env file loading for database credentials
  • Flexible Installation: Install globally, run with npx/bunx, or use as a linked package

Installation

Option 1: Install globally from GitHub

npm install -g github:defrex/drizzle-mcp

Option 2: Run directly with npx/bunx (no installation required)

npx github:defrex/drizzle-mcp --help
bunx github:defrex/drizzle-mcp --help

Option 3: Link for development (if working on the package)

# In the drizzle-mcp directory
bun link

# In your project directory
bun link drizzle-mcp

Usage

Basic Usage

Run the server with your Drizzle config file:

drizzle-mcp ./drizzle.config.ts

Or use the config option:

drizzle-mcp --config ./drizzle.config.ts

Claude Desktop Integration

Add to your Claude Desktop configuration:

{
  "mcpServers": {
    "drizzle": {
      "command": "npx",
      "args": ["github:defrex/drizzle-mcp", "./drizzle.config.ts"]
    }
  }
}

Or with bunx:

{
  "mcpServers": {
    "drizzle": {
      "command": "bunx",
      "args": ["github:defrex/drizzle-mcp", "./drizzle.config.ts"]
    }
  }
}

Command Line Options

drizzle-mcp [options] [config]

Arguments:
  config               Path to drizzle config file

Options:
  -V, --version        output the version number
  -c, --config <path>  Path to drizzle config file
  -d, --cwd <path>     Working directory (default: current directory)
  -v, --verbose        Enable verbose logging
  -h, --help           display help for command

Configuration

The server automatically detects your Drizzle configuration from:

  • Command line argument: drizzle-mcp ./my-config.ts
  • Current directory: drizzle.config.ts, drizzle.config.js, or drizzle.config.mjs

Your Drizzle config should be a standard drizzle-kit configuration file.

Environment Variables

The server automatically loads environment variables from .env.local and .env files in your project directory. This is useful for database credentials:

# .env.local
DATABASE_URL=postgresql://username:password@localhost:5432/database

The server will detect and use DATABASE_URL from your environment variables, so you can use it in your drizzle config:

export default defineConfig({
  dialect: 'postgresql',
  dbCredentials: {
    url: process.env.DATABASE_URL!,
  },
  // ...
});

Available Tools

  1. drizzle_generate_migration - Generate new migration files
  2. drizzle_run_migrations - Apply pending migrations
  3. drizzle_introspect_schema - Introspect existing database schema
  4. execute_query - Execute raw SQL queries
  5. initialize_database - Initialize database connection

Available Resources

  1. database://tables - List all database tables
  2. database://schema - Complete database schema information

Note: Resources are database-agnostic and work with both SQLite and PostgreSQL

Requirements

  • Node.js 18 or higher
  • An existing Drizzle project with:
  • drizzle-orm >= 0.40.0
  • drizzle-kit >= 0.30.0
  • For SQLite: better-sqlite3 >= 9.0.0
  • For PostgreSQL: pg >= 8.0.0 OR postgres >= 3.4.0

Note: The server automatically detects which database driver you have installed and uses the appropriate one.

Example Configuration

SQLite Configuration

import { defineConfig } from "drizzle-kit";

export default defineConfig({
  out: "./migrations",
  schema: "./src/schema.ts",
  dialect: "sqlite",
  dbCredentials: {
    url: "./database.db",
  },
});

PostgreSQL Configuration

import { defineConfig } from "drizzle-kit";

export default defineConfig({
  out: "./migrations",
  schema: "./src/schema.ts",
  dialect: "postgresql",
  dbCredentials: {
    url: process.env.DATABASE_URL!,
    // Or use individual credentials:
    // host: "localhost",
    // port: 5432,
    // user: "username",
    // password: "password",
    // database: "database",
  },
});

Note: The server supports both pg (node-postgres) and postgres (postgres-js) drivers. It will automatically detect which one you have installed and use the appropriate one.

Supported Databases

Currently supports:

  • SQLite - Via better-sqlite3
  • PostgreSQL - Via pg (node-postgres) or postgres (postgres-js)

The server automatically detects which database drivers you have installed and uses the appropriate ones. For PostgreSQL, it will try postgres first, then fall back to pg.

Support for MySQL is planned for future releases.

Development

The server is built with:

  • Node.js - JavaScript runtime
  • TypeScript - Type-safe development
  • Drizzle ORM - Database ORM and query builder
  • Commander.js - CLI argument parsing
  • MCP SDK - Model Context Protocol implementation
  • dotenv - Environment variable loading

Building from Source

git clone https://github.com/defrex/drizzle-mcp.git
cd drizzle-mcp
bun install
bun run build

Key Features

  • Automatic Module Resolution: Resolves database drivers and drizzle-orm from your project's dependencies
  • Environment Variable Loading: Automatically loads .env.local and .env files from your project
  • Cross-Platform: Works with npm, bun, and various package managers
  • Comprehensive Error Handling: Detailed error messages with context for easier debugging
  • Security: Input validation and sanitization for all user inputs

License

MIT

See related servers & alternatives →

Related MCP servers

Browse all →

Related guides

Hand-picked reading to help you choose and use Databases servers.