Sqlite MCP — Local Database for AI Agents
Official MCP server for SQLite databases. Let Claude Code query, analyze, and modify local SQLite databases through natural language. Zero-config, instant setup.
What it is
SQLite MCP is the official Model Context Protocol server for SQLite databases. It gives AI agents like Claude Code the ability to query, analyze, and modify SQLite databases through natural language. The server exposes database operations as MCP tools, so the agent can run SQL queries, inspect schemas, and write data without you writing any code.
This server is for developers who use SQLite as a local database and want their AI coding assistant to interact with it directly. It is particularly useful for data exploration, quick analysis, and prototyping database-backed features.
How it saves time or tokens
Without the MCP server, you would need to write SQL queries manually, copy results into your conversation, and iterate. With SQLite MCP, the agent reads the schema, writes queries, executes them, and interprets results in one step. This workflow provides the MCP configuration JSON that you paste into your project config file.
How to use
- Add the SQLite MCP server to your
.mcp.json:
{
"mcpServers": {
"sqlite": {
"command": "uvx",
"args": ["mcp-server-sqlite", "--db-path", "./data/app.db"]
}
}
}
- Restart Claude Code or your MCP-compatible client.
- Ask the agent to interact with your database:
'Show me the schema of the users table'
'Find the top 10 orders by total amount'
'Create a new table for tracking events'
Example
{
"mcpServers": {
"sqlite": {
"command": "uvx",
"args": [
"mcp-server-sqlite",
"--db-path", "./analytics.db"
]
}
}
}
Once configured, the agent can run queries like:
SELECT date, COUNT(*) as visits, AVG(duration) as avg_duration
FROM page_views
WHERE date >= date('now', '-7 days')
GROUP BY date
ORDER BY date;
Related on TokRepo
- MCP SQLite integration -- Deep dive into SQLite MCP capabilities
- Database tools -- Other database tools for AI-assisted development
Common pitfalls
- The database file path must be accessible from the directory where the MCP server runs. Relative paths are resolved from the project root.
- SQLite MCP gives the agent write access by default. For read-only exploration, add
--read-onlyto the args array to prevent accidental modifications. - Large databases with millions of rows can cause slow query responses. The agent should use LIMIT clauses for initial exploration.
Frequently Asked Questions
It is an official Model Context Protocol server that exposes SQLite database operations as tools. AI agents can query schemas, run SQL, and modify data through the MCP interface without you writing code.
No. The MCP server includes SQLite bindings. You only need uvx (the Python package runner) installed. The server handles database connections internally.
Yes, by default the server has read-write access. To prevent modifications, add the --read-only flag to the args array in your MCP configuration. This restricts the agent to SELECT queries only.
It works with any MCP-compatible client. Claude Code, Cursor, and other tools that implement the Model Context Protocol can use this server. The MCP standard ensures interoperability.
Yes. Add multiple entries in your mcpServers configuration with different names and database paths. Each entry creates an independent server instance connected to its own database file.
Citations (3)
- MCP Servers GitHub— Official MCP server for SQLite databases
- MCP Documentation— Model Context Protocol specification for tool integration
- SQLite Official— SQLite is a self-contained, serverless SQL database engine
Related on TokRepo
Source & Thanks
Created by Anthropic. Licensed under MIT.
modelcontextprotocol/servers — Official MCP servers collection