SQLite MCP Server
Provides comprehensive SQLite database interaction for AI agents, including data manipulation, schema inspection, and automated query logging. It features a unique context preservation pattern that uses a dedicated meta-table to help autonomous agents maintain self-documenting database architectures.
README
SQLite MCP Server
A Model Context Protocol (MCP) server that provides SQLite database interaction capabilities. This server allows AI agents (like Gemini CLI, Claude, etc.) to query and modify SQLite databases.
Features
- Read Data: Execute
SELECTqueries to retrieve data. - Write Data: Execute
INSERT,UPDATE,DELETE,CREATE, andDROPqueries. - Schema Inspection: List tables and describe table schemas.
- Logging: Automatically logs queries to daily files in the
log/directory.
Architecture Pattern (The "Memory" System)
This MCP server implements a Context Preservation Pattern designed for autonomous AI agents. Since agents lose context between sessions, this server enforces a self-documenting database structure.
The _architecture_notes Table
The server encourages agents to maintain a "meta-table" called _architecture_notes.
- Architect Agents (who create tables) MUST insert notes explaining why a table exists and how it works.
- Worker Agents (who process data) MUST read these notes to understand the system rules without needing a huge prompt context.
This turns the SQLite database into a self-contained, self-documented artifact.
Prerequisites
- Node.js: v14 or higher.
MCP Client Configuration
To use this server with your MCP client, you need to configure it to run the index.js script.
Option 1: Local Installation (Recommended for Development)
-
Clone the repository:
git clone https://github.com/u1pns/sqlite-mcp.git cd sqlite-mcp -
Install dependencies:
npm install -
Configure Environment Variables:
Gemini CLI (
settings.json)Add this to your
mcpServersobject in the.gemini/settings.jsonfile:{ "mcpServers": { "sqlite-mcp": { "command": "node", "args": ["/absolute/path/to/sqlite-mcp/index.js"], "env": { "SQLITE_DB_PATH": "/absolute/path/to/your/database.sqlite" } } } }If
SQLITE_DB_PATHis not provided, it defaults todatabase.sqlitein thesqlite-mcpdirectory.
Option 2: Using npx (No installation required)
You can run the server directly from GitHub without cloning the repo.
Gemini CLI (settings.json)
{
"mcpServers": {
"sqlite-mcp": {
"command": "npx",
"args": ["-y", "github:u1pns/sqlite-mcp"],
"env": {
"SQLITE_DB_PATH": "/absolute/path/to/my/db.sqlite"
}
}
}
}
Note: The -y flag is important to auto-accept the package installation.
Tools
connect_database
Connect to a specific SQLite database file.
db_path(string): The absolute path to the SQLite database file.- Note: If a relative path is provided, the database will be created inside the MCP server's directory, not the user's current directory. Always prefer absolute paths.
- Feature: Automatically returns custom instructions and best practices (from
instructions.md) upon successful connection.
read_query
Execute a SELECT query.
query(string): The SQL query (must start with SELECT or PRAGMA).
write_query
Execute a write query.
query(string): The SQL query.
list_tables
List all tables in the database.
describe_table
Get schema info for a specific table.
table_name(string): Name of the table.
get_schema_ddl
Returns the full CREATE TABLE statements for the entire database.
- Use this instead of guessing table structures. It provides the ground truth of the database schema.
get_custom_instructions
Returns the content of instructions.md. Useful for re-reading best practices without reconnecting.
License
MIT License
Copyright (c) 2024 u1pns
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。