# 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. ## Install Merge the JSON below into your `.mcp.json`: ## Quick Use Add to your `.mcp.json`: ```json { "mcpServers": { "sqlite": { "command": "uvx", "args": ["mcp-server-sqlite", "--db-path", "./data/app.db"] } } } ``` Restart Claude Code. Ask "show me all tables" or "find users who signed up this week". ## What is SQLite MCP? SQLite MCP is an official Model Context Protocol server that connects AI agents to SQLite databases. It lets Claude Code, Cline, and other MCP clients query, analyze, and modify local SQLite databases through natural language — with zero configuration beyond pointing to your `.db` file. **Answer-Ready**: SQLite MCP is an official MCP server that connects AI agents like Claude Code to local SQLite databases. Query, analyze, and modify data through natural language with zero-config setup. Part of the official MCP server collection. **Best for**: Developers who want Claude Code to interact with local SQLite databases. **Works with**: Claude Code, Cline, any MCP-compatible client. **Setup time**: Under 1 minute. ## Core Features ### 1. Natural Language Queries ``` You: "Show me all users who signed up in the last 7 days" Claude Code: Runs SELECT * FROM users WHERE created_at > datetime('now', '-7 days') → Returns formatted table of 23 users You: "What's the average order value by country?" Claude Code: Runs SELECT country, AVG(total) FROM orders GROUP BY country ORDER BY AVG(total) DESC → Returns ranked list with averages ``` ### 2. Available Tools | Tool | Description | |------|-------------| | `read_query` | Execute SELECT queries | | `write_query` | Execute INSERT/UPDATE/DELETE | | `create_table` | Create new tables | | `list_tables` | Show all tables | | `describe_table` | Show table schema | | `append_insight` | Save analysis notes | ### 3. Schema Exploration ``` You: "What tables exist and what's in them?" Claude Code: → list_tables: users, orders, products, reviews → describe_table for each → Summary: "4 tables with 15,000 total rows..." ``` ### 4. Data Analysis ``` You: "Analyze the orders table and find trends" Claude Code: → Queries order counts by month → Calculates growth rates → Identifies top products → Returns markdown report with insights ``` ### 5. Safe Write Operations ``` You: "Add a 'last_login' column to the users table" Claude Code: Asks for confirmation before executing → ALTER TABLE users ADD COLUMN last_login DATETIME → Confirms: "Column added successfully" ``` ### 6. Multiple Database Support ```json { "mcpServers": { "app-db": { "command": "uvx", "args": ["mcp-server-sqlite", "--db-path", "./data/app.db"] }, "analytics-db": { "command": "uvx", "args": ["mcp-server-sqlite", "--db-path", "./data/analytics.db"] } } } ``` ## Use Cases | Use Case | Example | |----------|---------| | Data exploration | "What's in this database?" | | Bug investigation | "Find orders with negative totals" | | Report generation | "Monthly revenue by category" | | Data migration | "Create a new normalized schema" | | Prototyping | "Set up tables for a todo app" | ## FAQ **Q: Is it safe to use on production databases?** A: SQLite MCP supports read-only mode. For production, use `--read-only` flag to prevent accidental writes. **Q: Does it work with other databases?** A: This server is SQLite-specific. For PostgreSQL, use `@modelcontextprotocol/server-postgres`. **Q: Can it handle large databases?** A: Yes, queries are executed directly by SQLite. For very large result sets, the AI will add LIMIT clauses automatically. ## Source & Thanks > Created by [Anthropic](https://github.com/modelcontextprotocol). Licensed under MIT. > > [modelcontextprotocol/servers](https://github.com/modelcontextprotocol/servers) — Official MCP servers collection ## 快速使用 在 `.mcp.json` 中指向你的 `.db` 文件,重启 Claude Code 即可用自然语言查询数据库。 ```json { "mcpServers": { "sqlite": { "command": "uvx", "args": ["mcp-server-sqlite", "--db-path", "./data/app.db"] } } } ``` ## 什么是 SQLite MCP? 官方 MCP 服务器,将 AI 代理连接到本地 SQLite 数据库。用自然语言查询、分析和修改数据。 **一句话总结**:官方 MCP 服务器,让 Claude Code 用自然语言查询本地 SQLite 数据库,零配置即用。 **适合人群**:需要 Claude Code 与本地数据库交互的开发者。 ## 核心功能 ### 1. 自然语言查询 描述需求,自动生成 SQL 执行。 ### 2. Schema 探索 列出表、查看结构、理解数据。 ### 3. 数据分析 趋势分析、聚合统计、生成报告。 ### 4. 安全写操作 修改前确认,支持只读模式。 ## 常见问题 **Q: 生产数据库安全吗?** A: 支持 `--read-only` 只读模式。 **Q: 支持其他数据库吗?** A: 仅 SQLite。PostgreSQL 用 `server-postgres`。 ## 来源与致谢 > [modelcontextprotocol/servers](https://github.com/modelcontextprotocol/servers) — 官方 MCP 服务器, MIT --- Source: https://tokrepo.com/en/workflows/f67139b3-1666-4c8a-93d9-29c9c29e6ab2 Author: MCP Hub