{"id":18537,"library":"mcp-sqlite","title":"MCP SQLite Server","description":"An MCP (Model Context Protocol) server providing SQLite database interaction for AI agents. Version 1.0.9 (April 2026) includes critical SQL injection vulnerability fixes (CWE-89). The server exposes CRUD operations (create_record, read_records, update_records, delete_records), database introspection (list_tables, get_table_schema, db_info), and custom SQL execution. It is designed to be run as a stdio-based MCP tool in IDEs like Cursor, VS Code, and Windsurf. Compared to raw better-sqlite3 usage, it abstracts SQL via MCP tool calls and validates identifiers against sqlite_master. Requires Node >= 14.","status":"active","version":"1.0.9","language":"javascript","source_language":"en","source_url":"https://github.com/jparkerweb/mcp-sqlite","tags":["javascript","mcp","sqlite","database","llm","cursor","windsurf","ide","development"],"install":[{"cmd":"npm install mcp-sqlite","lang":"bash","label":"npm"},{"cmd":"yarn add mcp-sqlite","lang":"bash","label":"yarn"},{"cmd":"pnpm add mcp-sqlite","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Underlying SQLite database engine","package":"better-sqlite3","optional":false}],"imports":[{"note":"Primary usage is via npx, not as programmatic import. The package is a CLI server.","wrong":"npm install mcp-sqlite && node node_modules/.bin/mcp-sqlite <path>","symbol":"mcp-sqlite (CLI)","correct":"npx -y mcp-sqlite <path-to-db>"},{"note":"All operations use MCP tools/call with proper method name. Direct method calls are invalid.","wrong":"{\"method\":\"create_record\",\"params\":{\"table\":\"users\",\"data\":{}}}","symbol":"MCP tools (via JSON-RPC)","correct":"{\"method\":\"tools/call\",\"params\":{\"name\":\"create_record\",\"arguments\":{\"table\":\"users\",\"data\":{\"name\":\"John\"}}}}"},{"note":"Cursor uses 'mcpServers' key; VS Code uses 'servers' key. The args array must include '-y' before the package name.","wrong":"{\"mcpServers\":{\"mcp-sqlite\":{\"command\":\"npx\",\"args\":[\"mcp-sqlite\",\"path\"]}}}","symbol":"Configuration (Cursor)","correct":"{\"mcpServers\":{\"MCP SQLite Server\":{\"command\":\"npx\",\"args\":[\"-y\",\"mcp-sqlite\",\"path/to/db.db\"]}}}"},{"note":"VS Code uses a different structure with 'type':'stdio' and 'servers' key.","wrong":"{\"mcpServers\":{...}}","symbol":"Configuration (VS Code)","correct":"{\"servers\":{\"MCP SQLite Server\":{\"type\":\"stdio\",\"command\":\"npx\",\"args\":[\"-y\",\"mcp-sqlite\",\"path/to/db.db\"]}}}"}],"quickstart":{"code":"// Create an SQLite database and run a Cursor MCP server example\n// First, create a test database:\n$ touch test.db\n// Add Cursor MCP configuration to ~/.cursor/mcp.json:\n{\n  \"mcpServers\": {\n    \"MCP SQLite Server\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mcp-sqlite\", \"/absolute/path/to/test.db\"]\n    }\n  }\n}\n// Restart Cursor and call the tool via MCP:\n// \"list_tables\" returns empty if no tables\n// Example create_record call:\n{\n  \"method\": \"tools/call\",\n  \"params\": {\n    \"name\": \"create_record\",\n    \"arguments\": {\n      \"table\": \"users\",\n      \"data\": {\n        \"name\": \"Alice\",\n        \"email\": \"alice@example.com\"\n      }\n    }\n  }\n}\n// Response: {\"content\":[{\"type\":\"text\",\"text\":\"Record created: id=1\"}]}\n// Note: database path must be absolute or relative to CWD","lang":"typescript","description":"Demonstrates setting up mcp-sqlite with Cursor, creating a table, inserting a record, and reading it back via MCP tools."},"warnings":[{"fix":"Update to v1.0.9 or later.","message":"SQL injection vulnerability (CWE-89) fixed in v1.0.9 - table and column names must be validated against sqlite_master; older versions allow arbitrary SQL via crafted table/column names.","severity":"breaking","affected_versions":"<1.0.9"},{"fix":"Ensure your MCP client supports the new schema structure. No action needed for v1.0.8+.","message":"Zod v3 compatibility is deprecated since v1.0.8; tool definitions now use explicit string keys to support Zod v4.","severity":"deprecated","affected_versions":">=1.0.8"},{"fix":"Use correct VS Code configuration: { 'servers': { 'name': { 'type':'stdio', 'command':'npx', 'args':['-y','mcp-sqlite','path'] } } }","message":"VS Code MCP integration requires stricter JSON schema validation since v1.0.7; missing 'type':'stdio' or wrong key names cause tool registration failure.","severity":"breaking","affected_versions":">=1.0.7"},{"fix":"Always pass the path to your SQLite database file as the last argument to npx.","message":"Database path must be provided as a command-line argument; the server cannot work without a valid path.","severity":"gotcha","affected_versions":"all"},{"fix":"Use npx to run the server. Do not attempt to require('mcp-sqlite').","message":"The package is a CLI/server and cannot be imported programmatically in Node.js; there is no exported API.","severity":"gotcha","affected_versions":"all"},{"fix":"Check your IDE's documentation for the correct configuration key.","message":"Cursor uses 'mcpServers' key while VS Code uses 'servers' key; using wrong key results in tools not being registered.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure the database file exists and the path is correct. Restart Cursor/VS Code after configuration changes.","cause":"MCP server process crashed or database path is invalid.","error":"Error: Connection closed"},{"fix":"Run 'npx mcp-sqlite' with the correct package name. If using npx, ensure you have internet access.","cause":"npx cannot find the package; likely due to network issues or npm registry problems.","error":"npx: command not found: mcp-sqlite"},{"fix":"Verify the table exists using 'list_tables' first. Update to v1.0.9 for security fixes.","cause":"Trying to get schema of a non-existent table or using an older version without proper validation.","error":"TypeError: Cannot read properties of undefined (reading 'columns')"},{"fix":"Ensure method is 'tools/call' and arguments follow the documented structure (e.g., 'data' must be an object).","cause":"MCP tool arguments format is incorrect, e.g., passing data as a string instead of object.","error":"ValidationError: Expected string, received object"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}