Menu
Blog Documentation Community Pricing Demo Call Sign Up
Sign Up

How to Set Up a SQLite MCP Server for Claude, Cursor & Codex

Connect Claude, Cursor, Codex, or any AI agent to your SQLite database using MCP. Set up the official Anthropic SQLite MCP server in minutes.

MCP

This post was written by an engineer at QueryPlane. QueryPlane is an app builder for your database: bring your own postgres db and you can create interactive applications to share with other developers, coworkers or even your customers. If you’re interested in trying it out, get started here.


MCP (Model Context Protocol) lets AI tools like Claude Desktop, Claude Code, Cursor, and Codex connect directly to your SQLite databases. Instead of manually describing your schema, the AI can inspect tables, run queries, and analyze your data autonomously — all from a local file.

In this post, we’ll cover:

  • What is MCP — How the protocol works
  • Best SQLite MCP servers — Official and multi-database options
  • Setup guides — Step-by-step for Claude Desktop and Claude Code
  • Security considerations — Keeping your data safe

What is MCP?

The Model Context Protocol is an open standard created by Anthropic that lets AI applications connect to external data sources and tools. Think of it as a USB-C port for AI — a standardized way for any AI client to talk to any data source.

For databases like SQLite, MCP servers expose tools for schema exploration and SQL execution — letting AI agents query your data without manual context.

Best SQLite MCP Servers

1. Anthropic Reference SQLite Server

The reference implementation from Anthropic includes a dedicated SQLite server (now archived, but still functional).

Features:

  • Schema inspection (list tables, describe columns)
  • SQL query execution (read and write)
  • Business intelligence memo via append_insight

Claude Desktop config:

{
  "mcpServers": {
    "sqlite": {
      "command": "uvx",
      "args": [
        "mcp-server-sqlite",
        "--db-path", "/path/to/database.db"
      ]
    }
  }
}

Claude Code setup:

claude mcp add --transport stdio sqlite -- \
  uvx mcp-server-sqlite \
  --db-path /path/to/database.db

2. DBHub (Bytebase)

DBHub (~2,600 stars) supports SQLite alongside PostgreSQL, MySQL, SQL Server, and MariaDB.

Claude Code setup:

claude mcp add --transport stdio dbhub -- \
  npx @bytebase/dbhub@latest \
  --transport stdio \
  --dsn "sqlite:///path/to/database.db"

3. MCP-Alchemy

mcp-alchemy (~400 stars) uses SQLAlchemy under the hood and supports SQLite alongside every other database SQLAlchemy supports.

See what QueryPlane can build for you

Connect to your database, write SQL with AI, and build shareable apps — all from your browser.

Which SQLite MCP Server Should You Use?

ServerStarsDedicated SQLiteMulti-databaseRead-only mode
Official Anthropic~84,000*YesNoNo
DBHub~2,600NoYesYes
MCP-Alchemy~400NoYesNo

Stars for entire modelcontextprotocol/servers repo

For most developers, use the official Anthropic SQLite server — it’s the simplest option and works out of the box. If you work with multiple databases, use DBHub.

Security Considerations

SQLite is a local file-based database, so the security model is different from client-server databases:

  • Use a copy of the database — point MCP at a copy, not your primary file
  • Set file permissions — ensure the MCP process has read-only file access if you don’t need writes
  • Be careful with WAL mode — concurrent access via MCP can interact with your application
  • Back up before connecting — especially if allowing write access
  • Don’t expose production databases — use copies or exports for AI analysis

Using MCP with QueryPlane

If you want the benefits of AI-powered database access without managing MCP servers, QueryPlane provides this out of the box. Connect your database and use AI to generate queries, explore schemas, and build dashboards — all from your browser with built-in access controls.

FAQ

What is a SQLite MCP server?

A SQLite MCP server is a process that implements the Model Context Protocol to let AI tools (Claude, Cursor, Codex, Windsurf) connect to your SQLite database file. It exposes tools for listing tables, describing schemas, and running SQL queries.

How do I connect Claude to SQLite?

Install mcp-server-sqlite via uvx, then add it to your Claude Desktop config or use claude mcp add in Claude Code. Point it at your .db file path.

Is it safe to connect AI to my SQLite database?

SQLite is file-based, so security is about file access control. Point MCP at a copy of your database, set read-only file permissions if possible, and always back up before connecting.

Can MCP write to my SQLite database?

Yes, the official server supports both reads and writes. If you want read-only access, use DBHub which has a built-in read-only mode, or set file permissions to read-only.

Wrapping up

SQLite has the simplest MCP setup of any database — just point the official server at your .db file. It’s great for local development, prototyping, and analyzing embedded databases. Work with a copy of your database and explore how AI-powered data access fits your workflow.