Database interaction and business intelligence via SQLite
## SQLite MCP Server: Lightweight Database Operations The **SQLite MCP Server** brings the world's most widely deployed database engine directly into Google Antigravity. Query, modify, and manage SQLite databases using natural language commands—perfect for local development, prototyping, and applications that need embedded database functionality. ### Why SQLite MCP? SQLite powers billions of applications from mobile apps to web browsers. The SQLite MCP makes database interactions conversational: - **Zero Configuration**: No server setup required - **Full SQL Support**: Complete SQL syntax with extensions - **File-Based**: Each database is a single portable file - **Cross-Platform**: Works identically on all platforms - **ACID Compliant**: Reliable transaction support ### Key Features #### 1. Query Execution Run SQL queries naturally: ``` "Show me all users who signed up this month" "Select the top 10 products by revenue" "Count orders grouped by status" "Find customers with no recent purchases" ``` Supports: - SELECT with complex JOINs - Aggregations and window functions - Subqueries and CTEs - Full-text search with FTS5 #### 2. Schema Management Design and modify database schemas: ``` "Create a users table with id, email, and created_at" "Add a phone column to the customers table" "Create an index on the orders.customer_id column" "Show me the schema for all tables" ``` Operations: - CREATE, ALTER, DROP tables - Index management - View creation - Trigger definition #### 3. Data Manipulation Insert, update, and delete data: ``` "Insert a new product with name Widget and price 29.99" "Update all expired subscriptions to inactive" "Delete test records from the orders table" "Import data from the CSV file" ``` #### 4. Database Analysis Understand your data: ``` "Show the size of each table" "Analyze query performance" "Check for duplicate records" "Find tables without indexes" ``` #### 5. Backup and Export Manage database files: ``` "Create a backup of the database" "Export the users table to CSV" "Dump the schema as SQL" ``` ### Configuration Set up SQLite MCP: ```json { "mcpServers": { "sqlite": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-sqlite", "/path/to/database.db" ] } } } ``` ### Common Workflows #### New Project Setup ``` 1. "Create a new database for the project" 2. "Create users, posts, and comments tables" 3. "Add foreign key relationships" 4. "Insert sample data for development" ``` #### Data Analysis ``` 1. "Show table statistics" 2. "Find the most active users" 3. "Calculate monthly revenue trends" 4. "Export results to CSV" ``` #### Database Maintenance ``` 1. "Check database integrity" 2. "Vacuum to reclaim space" 3. "Rebuild fragmented indexes" 4. "Create a backup before migration" ``` ### SQLite Features #### JSON Support Work with JSON data: ```sql "Select users where json_extract(settings, '$.theme') = 'dark'" "Update user preferences using json_set" ``` #### Full-Text Search Enable FTS5 for text search: ``` "Create a full-text search index on articles" "Search for documents containing machine learning" ``` #### Window Functions Advanced analytics: ``` "Rank customers by total purchase amount" "Calculate running totals by date" "Find the top 3 products per category" ``` ### Best Practices 1. **Use Transactions**: Wrap related operations in transactions 2. **Index Wisely**: Create indexes for frequently queried columns 3. **Vacuum Regularly**: Reclaim space after bulk deletes 4. **Backup Often**: SQLite files are easy to backup 5. **Use Prepared Statements**: Prevent SQL injection ### Performance Optimization Tips for faster queries: - Create appropriate indexes - Use EXPLAIN QUERY PLAN to analyze queries - Enable WAL mode for concurrent access - Limit result sets with LIMIT - Use covering indexes when possible ``` "Explain the query plan for this SELECT" "Enable WAL mode for better concurrency" "Analyze tables to update statistics" ``` ### Data Types SQLite's flexible type system: - **INTEGER**: Whole numbers - **REAL**: Floating-point numbers - **TEXT**: Character strings - **BLOB**: Binary data - **NULL**: Missing values ### Integration Patterns #### Development Databases Use SQLite for local development: ``` "Create a development database matching production schema" "Seed with test data" "Reset between test runs" ``` #### Embedded Applications Perfect for apps needing local storage: - Mobile applications - Desktop software - Browser extensions - CLI tools #### Data Processing Excellent for data pipelines: ``` "Import CSV into a staging table" "Transform and clean the data" "Export results for further processing" ``` ### Troubleshooting Common issues: - **Database Locked**: Enable WAL mode or use connection pooling - **Corrupt Database**: Run integrity check and restore from backup - **Slow Queries**: Add indexes and analyze query plans - **Disk Full**: Vacuum and archive old data ### Migration Support Move data between databases: ``` "Export schema and data as SQL" "Import from another SQLite database" "Convert from CSV or JSON" ``` The SQLite MCP Server makes database operations as simple as having a conversation, enabling rapid development and data analysis without leaving your IDE.
{
"mcpServers": {
"sqlite": {
"mcpServers": {
"sqlite": {
"args": [
"mcp-server-sqlite",
"--db-path",
"~/test.db"
],
"command": "uvx"
}
}
}
}
}