The SQLite MCP server lets your AI assistant query and manage local SQLite databases directly from the chat window. Point it at any .db or .sqlite file on your machine, and the AI can run SQL queries, explore schemas, create tables, and analyze data — no separate database server required. It is the simplest way to give your AI access to structured data for local development, prototyping, and data analysis.
Query Local SQLite Databases from Your AI Assistant
The SQLite MCP server connects your AI assistant to a local SQLite database file. SQLite is the most widely deployed database engine in the world — it powers mobile apps, desktop applications, browsers, and many local-first tools. With this MCP server, your AI can explore schemas, run read and write queries, create tables, and analyze data in any SQLite database on your machine. Since SQLite is just a file, there is no database server to install or configure — just point the server at a .db file and start querying. This makes it perfect for prototyping, analyzing app data, working with exported datasets, and local development.
Prerequisites
- Node.js 18 or later installed on your machine
- Claude Desktop, Cursor, or another MCP-compatible AI host
- An existing SQLite database file, or a path where you want to create one
Step-by-step guide
Locate or create a SQLite database file
Locate or create a SQLite database file
Identify the SQLite database you want your AI to access. Common locations include application data directories, project folders, and exported data files. SQLite databases typically have .db, .sqlite, or .sqlite3 file extensions. If you do not have one yet, the server can create a new database at the path you specify.
1Common SQLite database locations:2- iOS apps: ~/Library/Developer/CoreSimulator/.../Documents/*.db3- Android apps: data/data/<package>/databases/*.db4- Browser data: ~/.config/chromium/Default/History5- Project data: ./data/app.db6- New database: any path you choose, e.g., ~/Projects/my-data.dbExpected result: You have the absolute path to an existing SQLite database, or a path where a new one should be created.
Add the SQLite MCP server to your configuration
Add the SQLite MCP server to your configuration
Open your MCP host's configuration file and add a sqlite entry. The database file path is passed as the last argument in the args array. Use the @modelcontextprotocol/server-sqlite package with npx -y for automatic installation.
1{2 "mcpServers": {3 "sqlite": {4 "command": "npx",5 "args": [6 "-y",7 "@modelcontextprotocol/server-sqlite",8 "/Users/me/Projects/my-data.db"9 ]10 }11 }12}Expected result: Your configuration file contains the SQLite MCP server entry pointing to your database file.
Restart your AI host and verify the connection
Restart your AI host and verify the connection
Fully quit and reopen Claude Desktop, Cursor, or VS Code. The SQLite server will open (or create) the database file at the specified path. Its tools should appear in the available tools list. In Claude Desktop, the hammer icon indicates the tools are ready.
Expected result: The SQLite MCP server shows as connected with query and schema tools available.
Explore the database schema
Explore the database schema
Start by asking the AI to list tables and describe the schema. This is the safest first step and helps you understand what data is available before running queries.
1Example prompts:23"What tables are in this database and what columns does each have?"45"Describe the schema of the users table including data types"67"How many rows are in each table?"Expected result: The AI lists all tables, their columns, data types, and row counts from the SQLite database.
Query and analyze data with natural language
Query and analyze data with natural language
Ask questions about your data in plain English. The AI translates your questions into SQL queries, executes them against the SQLite database, and presents the results. Unlike the PostgreSQL MCP server, the SQLite server typically allows both read and write operations since SQLite databases are local files.
1Example prompts:23"Show me the 10 most recent entries in the activity_log table"45"How many users signed up each month? Show a breakdown"67"Find all records where the status column is 'pending' and the amount is over 100"Expected result: The AI generates SQL, executes it, and returns formatted query results.
Create tables and modify data
Create tables and modify data
Since SQLite databases are local files, the server allows write operations. You can ask the AI to create tables, insert data, update records, and even design schemas from scratch. This makes the SQLite MCP server ideal for prototyping database designs.
1Example prompts:23"Create a table called 'bookmarks' with columns for id, url, title, tags, and created_at"45"Insert 5 sample bookmark records with realistic data"67"Add an 'archived' boolean column to the bookmarks table with a default of false"Expected result: The AI creates tables, inserts data, or modifies the schema in the SQLite database.
Complete working example
1{2 "mcpServers": {3 "sqlite": {4 "command": "npx",5 "args": [6 "-y",7 "@modelcontextprotocol/server-sqlite",8 "/Users/me/Projects/my-data.db"9 ]10 }11 }12}1314// VS Code variant (.vscode/mcp.json):15// {16// "servers": {17// "sqlite": {18// "command": "npx",19// "args": [20// "-y",21// "@modelcontextprotocol/server-sqlite",22// "/Users/me/Projects/my-data.db"23// ]24// }25// }26// }2728// No API keys or environment variables required.29// The database file is created if it doesn't exist.3031// Available tools:32// - read_query: Run SELECT queries33// - write_query: Run INSERT/UPDATE/DELETE/CREATE queries34// - list_tables: List all tables in the database35// - describe_table: Get column details for a table36// - create_table: Create a new table with specified schema37// - append_insight: Store AI-generated analysis notes3839// SQLite database file locations:40// macOS: ~/Library/Application Support/<app>/41// Linux: ~/.local/share/<app>/42// Windows: %APPDATA%\<app>\Common mistakes when using the SQLite MCP server
Why it's a problem: Using a relative path to the database file
How to avoid: Always use an absolute path like /Users/me/Projects/data.db. Relative paths may not resolve correctly because the server process starts in an unpredictable working directory.
Why it's a problem: Pointing at a database that is locked by another application
How to avoid: SQLite allows only one writer at a time. If another application has the database open with a write lock, the MCP server may fail to write. Close other applications or use a copy of the database.
Why it's a problem: Modifying a production SQLite database without a backup
How to avoid: Always copy the .db file before letting the AI make changes. SQLite backups are just file copies. If something goes wrong, restore from the backup.
Why it's a problem: Expecting PostgreSQL-specific SQL syntax to work
How to avoid: SQLite has a different SQL dialect from PostgreSQL. Features like SERIAL, arrays, JSONB, and some JOIN types differ. The AI should handle this automatically, but if you paste SQL from a Postgres project, it may need adaptation.
Best practices
- Back up your database file before allowing write operations
- Use absolute paths to avoid working directory issues
- Start with schema exploration before running data queries
- Use the SQLite server for prototyping database designs before migrating to PostgreSQL
- Close other applications that might lock the database before starting the MCP server
- Combine with the filesystem MCP server to export query results to CSV or JSON files
- Use WAL mode (Write-Ahead Logging) for better concurrent read performance
- Ask the AI to explain the SQL it generates to learn and verify correctness
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
I want to set up the SQLite MCP server so my AI assistant can query a local SQLite database. Walk me through configuring it in Claude Desktop and show me how to explore the schema and run queries.
List all tables in the database, describe the schema of each one, then find the 5 most recent records from the events table and summarize the patterns you see.
Frequently asked questions
Can the AI create a new SQLite database from scratch?
Yes. If the database file does not exist at the specified path, the SQLite server creates a new empty database. You can then ask the AI to create tables and insert data through natural language.
What is the difference between the SQLite and PostgreSQL MCP servers?
The SQLite server works with local database files — no server process needed, supports read and write operations. The PostgreSQL server connects to a running Postgres server, typically enforces read-only access, and is better suited for production and remote databases.
Can I query a SQLite database from a mobile app or Electron app?
Yes. Many mobile and desktop apps use SQLite for local storage. Find the .db file in the app's data directory and point the MCP server at it. Be careful not to modify databases that are actively being used by another application.
How large of a database can the SQLite server handle?
SQLite can handle databases up to 281 terabytes. The MCP server should work fine with databases of any reasonable size. For very large query results, ask the AI to use LIMIT clauses to keep response sizes manageable.
Can I switch between different database files?
The database path is set in the configuration at startup time. To switch databases, update the path in your config file and restart your AI host. You can also add multiple sqlite entries with different names for different databases.
Is SQLite sufficient for my project, or should I use PostgreSQL?
SQLite is excellent for local development, prototyping, mobile apps, and single-user applications. For multi-user web applications with concurrent writes, PostgreSQL is the better choice. RapidDev can help you decide on the right database architecture and migrate between SQLite and PostgreSQL when your project is ready to scale.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation