SQLite MCP Server

by jacksteamdev
Verified

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Built for the Bun JavaScript runtime environment, using it for dependency management, script execution, and server operation.

  • Includes ESLint integration through built-in scripts for running checks and automatically fixing issues.

  • Includes specific support for macOS with automatic configuration of Claude Desktop files in the macOS-specific application support directory.

SQLite MCP 服务器

概述

模型上下文协议 (MCP) 服务器实现,通过 SQLite 提供数据库交互和商业智能功能。该服务器支持运行 SQL 查询、分析业务数据并自动生成业务洞察备忘录。

安装

  1. 如果尚未安装Bun
  2. 克隆此存储库
  3. 安装依赖项:
    bun install
  4. 运行安装脚本以在 Claude Desktop 中配置服务器:
    bun run setup

安装脚本将自动将服务器配置添加到您的 Claude Desktop 配置文件中,该文件位于:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

成分

资源

服务器公开单个动态资源:

  • memo://insights :持续更新的业务洞察备忘录,汇总分析过程中发现的洞察
    • 通过附加洞察工具发现新见解时自动更新

提示

服务器提供演示提示:

  • mcp-demo :指导用户完成数据库操作的交互式提示
    • 必需参数: topic - 要分析的业务领域
    • 生成适当的数据库模式和示例数据
    • 指导用户进行分析和洞察生成
    • 与业务洞察备忘录集成

工具

该服务器提供六个核心工具:

查询工具

  • read-query
    • 执行 SELECT 查询以从数据库读取数据
    • 输入:
      • query (字符串):要执行的 SELECT SQL 查询
    • 返回:查询结果作为对象数组
  • write-query
    • 执行 INSERT、UPDATE 或 DELETE 查询
    • 输入:
      • query (字符串):SQL 修改查询
    • 返回: { affected_rows: number }
  • create-table
    • 在数据库中创建新表
    • 输入:
      • query (字符串):CREATE TABLE SQL语句
    • 返回:表创建确认

架构工具

  • list-tables
    • 获取数据库中所有表的列表
    • 无需输入
    • 返回:表名称数组
  • describe-table
    • 查看特定表的架构信息
    • 输入:
      • table_name (字符串):要描述的表的名称
    • 返回:具有名称和类型的列定义数组

分析工具

  • append-insight
    • 向备忘录资源添加新的业务见解
    • 输入:
      • insight (字符串):从数据分析中发现的商业洞察
    • 返回:确认洞察力的增加
    • 触发 memo://insights 资源的更新

发展

项目结构

  • src/index.ts :主服务器实现
  • src/logger.ts :日志实用程序
  • scripts/setup.ts :Claude Desktop 配置脚本

日志记录

服务器维护详细日志:

  • server.log :位于项目根目录
  • 日志包括时间戳、日志级别(DEBUG、INFO、WARN、ERROR、FATAL)和结构化元数据

数据库

SQLite 数据库文件创建于:

  • data.sqlite :位于项目根目录
  • 如果不存在则自动创建

可用脚本

  • bun run setup :在 Claude Desktop 中配置服务器
  • bun run lint :运行 ESLint 检查
  • bun run lint:fix :自动修复 ESLint 问题
  • bun run inspect :运行 MCP 检查器

执照

此 MCP 服务器采用 MIT 许可证。详情请参阅许可证文件。

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

模型上下文协议服务器,通过SQLite提供数据库交互能力,让用户能够运行SQL查询,分析业务数据,并自动生成业务洞察备忘录。

  1. Overview
    1. Installation
      1. Components
        1. Resources
        2. Prompts
        3. Tools
      2. Development
        1. Project Structure
        2. Logging
        3. Database
        4. Available Scripts
      3. License
        ID: le7p83s38c