An MCP server that provides AI with direct access to SQLite databases.
Project description
MCP SQLite Tool
An MCP server that provides AI with secure and direct access to SQLite databases.
🌟 Features
- Secure Access: Allows AI to interact with SQLite databases while validating file paths to prevent unauthorized access.
- Single-File Server: The core logic is contained in a single Python file, making it easy to understand and maintain.
- Standard I/O (stdio) Transport: Implements the official MCP protocol using standard I/O for seamless integration with tools like VS Code.
- Pythonic & Easy to Use: Built with the
fastmcpframework, which uses decorators to simplify tool creation.
🚀 Installation
This tool is available as a package on PyPI. You can install it using pip.
pip install mcp-sqlite-tool
Note: This tool requires Python 3.10 or higher. The
mcp[cli]dependency will be installed automatically.
🤖 Usage with VS Code
To use this tool with an MCP-compatible client like VS Code, you need to configure your workspace to discover and run the server.
-
Install the package: Ensure you have the
mcp-sqlite-toolpackage installed in the Python environment that VS Code is using.pip install mcp-sqlite-tool
-
Configure
settings.json: Open the Command Palette in VS Code (Ctrl+Shift+P), search for "Open Workspace Settings (JSON)", and add the following configuration:{ "mcpServers": { "sqlite-query": { "command": "mcp-sqlite-tool" } } }
"sqlite-query": This name identifies the server. It must match the name specified in the Python tool's code (FastMCP("sqlite-query"))."command": "mcp-sqlite-tool": This is the command-line entry point installed bypip. VS Code will use this to launch your server.
-
Interact with the AI: Once configured, the AI client will be able to use the tool
execute_sqlite_query. You can now prompt the AI to interact with your SQLite files.
Example Prompt
"Using the
sqlite-querytool, tell me the names and emails of all users in theuserstable ofC:\Users\John\Documents\project.db."
The AI will interpret this request and call your tool with the appropriate arguments.
🛠️ Tool Documentation
The core tool provided by this server is:
execute_sqlite_query
Executes a given SQL query on a specified SQLite database file.
| Parameter | Type | Description |
|---|---|---|
db_path |
str |
The absolute path to the SQLite database file. |
sql_query |
str |
The SQL query to execute. |
Returns: A dictionary containing the query results or an error message if the operation fails.
🤝 Contributing
Contributions, issues, and feature requests are welcome! If you have any issues, please contact me directly on Telegram (@mrbeandev).
📄 License
Distributed under the MIT License. See LICENSE for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_sqlite_tool-0.1.2.tar.gz.
File metadata
- Download URL: mcp_sqlite_tool-0.1.2.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cea9c33c98e291e3e4b2e5beaecb00b1fb02b1f3081d97cbbc2e0bdadc77dd3
|
|
| MD5 |
15396e5ffd1cdce1d8d177afd09ac5c9
|
|
| BLAKE2b-256 |
f06c82b33e92180d53122e7007435c79ec663454f0f457c83ad9c8c51253d471
|
File details
Details for the file mcp_sqlite_tool-0.1.2-py3-none-any.whl.
File metadata
- Download URL: mcp_sqlite_tool-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32ed69bcf7ed49e460565763d44b26a01b3fb543c85306beaffc069d2bb2fe89
|
|
| MD5 |
431b665637992c3e6f55c54b6329735f
|
|
| BLAKE2b-256 |
3ad030ce9972b7f6b629cac9e3fbe772afc52532348d850bd565faafe5b28f99
|