/ Directory / Playground / SQLite
● Official modelcontextprotocol ⚡ Instant

SQLite

by modelcontextprotocol · modelcontextprotocol/servers

Query a local SQLite file. Perfect for personal projects, exported data dumps, or analytics on a journal/log/db file.

The reference SQLite MCP. Points at a single SQLite file and exposes schema introspection, read queries, and write queries (configurable). Zero setup, no server, no network — and unlike Postgres MCP, it can also write if you let it.

Why use it

Key features

Live Demo

What it looks like in practice

sqlite.replay ▶ ready
0/0

Install

Pick your client

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "sqlite": {
      "command": "uvx",
      "args": [
        "mcp-server-sqlite",
        "--db-path",
        "/data/sample.db"
      ]
    }
  }
}

Open Claude Desktop → Settings → Developer → Edit Config. Restart after saving.

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "sqlite": {
      "command": "uvx",
      "args": [
        "mcp-server-sqlite",
        "--db-path",
        "/data/sample.db"
      ]
    }
  }
}

Cursor uses the same mcpServers schema as Claude Desktop. Project config wins over global.

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "sqlite": {
      "command": "uvx",
      "args": [
        "mcp-server-sqlite",
        "--db-path",
        "/data/sample.db"
      ]
    }
  }
}

Click the MCP Servers icon in the Cline sidebar, then "Edit Configuration".

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "sqlite": {
      "command": "uvx",
      "args": [
        "mcp-server-sqlite",
        "--db-path",
        "/data/sample.db"
      ]
    }
  }
}

Same shape as Claude Desktop. Restart Windsurf to pick up changes.

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "sqlite",
      "command": "uvx",
      "args": [
        "mcp-server-sqlite",
        "--db-path",
        "/data/sample.db"
      ]
    }
  ]
}

Continue uses an array of server objects rather than a map.

~/.config/zed/settings.json
{
  "context_servers": {
    "sqlite": {
      "command": {
        "path": "uvx",
        "args": [
          "mcp-server-sqlite",
          "--db-path",
          "/data/sample.db"
        ]
      }
    }
  }
}

Add to context_servers. Zed hot-reloads on save.

claude mcp add sqlite -- uvx mcp-server-sqlite --db-path /data/sample.db

One-liner. Verify with claude mcp list. Remove with claude mcp remove.

Use Cases

Real-world ways to use SQLite

Analyze a CSV/JSON dump by loading it into SQLite

👤 Analysts, engineers exploring exported data ⏱ ~15 min beginner

When to use: Someone sent you a CSV with 200k rows and the question 'which segment converts best?' — too big for spreadsheets, too small for a real DB.

Prerequisites
  • Source file on disk — Save as .csv or .json under a working folder
  • An empty SQLite file path — Choose a location like /tmp/analysis.db; the MCP will create it
Flow
  1. Create the table and load
    Create a table signups in /tmp/analysis.db matching the columns of /data/signups.csv. Load all rows. Tell me the row count.✓ Copied
    → Table created, row count matches file
  2. Explore the schema
    What columns exist? For each, what's the value distribution (top 5 distinct values for categoricals; min/max/avg for numerics)?✓ Copied
    → Per-column profile
  3. Answer the actual question
    Group by signup_source. For each, compute: total signups, conversion rate (signups with completed_onboarding=true / total). Sort by conversion rate.✓ Copied
    → Decision-grade table with the SQL shown

Outcome: Defensible answers in 5 minutes, with a .db file you can re-query as new questions come up.

Pitfalls
  • CSV columns auto-typed wrong (numbers as TEXT) — After load, run PRAGMA table_info(signups) and CAST or recreate columns with explicit types if needed
  • Date strings don't sort/compare correctly as TEXT — Store dates as ISO 8601 (YYYY-MM-DDTHH:MM:SSZ) so lexicographic = chronological; or use julianday() for math
Combine with: filesystem · antv-chart

Inspect and edit a personal app's SQLite database

👤 Devs building CLI tools, journal apps, or local-first software ⏱ ~10 min beginner

When to use: You're building a local-first app, you want to see what's in the DB without writing a CLI for it.

Flow
  1. Survey the schema
    List every table in /Users/me/Library/Application Support/MyApp/data.db. For each, show schema and row count.✓ Copied
    → Inventory of the live app DB
  2. Investigate a row
    Find the user record where email = '[email protected]'. Show the row and any related rows in other tables (orders, sessions).✓ Copied
    → Full picture of one user's data
  3. Fix bad data
    There's a stuck order in 'pending' state for that user from 2 days ago. Update it to 'cancelled'. Show the SQL before running.✓ Copied
    → SQL preview before mutation, then row updated

Outcome: App debugging without writing throwaway SQL scripts.

Pitfalls
  • App may have the DB locked open with WAL mode — If you get 'database is locked', stop the app, or query the WAL-merged read-only snapshot via ?mode=ro&immutable=1
Combine with: filesystem

Build deterministic test fixtures from a sample of prod data

👤 Engineers writing integration tests ⏱ ~25 min intermediate

When to use: You want repeatable test data that resembles prod but is small and safe.

Flow
  1. Sample anonymized rows
    From /prod-export/orders.db, sample 100 rows from orders covering each status. Anonymize names and emails.✓ Copied
    → Sample with anonymized PII
  2. Save as a fixture file
    Write the sampled rows to /test/fixtures/orders.db as a fresh SQLite file. Include schema.✓ Copied
    → New fixture file created
  3. Verify against your test loader
    Run my test suite (npm test) — does it pick up the new fixture? If not, what's the first failing test?✓ Copied
    → Tests run; failures pinpointed

Outcome: Realistic fixtures that don't drift from real data shapes.

Pitfalls
  • Anonymization that breaks referential integrity — Anonymize join keys consistently (same hash) across tables; never randomize per-row
Combine with: filesystem · github

Analyze a SQLite-backed log/event file

👤 Engineers debugging CLI tools or apps that log to SQLite ⏱ ~10 min beginner

When to use: Many modern tools (homebrew, some browsers, app caches) store state in SQLite. You want to query them.

Flow
  1. Confirm it's the right file
    Open ~/Library/Application Support/SomeApp/cache.db. List tables and a sample of recent rows.✓ Copied
    → Recognizable schema confirms you have the right file
  2. Find the answer
    How many entries does the cache hold per source domain? Top 20.✓ Copied
    → Aggregation result
  3. Optionally clean up
    Delete entries from domains that haven't been accessed in 90 days. Show count first, ask before deleting.✓ Copied
    → Preview, confirmation, then delete

Outcome: Answers about app behavior with no need for a built-in 'stats' command.

Pitfalls
  • Modifying an app's live DB while the app is running can corrupt it — Always close the app first, or work on a copy of the .db file
Combine with: filesystem

Combinations

Pair with other MCPs for X10 leverage

sqlite + filesystem

Read a CSV from disk and load into SQLite for analysis

Read /data/orders.csv with filesystem MCP, infer types, and load into /tmp/analysis.db as table orders via sqlite MCP.✓ Copied
sqlite + antv-chart

Query a SQLite DB and chart the results

From /tmp/analysis.db, get monthly signups for 2026. Render as a bar chart via antv-chart.✓ Copied
sqlite + github

Analyze data, write findings into a GitHub Issue

Run my churn analysis on /tmp/users.db. Create a GitHub Issue in acme/analytics summarizing the top 3 findings with the SQL appendix.✓ Copied

Tools

What this MCP exposes

ToolInputsWhen to callCost
list_tables none First step in any session free
describe_table table_name: str Inspect a single table's schema free
read_query query: str (SELECT only) Run a SELECT — safe by default free
write_query query: str (INSERT/UPDATE/DELETE) Mutate data — gated; requires explicit consent in most clients free
create_table query: str (CREATE TABLE ...) DDL — create or alter schema free
append_insight insight: str Add a finding to the session memo (used by some clients to build a report) free

Cost & Limits

What this costs to run

API quota
Unlimited — local
Tokens per call
Schema queries: small. Result sets scale with row count — always LIMIT for exploratory queries
Monetary
Free
Tip
Add LIMIT 100 to every exploratory query and only remove it when you know what you're getting back.

Security

Permissions, secrets, blast radius

Credential storage: No credentials. The DB file is whatever path you launch with via --db-path.
Data egress: None from the server. Query results ship to your LLM provider as context.
Never grant: never point at a file holding sensitive data unless you intend the model to see it

Troubleshooting

Common errors and fixes

database is locked

Another process (often the app that owns the DB) holds the lock. Close that process or copy the .db file and query the copy.

Verify: lsof <db file>
no such table: X

Wrong DB file or schema not what you think. Run list_tables to see what's actually there. Check the launch arg --db-path in your MCP client config.

datatype mismatch / unexpected NULL

SQLite is dynamically typed — a column declared INTEGER can hold TEXT. Use CAST(col AS INTEGER) defensively, or fix at load.

Disk image is malformed

DB corrupted, often from killing a process during a write. Try sqlite3 file.db .recover > out.sql and rebuild from the dump.

Alternatives

SQLite vs others

AlternativeWhen to use it insteadTradeoff
Postgres MCPMulti-user concurrent access, networked DB, or you're already on PostgresNeeds a server; Postgres MCP is read-only by design
DuckDB (via shell)Same one-file model but for OLAP-shaped analytics with much faster scansNo first-party MCP yet; columnar so different perf characteristics
dbHubYou need one MCP for SQLite + Postgres + MySQL + othersNewer; less battle-tested

More

Resources

📖 Read the official README on GitHub

🐙 Browse open issues

🔍 Browse all 400+ MCP servers and Skills