Skip to main content
Glama

SQLite MCP Server

使用 SQLite MCP 服务器进行日志分析

该项目提供从压缩日志文件创建 SQLite 数据库并使用模型上下文协议 (MCP) SQLite 服务器与其交互的工具。

安装说明

python3 -m venv venv source venv/bin/activate pip3 install -r requirements.txt

将日志文件作为 .gz 文件放在文件夹中,然后运行:

python3 create_log_db.py

MCP SQLite 服务器

要在 Cursor 中配置 MCP SQLite 服务器,请执行以下操作:

  • 光标设置
  • 微胶囊钙
  • 添加新的 MCP 服务器
  • 名称SQLlite
  • 将类型设置为command
  • 将其放入命令框中
npx -y @smithery/cli@latest run mcp-server-sqlite-npx --config "{\"databasePath\":\"/path/to/thedatbase/logs.db\"}"

内容

  • create_log_db.py :用于提取日志文件并将其解析到 SQLite 数据库中的脚本
  • query_logs.py :直接查询 SQLite 数据库的脚本
  • logs.db :包含已解析日志数据的 SQLite 数据库

数据库结构

该数据库包含以下表:

logs

  • id :每个日志条目的唯一标识符
  • timestamp :日志条目的时间戳
  • thread :生成日志的线程
  • level :日志级别(INFO、WARN、ERROR、DEBUG)
  • module :生成日志的模块
  • message :日志消息内容
  • source_file :源日志文件
  • raw_log :原始日志条目

stack_traces

  • id :每个堆栈跟踪的唯一标识符
  • log_id :此堆栈跟踪所属的日志条目的引用
  • stack_trace :完整堆栈跟踪文本

parsing_errors

  • id :每个解析错误的唯一标识符
  • line :无法解析的行
  • source_file :源日志文件
  • error_message :解释解析失败原因的错误消息
  • timestamp :解析错误发生的时间

您可以使用query_logs.py脚本直接查询数据库:

-
security - not tested
F
license - not found
-
quality - not tested

local-only server

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

通过模型上下文协议查询存储在 SQLite 数据库中的日志数据,允许自然语言与日志分析交互。

  1. 安装说明
    1. MCP SQLite 服务器
      1. 内容
        1. 数据库结构
          1. logs表
          2. stack_traces表
          3. parsing_errors表

        Related MCP Servers

        • A
          security
          A
          license
          A
          quality
          Agentic tool that looks for statistical variations in conversation structure and logs unusual events to a SQLite database. Built using the Model Context Protocol (MCP), this system is designed to be used with Claude Desktop or other MCP-compatible clients.
          Last updated -
          8
          3
          Python
          MIT License
          • Apple
          • Linux
        • A
          security
          A
          license
          A
          quality
          A Model Context Protocol server that provides database interaction capabilities through SQLite, enabling users to run SQL queries, analyze business data, and automatically generate business insight memos.
          Last updated -
          6
          9
          TypeScript
          MIT License
          • Apple
        • -
          security
          A
          license
          -
          quality
          A Model Context Protocol server implementation that enables AI assistants to execute SQL queries and interact with SQLite databases through a structured interface.
          Last updated -
          6
          TypeScript
          MIT License
        • -
          security
          F
          license
          -
          quality
          A Model Context Protocol server that enables SQL operations (SELECT, INSERT, UPDATE, DELETE) and table management through a standardized interface with SQLite databases.
          Last updated -
          JavaScript

        View all related MCP servers

        MCP directory API

        We provide all the information about MCP servers via our MCP API.

        curl -X GET 'https://glama.ai/api/mcp/v1/servers/direkt/mcp-test'

        If you have feedback or need assistance with the MCP directory API, please join our Discord server