An MCP (Model Context Protocol) server that provides AI models with searchable access to Drizzle ORM documentation. On first run it crawls the official docs site and caches the results locally for fast subsequent startups.
| Tool | Description |
|---|---|
drizzle_search_docs |
Keyword search across all documentation pages |
drizzle_get_page |
Retrieve the full content of a specific docs page |
drizzle_list_topics |
List all available documentation topics by category |
| Tool | Description |
|---|---|
drizzle_generate_schema |
Convert SQL CREATE TABLE statements into Drizzle ORM TypeScript schema code |
drizzle_sql_to_drizzle |
Convert SQL queries (SELECT, INSERT, UPDATE, DELETE) into Drizzle query builder code |
Both code generation tools accept a dialect parameter ("postgresql", "mysql", or "sqlite") and produce output with correct imports.
Parses one or more CREATE TABLE statements and produces the equivalent pgTable / mysqlTable / sqliteTable definitions with column types, constraints, and imports.
Parameters:
sql(string) — SQLCREATE TABLEstatement(s)dialect(enum, default"postgresql") — Target database dialect
Example input:
CREATE TABLE users (
id SERIAL PRIMARY KEY,
email VARCHAR(255) NOT NULL UNIQUE,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);Example output (postgresql):
import { pgTable, serial, timestamp, varchar } from "drizzle-orm/pg-core";
export const users = pgTable("users", {
id: serial("id").primaryKey(),
email: varchar("email", { length: 255 }).notNull().unique(),
createdAt: timestamp("created_at", { withTimezone: true }).notNull().default(now()),
});Translates a SQL query into Drizzle ORM query builder calls, mapping operators to filter functions (eq, gt, like, and, or, etc.).
Parameters:
sql(string) — A SQL query to convertdialect(enum, default"postgresql") — Target database dialectschema_hint(string, optional) — Table/column context for more accurate output
Example input:
SELECT u.id, u.name, p.title
FROM users u
INNER JOIN posts p ON p.author_id = u.id
WHERE u.is_active = true
ORDER BY p.created_at DESC
LIMIT 10Example output:
import { desc, eq } from "drizzle-orm";
db.select({ id: u.id, name: u.name, title: p.title })
.from(users)
.innerJoin(posts, eq(p.authorId, u.id))
.where(eq(u.isActive, true))
.orderBy(desc(p.createdAt))
.limit(10);- Node.js >= 18
npm installnpm run buildThis compiles TypeScript from src/ into dist/.
Production (requires a build first):
npm startDevelopment (with hot reload via tsx):
npm run devThe server communicates over stdio using the MCP protocol. On first launch it will crawl the Drizzle docs site and cache the pages to crawled_docs.json for faster subsequent starts.
Add the server to your MCP configuration:
{
"mcpServers": {
"drizzle-docs": {
"command": "node",
"args": ["/absolute/path/to/drizzle-docs-mcp/dist/index.js"]
}
}
}The server can also run in HTTP mode, which is useful for Docker deployments or when you want to connect over the network.
# Start in HTTP mode on port 3000
node dist/index.js --http
# Use a custom port
PORT=8080 node dist/index.js --httpThe MCP endpoint will be available at http://localhost:3000/mcp.
Build and run:
docker build -t drizzle-docs-mcp .
docker run -p 3000:3000 drizzle-docs-mcpUsing Docker Compose:
docker compose upThe MCP server will be available at http://localhost:3000/mcp. Other containers on the same Docker network can connect via http://drizzle-docs-mcp:3000/mcp.
| Script | Command | Description |
|---|---|---|
build |
tsc |
Compile TypeScript |
start |
node dist/index.js |
Run the compiled server |
dev |
tsx watch src/index.ts |
Run in development mode with hot reload |
clean |
rm -rf dist |
Remove build artifacts |