sqlite-explorer-fastmcp-mcp-server

by hannesrudolph
Verified

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Integrations

  • Provides safe, read-only access to SQLite databases through tools like read_query, list_tables, and describe_table

SQLite Explorer MCP 服务器

一个 MCP 服务器,通过模型上下文协议 (MCP) 提供对 SQLite 数据库的安全只读访问。该服务器基于 FastMCP 框架构建,使 LLM 能够利用内置的安全功能和查询验证功能探索和查询 SQLite 数据库。

📋 系统要求

  • Python 3.6+
  • SQLite 数据库文件(通过环境变量指定的路径)

📦依赖项

安装所有必需的依赖项:

# Using pip pip install -r requirements.txt

所需软件包

  • fastmcp :构建模型上下文协议服务器的框架

所有依赖项均在requirements.txt中指定,以方便安装。

📑 目录

🛠️ MCP 工具

服务器向 LLM 公开以下工具:

读取查询

使用内置安全验证在数据库上执行 SELECT 查询。功能:

  • 查询验证和清理
  • 参数绑定支持
  • 行限制执行
  • 结果格式化为字典

列表表

列出数据库中所有可用的表及其名称。

描述表

获取特定表的详细架构信息,包括:

  • 列名和类型
  • NULL 约束
  • 默认值
  • 主键信息

🚀 入门

克隆存储库:

git clone https://github.com/hannesrudolph/sqlite-explorer-fastmcp-mcp-server.git cd sqlite-explorer-fastmcp-mcp-server

📦安装选项

您可以在 Claude Desktop 或 Cline VSCode 插件中安装此 MCP 服务器。请选择最符合您需求的选项。

选项 1:安装 Claude Desktop

使用 FastMCP 安装:

fastmcp install sqlite_explorer.py --name "SQLite Explorer" -e SQLITE_DB_PATH=/path/to/db

/path/to/db替换为您的 SQLite 数据库文件的路径。

选项 2:安装 Cline VSCode 插件

要将此服务器与Cline VSCode 插件一起使用:

  1. 在 VSCode 中,单击 Cline 插件侧栏中的服务器图标 (☰)
  2. 点击“编辑 MCP 设置”按钮 (✎)
  3. 在设置文件中添加以下配置:
{ "sqlite-explorer": { "command": "uv", "args": [ "run", "--with", "fastmcp", "--with", "uvicorn", "fastmcp", "run", "/path/to/repo/sqlite_explorer.py" ], "env": { "SQLITE_DB_PATH": "/path/to/your/database.db" } } }

代替:

  • /path/to/repo为您克隆此存储库的完整路径(例如, /Users/username/Projects/sqlite-explorer-fastmcp-mcp-server
  • /path/to/your/database.db为您的 SQLite 数据库文件的完整路径

🔒 安全功能

  • 对 SQLite 数据库的只读访问
  • 查询验证和清理
  • 安全查询执行的参数绑定
  • 行限制执行
  • 抑制进度输出以获得干净的 JSON 响应

📚 开发文档

该存储库包括用于开发的文档文件:

  • mcp-documentation.txt :包含有关 MCP 服务器实现和 FastMCP 框架使用的全面文档。

该文档在开发功能时可作为上下文,并可与 LLM 一起使用以协助开发。

⚙️ 环境变量

必须设置以下环境变量:

  • SQLITE_DB_PATH :要探索的 SQLite 数据库文件的完整路径
-
security - not tested
F
license - not found
-
quality - not tested

一个 MCP 服务器,通过 MCP 提供对 SQLite 数据库的安全只读访问。该服务器基于 FastMCP 框架构建,使 LLM 能够利用内置的安全功能和查询验证功能探索和查询 SQLite 数据库。

  1. 📋 System Requirements
    1. 📦 Dependencies
      1. Required Packages
    2. 📑 Table of Contents
      1. 🛠️ MCP Tools
        1. read_query
        2. list_tables
        3. describe_table
      2. 🚀 Getting Started
        1. 📦 Installation Options
          1. Option 1: Install for Claude Desktop
          2. Option 2: Install for Cline VSCode Plugin
        2. 🔒 Safety Features
          1. 📚 Development Documentation
            1. ⚙️ Environment Variables
              ID: 36pwdhgz0j