Back to blog

How to Set Up a SQLite MCP Server With ChatGPT

Spencer Pauly
Spencer Pauly
4 min read
How to Set Up a SQLite MCP Server With ChatGPT

Our support manager, Dana, was trying to figure out whether the onboarding redesign was actually working. Her question was simple: "How many users have completed onboarding this month?" But getting an answer meant opening a Retool dashboard nobody had updated in six months, or waiting for an engineer to run a query. Dana already had ChatGPT open. She uses it for everything. The database was on Turso. All that was missing was a connection between them.

This post is how to wire that up.

Part of the SQLite MCP Server guide.

What you'll need

  • A SQLite database accessible via Turso or another libSQL endpoint (this also works with a standard SQLite file through Turso's HTTP API)
  • A QueryBear account (free to start at querybear.com)
  • ChatGPT Pro, Plus, Team, or Enterprise subscription

Why route through a gateway

You don't want to paste a production database URL into any AI tool's context. QueryBear's gateway rejects mutations at the parser level, exposes only the tables you've approved, and logs every query. The SQLite MCP Server guide goes into the full security model if you want it.

Connect QueryBear to your SQLite database

QueryBear connects to SQLite via Turso/libSQL over HTTP. You'll need a Turso database URL (it looks like libsql://your-db.turso.io) and an auth token from your Turso dashboard.

  1. Open the QueryBear dashboard and click "New connection."
  2. Choose SQLite/Turso. Paste your libSQL URL and auth token.
  3. Under "Allowed tables," pick the tables the agent should see. For a product database, that's usually something like users, events, sessions, feature_flags.
  4. Under "Blocked columns," add anything sensitive: API keys, tokens, anything you wouldn't want surfaced in a chat window. Save.

QueryBear uses @libsql/client under the hood, so the connection works the same whether you're on Turso, Fly.io's distributed SQLite, or any compatible libSQL endpoint.

Install the QueryBear MCP server in ChatGPT

ChatGPT's MCP support requires Developer Mode, which is a few layers deeper in Settings than most people expect. You'll need a paid subscription: Pro, Plus, Team, or Enterprise.

  1. Open ChatGPT and go to Settings.
  2. Navigate to Connectors, then Advanced, then toggle on Developer mode.
  3. Click "Add new connector." Name it querybear, URL: https://mcp.querybear.com/mcp.
  4. Authorize via OAuth.

That's it. ChatGPT now has list_connections, get_schema, and run_query available from QueryBear.

Ask your first question

Dana asked exactly what she'd been wondering:

I asked: "How many users have completed onboarding this month?"

ChatGPT generated this query and ran it through QueryBear:

SELECT COUNT(*) AS completed_onboarding
FROM users
WHERE onboarding_completed_at >= datetime('now', 'start of month');

Got back 214. Dana had her answer in about two seconds and forwarded it to the product team before lunch.

One note on SQLite's type system: onboarding_completed_at needs to be stored as an ISO 8601 string for datetime() comparisons to work correctly. SQLite's dynamic typing means the column could technically hold anything, so if results look wrong, check the actual values in the column first.

A ChatGPT-specific tip

Create a custom GPT pre-loaded with the connector, then share the link with your team. On ChatGPT Team, you can build a GPT, attach the QueryBear connector, write a short system prompt explaining what tables are available, and share the link. Support managers, product managers, anyone with a ChatGPT seat can ask questions without knowing Developer Mode exists.

If Developer Mode shifts around in the UI (it's happened before as OpenAI updates the Connectors settings), your connector URL is always findable in the QueryBear dashboard under "MCP." The URL doesn't change.

Using a different tool?

Querying a different database?

Database Access

Give Your AI Agents
Database Access. Securely.

Connect any database. Control permissions. Audit every query. All running locally on your machine.