返回 MCP 目录
public公开dns本地运行

mcp-sqlite

MCP SQLite Server是一个基于Model Context Protocol的服务器,提供全面的SQLite数据库交互功能,包括CRUD操作、数据库探索和自定义SQL查询执行。

article

README

🚀 🐇 MCP SQLite 服务器

MCP SQLite 服务器是一个提供全面 SQLite 数据库交互功能的模型上下文协议(MCP)服务器,可助力用户便捷地对 SQLite 数据库进行各类操作。

cursor-settings

🚀 快速开始

维护者

✨ 主要特性

  • 支持完整的 CRUD 操作(创建、读取、更新、删除),可对数据库数据进行全面管理。
  • 具备数据库探索和 introspection 功能,方便用户深入了解数据库。
  • 能够执行自定义 SQL 查询,满足多样化的查询需求。

📦 安装指南

在你的 IDE 的 MCP 服务器设置中定义命令:

通用设置

例如,在 Cursor 中:

{
    "mcpServers": {
        "MCP SQLite Server": {
            "command": "npx",
            "args": [
                "-y",
                "mcp-sqlite",
                "<path-to-your-sqlite-database.db>"
            ]
        }
    }
}

Windows 用户设置

{
    "mcpServers": {
        "MCP SQLite Server": {
            "command": "cmd",
            "args": [
                "/c",
                "npx",
                "-y",
                "mcp-sqlite",
                "<path-to-your-sqlite-database.db>"
            ]
        }
    }
}

cursor-settings

注意:你的数据库路径必须作为参数提供。

💻 使用示例

基础用法

数据库信息

db_info

获取有关连接到的数据库的详细信息。

{
  "method": "tools/call",
  "params": {
    "name": "db_info",
    "arguments": {}
  }
}
list_tables

列出数据库中的所有表。

{
  "method": "tools/call",
  "params": {
    "name": "list_tables",
    "arguments": {}
  }
}
get_table_schema

获取表的详细架构信息。

{
  "method": "tools/call",
  "params": {
    "name": "get_table_schema",
    "arguments": {
      "table_name": "users"
    }
  }
}

CRUD 操作

create

插入新数据。

{
  "method": "tools/call",
  "params": {
    "name": "create",
    "arguments": {
      "table_name": "users",
      "data": {
        "name": "Alice",
        "age": 30
      }
    }
  }
}
read

读取数据。

{
  "method": "tools/call",
  "params": {
    "name": "read",
    "arguments": {
      "table_name": "users",
      "conditions": {
        "age": 25
      }
    }
  }
}
update

更新数据。

{
  "method": "tools/call",
  "params": {
    "name": "update",
    "arguments": {
      "table_name": "users",
      "conditions": {
        "id": 1
      },
      "updates": {
        "age": 31
      }
    }
  }
}
delete

删除数据。

{
  "method": "tools/call",
  "params": {
    "name": "delete",
    "arguments": {
      "table_name": "users",
      "conditions": {
        "id": 1
      }
    }
  }
}

自定义查询

query

对连接到的 SQLite 数据库执行自定义 SQL 查询。

{
  "method": "tools/call",
  "params": {
    "name": "query",
    "arguments": {
      "sql": "SELECT * FROM users WHERE id = ?",
      "values": [1]
    }
  }
}

🔧 技术细节

本项目使用了以下技术:


📄 许可证

文档中未提及许可证相关信息。

致谢

如果你喜欢这个库,请考虑通过以下方式支持我的工作 😀

🍵 这里打赏我

help

运行方式说明

cloud

托管运行

托管运行通常表示这个 MCP Server 由服务方环境承载,用户一般按页面提供的连接方式或授权流程接入,不需要在本地长期启动一个 MCP 进程

  1. 打开服务方连接页
  2. 完成授权或复制端点
  3. 在 MCP 客户端中连接
terminal

本地运行 / 其它方式

本地运行通常需要用户在自己的电脑或服务器上安装依赖,把 server_config 复制到 MCP 客户端,并按 env_schema 补齐环境变量、密钥或其它配置

  1. 复制 server_config
  2. 安装所需依赖
  3. 补齐环境变量后重启客户端