Skip to main content
Glama
santos-404

SQLite MCP Server

by santos-404

SQLite MCP 服务器

使用 TypeScript 实现的模型上下文协议 (MCP) 服务器,用于与 SQLite 数据库交互。该服务器提供了一个交互式界面,用于执行 SQL 查询、管理数据库模式以及整合业务洞察——所有这些都在一个可扩展的协议框架内完成。

不熟悉 MCP?请查看下方“什么是 MCP?”部分。

特征

命令

描述

例子

list_tables

列出 SQLite 数据库上的所有表

-

read_query

在 SQLite 数据库上执行 SELECT 查询

SELECT * FROM users WHERE age > 18

Related MCP server: ExecuteAutomation Database Server

安装和设置

git clone https://github.com/javsanmar5/mcp-server.sqlite.git
cd mcp-server.sqlite

由于这尚未作为 npm 包发布,我们将重点介绍 Docker 安装方法:

1.构建Docker镜像

docker build -t mcp/sqlite .

2. 配置你的AI客户端

将以下内容添加到您的 AI 客户端的配置文件中:

"mcpServers": {
  "sqlite": {
    "command": "docker",
    "args": [
      "run",
      "--rm",
      "-i",
      "-v",
      "mcp-test:/mcp",
      "mcp/sqlite",
      "--db-path",
      "test_db.sqlite3"
    ]
  }
}

如果您不知道 json 文件是什么,您可能需要查看客户端配置指南。

3. 重启你的AI客户端

重启后,MCP 工具应该会出现在您的 AI 客户端界面中。在 Windows 系统中,您可能需要手动终止该进程以使更改生效。

文档

什么是 MCP?

模型上下文协议 (MCP) 是 AI 模型与外部工具和服务交互的标准化方式。它允许 AI 助手通过定义的协议接口执行诸如运行数据库查询、访问外部 API 或操作文件等操作。

MCP 通过提供对工具和数据源的结构化访问(无需直接集成到 AI 模型本身)将 AI 功能扩展到对话之外。

教程:使用 Claude Desktop 进行设置

Claude Desktop 是众多支持 MCP 服务器的 AI 客户端之一。以下是在 Windows 上设置的方法:

  1. 按Windows Key + R打开运行对话框

  2. 输入%appdata%\Claude并按 Enter

  3. 如果不存在,请创建一个名为claude_desktop_config.json的新文件

  4. 添加上述设置说明第 2 步中的配置

  5. 保存文件并重新启动Claude Desktop

  6. 您现在应该可以在 Claude 界面中看到 SQLite 工具

执照

该项目已获得 MIT 许可。

贡献

这个项目主要是为了学习而创建的。不过,如果你想贡献代码,请随时提交 Pull 请求,我会审核。

感谢您的关注!

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    C
    maintenance
    A Model Context Protocol server that enables SQL operations (SELECT, INSERT, UPDATE, DELETE) and table management through a standardized interface with SQLite databases.
    7
    43 npm
    1
    ISC
  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that enables LLMs like Claude to interact with SQLite and SQL Server databases, allowing for schema inspection and SQL query execution.
    693 npm
    386
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    A Model Context Protocol server that enables AI assistants to interact with SQLite databases by connecting to database files, listing tables, describing schemas, and executing queries.
    6
    119 npm
    2
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Implements a Model Context Protocol server that enables natural language interactions with SQLite databases, providing tools to list tables, retrieve schemas, count rows, and execute read-only SQL queries.
    MIT