mcp-to-db
Provides read-only access to SQLite databases, allowing AI assistants to list tables, inspect schemas, and run SELECT queries with filtering, ordering, and pagination.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-to-dblist all tables"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-to-db
Expose any SQLite database as read-only MCP tools for AI assistants.
mcp-to-db is an MCP (Model Context Protocol) server that turns a SQLite database into a set of tools AI assistants can use — list tables, inspect schemas, and run SELECT queries with filtering, ordering, and pagination. Data modification is intentionally blocked.
Quick start
pnpm install
pnpm db:push # create tables
pnpm seed # load sample data
pnpm dev # start server on http://127.0.0.1:3000/mcpThe sample data is an e-commerce database with 3 users, 5 products, 4 orders, and 9 order items — ready for testing.
Related MCP server: sqlite-mcp-server
Tools
The server exposes three read-only tools:
Tool | Description |
| Lists all table names in the database |
| Shows columns, types, nullability, defaults, primary keys, and foreign keys for a given table |
| SELECT queries with optional filters ( |
query-table details
{
"table": "orders",
"columns": ["id", "status", "total", "created_at"],
"where": [{ "column": "status", "operator": "=", "value": "paid" }],
"orderBy": { "column": "created_at", "direction": "desc" },
"limit": 20,
"offset": 0
}All where conditions are ANDed together. Maximum limit is 1000 rows.
Schema
The sample e-commerce schema:
users —
id,email,name,created_atproducts —
id,name,description,price(cents),stock,created_atorders —
id,user_id→ users,status(pending/paid/shipped/delivered/cancelled),total(cents),created_atorder_items —
id,order_id→ orders,product_id→ products,quantity,unit_price(cents)
Usage with MCP clients
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"ecommerce-db": {
"command": "pnpm",
"args": ["--dir", "/path/to/mcp-to-db", "dev"]
}
}
}Any MCP client
Point your client to http://127.0.0.1:3000/mcp.
Scripts
Command | Description |
| Start the MCP server |
| Generate Drizzle migrations |
| Push schema to SQLite (creates |
| Seed with sample e-commerce data |
| Run tests (Vitest) |
|
|
|
|
|
|
Adapting to your own database
Edit
src/schema.ts— define your Drizzle ORM tables.Run
pnpm db:pushto create tables.Optionally update or replace
seed.ts.Start the server with
pnpm dev.
The tool registration in src/tools.ts and all three tool implementations are schema-agnostic — they adapt to whatever tables you define.
How it works
┌──────────────┐ MCP/HTTP ┌─────────────────────┐
│ AI Assistant │ ◄─────────────► │ MCP Server (3000) │
│ (Claude, etc) │ tools │ list-tables │
└──────────────┘ │ describe-table │
│ query-table │
└─────────┬───────────┘
│
┌─────▼─────┐
│ SQLite │
│ (better- │
│ sqlite3) │
└───────────┘Built with:
MCP SDK — Model Context Protocol server framework
Drizzle ORM — Type-safe SQL query builder
better-sqlite3 — Synchronous SQLite driver
Zod — Input validation
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
- dataOAuthco.thinair
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
Draxlr's remote MCP server connects AI assistants to your SQL databases and dashboards. Explore schemas, run read-only queries, manage saved queries and dashboards, and export results, all with row-level security so each user sees only their own data.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceExposes a SQLite database to AI assistants with structured, read-safe access. Includes five tools for schema exploration, querying, and sampling data.-
- AlicenseNot gradedqualityDmaintenanceA read-only MCP server that enables LLMs to safely explore and query any SQLite database via natural language. It exposes tools for listing tables, describing schemas, and executing SELECT/WITH queries with built-in safety guards like write prevention and row limits.MIT
- FlicenseNot gradedqualityCmaintenanceProvides AI agents read-only analytical access to a SQLite database over stdio, with tools for listing tables, describing schemas, and running paginated SQL queries.-
- FlicenseAqualityCmaintenanceEnables AI agents to safely inspect and query a SQLite database through read-only MCP tools for listing tables, describing schemas, and running paginated SELECT queries.3-