返回市场
MCP-SQLite服务器

MCP-SQLite服务器

作者:jparkerweb66 星标更新:2025-06-03

项目介绍

🐇 MCP SQLite 服务器

这是一个提供全面SQLite数据库交互能力的模型上下文协议(MCP)服务器。

cursor-settings

维护者

<a href="https://www.equilllabs.com"> <img src="https://raw.githubusercontent.com/jparkerweb/eQuill-Labs/refs/heads/main/src/static/images/logo-text-outline.png" alt="eQuill Labs" height="32"> </a>

特性

  • 完整的CRUD操作(创建、读取、更新、删除)
  • 数据库探索和内省
  • 执行自定义SQL查询

配置

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

例如 Cursor

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

例如 VSCode

{
    "servers": {
        "MCP SQLite 服务器": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-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

获取表模式的详细信息。

参数:

  • tableName (字符串):表名

示例:

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

CRUD 操作

create_record

向表中插入一条新记录。

参数:

  • table (字符串):表名
  • data (对象):以键值对形式表示的记录数据

示例:

{
  "method": "tools/call",
  "params": {
    "name": "create_record",
    "arguments": {
      "table": "users",
      "data": {
        "name": "John Doe",
        "email": "john@example.com",
        "age": 30
      }
    }
  }
}

read_records

从表中查询记录,可选过滤条件。

参数:

  • table (字符串):表名
  • conditions (对象,可选):以键值对形式表示的过滤条件
  • limit (数字,可选):返回的最大记录数
  • offset (数字,可选):跳过的记录数

示例:

{
  "method": "tools/call",
  "params": {
    "name": "read_records",
    "arguments": {
      "table": "users",
      "conditions": {
        "age": 30
      },
      "limit": 10,
      "offset": 0
    }
  }
}

update_records

更新匹配指定条件的表中的记录。

参数:

  • table (字符串):表名
  • data (对象):以键值对形式表示的新值
  • conditions (对象):以键值对形式表示的过滤条件

示例:

{
  "method": "tools/call",
  "params": {
    "name": "update_records",
    "arguments": {
      "table": "users",
      "data": {
        "email": "john.updated@example.com"
      },
      "conditions": {
        "id": 1
      }
    }
  }
}

delete_records

删除匹配指定条件的表中的记录。

参数:

  • table (字符串):表名
  • conditions (对象):以键值对形式表示的过滤条件

示例:

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

自定义查询

query

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

参数:

  • sql (字符串):要执行的SQL查询
  • values (数组,可选):用于查询的参数值数组

示例:

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

构建工具


感谢

如果您喜欢这个库,请考虑给我打赏以支持我的工作 😀

🍵 在这里打赏我