MCP SQLite Server (npx)
This package provides a Node.js implementation of the Model Context Protocol (MCP) SQLite server, currently at version `0.8.0`. It serves as an npx-based alternative to the official Python reference implementation, specifically designed for environments where the Python UVX runner is unavailable or impractical, such as certain Node.js-centric applications like LibreChat. The server allows applications to interact with an SQLite database via the MCP protocol. Its release cadence appears to be driven by feature development and integration needs, rather than a fixed schedule. A key differentiator is its enablement of MCP SQLite functionality within Node.js ecosystems without requiring Python installations, making it suitable for environments where only Node.js is readily available.
Common errors
-
npx: command not found
cause Node.js and its accompanying package runner, npx, are not installed or are not accessible in the system's PATH.fixInstall Node.js (which bundles npm and npx) from the official Node.js website. Verify that the Node.js installation directory is correctly added to your system's PATH environment variable. -
Error: ENOENT: no such file or directory, open '/absolute/path/to/database.db'
cause The specified SQLite database file path provided as an argument to the server does not exist or the process lacks the necessary permissions to access it.fixVerify the absolute path to your SQLite database file. Ensure the file exists, or create an empty `.db` file if it's new. Check that the user account running the `mcp-server-sqlite-npx` process has read and write permissions to the database file and its parent directory. -
Failed to launch server: command '...' not found (when configured in client application)
cause The `command` path specified in a client's configuration (e.g., `claude_desktop_config.json`) for `npx` or `node` is incorrect, not absolute, or the specified executable is missing, preventing the client from successfully launching the server process.fixDouble-check the absolute path to your `npx` or `node` executable (e.g., `/Users/{username}/.nvm/versions/node/vX.Y.Z/bin/npx` on macOS/Linux, or `C:\Program Files\nodejs\npx.cmd` on Windows). Ensure the path is correct and accessible by the client application.
Warnings
- gotcha When configuring `mcp-server-sqlite-npx` for clients like Claude Desktop, absolute paths are generally required for the `command`, `args`, and `env` variables. Relative paths may lead to execution failures or environment variable issues, especially across different user contexts or operating systems.
- gotcha The `mcp-server-sqlite-npx` package is primarily an executable server, not a library designed for programmatic import into other JavaScript or TypeScript applications. Attempting to `import` or `require` its internal modules for direct use may lead to unexpected behavior, API instability, or lack of defined exports.
- gotcha Incorrect configuration of `NODE_PATH` or `PATH` within the `env` section of `claude_desktop_config.json` can prevent `npx` or `node` from finding required executables or modules, especially when using Node.js version managers (like NVM) or custom installations.
Install
-
npm install mcp-server-sqlite-npx -
yarn add mcp-server-sqlite-npx -
pnpm add mcp-server-sqlite-npx
Imports
- npx mcp-server-sqlite-npx
npx -y mcp-server-sqlite-npx /absolute/path/to/database.db
- node dist/index.js
node /absolute/path/to/dist/index.js /absolute/path/to/database.db
- mcpServers.sqlite configuration
{ "mcpServers": { "sqlite": { "command": "/absolute/path/to/npx", "args": ["-y", "mcp-server-sqlite-npx", "/absolute/path/to/database.db"], "env": { "PATH": "...", "NODE_PATH": "..." } } } }
Quickstart
// First, ensure you have Node.js and npm/npx installed.
// Create a SQLite database file, e.g., 'my_database.db', or use an existing one.
// Replace '/absolute/path/to/my_database.db' with your actual database file path.
// To test the server using the MCP Inspector tool, run the following command in your terminal:
// This command will install the inspector temporarily via npx, then use it to launch
// and connect to the mcp-server-sqlite-npx instance.
// If you have cloned the mcp-server-sqlite-npx repository and built it (npm ci && npm run build):
// npx @modelcontextprotocol/inspector node dist/index.js /absolute/path/to/my_database.db
// If you are using the published npm package directly, and assuming mcp-server-sqlite-npx
// is in your node_modules (e.g. from a prior `npm i mcp-server-sqlite-npx` or `npx ...` call):
console.log("Starting MCP SQLite server via npx and connecting with Inspector...");
console.log("Run this command in your terminal:");
console.log("\nnpx @modelcontextprotocol/inspector npx mcp-server-sqlite-npx /absolute/path/to/my_database.db\n");
console.log("Replace '/absolute/path/to/my_database.db' with the actual path to your SQLite file.");
console.log("After launching, connect and go to the 'Tools' tab in the Inspector to interact with the server.");