This guide walks through connecting a SQLite file to Claude Code using QueryBear’s managed MCP server. End result: Claude Code can query a local SQLite database safely — read-only, noDocumentation Index
Fetch the complete documentation index at: https://docs.querybear.com/llms.txt
Use this file to discover all available pages before exploring further.
ATTACH DATABASE, every query logged.
What you’ll need
- A QueryBear account (sign up free)
- A SQLite file (
.sqlite,.db, etc.) - Claude Code installed
Step 1: Add the SQLite connection to QueryBear
In the QueryBear dashboard → Connections → New connection → SQLite:- File path — absolute path on the machine running the QueryBear connector (e.g.
/Users/alice/data/analytics.sqlite).
Step 2: Add QueryBear to Claude Code
Step 3: Authorize and verify
“What QueryBear tools do you have? List my connections.”
Try it
“In the analytics SQLite DB, find the top 10 user agents by session count last week.”Claude calls
get_schema, writes the query, and runs it through QueryBear.
SQLite + Claude Code gotchas
ATTACH DATABASEis blocked. Even if Claude writes one, QueryBear rejects it at the parser. Without this block, an injected prompt could attach/etc/passwdas a database.- Most
PRAGMAstatements are restricted to a safe allow-list. Schema-introspection pragmas work; runtime-modifying ones are blocked. - WAL mode is respected — if the source app is actively writing, QueryBear’s read-only access doesn’t interfere.
- JSON1 functions work (
json_extract,->,->>). - FTS5 virtual tables are queryable.
Use cases
- Analyze Apple Notes:
~/Library/Group Containers/group.com.apple.notes/NoteStore.sqlite(back up first). - Browser history: Chrome’s
Historyfile, Firefox’splaces.sqlite. - Electron app debugging.
- Shipped datasets in SQLite format.
Related
- SQLite MCP server — SQLite-specific deep dive
- Claude Code client — Claude Code overview
- Security model — what the gateway protects against