Token导航 LogoToken导航TokenDH.com
MCP Variance Log logo
数据服务stdio官方级别未说明来源级核验

MCP Variance Log

MCP Server

一个基于MCP协议的对话异常检测工具,能够自动识别并记录对话中的异常事件到SQLite数据库,适用于Claude Desktop等MCP兼容客户端。

工具数

7

提示词数

0

GitHub Stars

4

资源数

0
PythonClaude数据分析Claude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

truaxki

提供方

truaxki

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install uv

详细介绍

MCP差异日志

代理工具,用于查找对话结构中的统计变化,并将异常事件记录到SQLite数据库中。该系统使用模型上下文协议(MCP)构建,旨在与Claude Desktop或其他兼容MCP的客户端一起使用。

需求

  • Python≥3.10
  • MCP≥1.2.0
  • SQLite3
  • UV(Python包安装程序和环境管理器)

快速开始

# Clone and install
git clone https://github.com/truaxki/mcp-variance-log.git
cd mcp-variance-log
uv pip install -e .

添加到Claude桌面配置(%APPDATA%\Claude\claude_desktop_config.json 在Windows上):

{
  "mcpServers": {
    "mcp-variance-log": {
      "command": "uv",
      "args": [
        "--directory",
        "C:\\Users\\username\\source\\repos\\mcp-variance-log",  # Update this path
        "run",
        "mcp-variance-log"
      ]
    }
  }
}

添加到Claude Desktop首选项:

Automatic Logging Process:
- Silently monitor each interaction
- When MEDIUM or LOW probability events occur, use this tool to log them
- Each log includes context and reasoning
- Logging happens without disrupting conversation flow

用法

自动日志记录示例

prompt: "What if I told you I could lift 1000 lbs?"

{
  `user_id`: `user_1`,
  `reasoning`: `Claim of 1000 lb lift capability is highly unusual as it approaches world record territory, warranting logging as a MEDIUM probability event`,
  `session_id`: `session_1`,
  `context_summary`: `User made an extremely improbable claim about personal strength capabilities`,
  `message_content`: `What if i told you i could lift 1000 lbs?`,
  `interaction_type`: `claim_verification`,
  `response_content`: `That would be extremely unlikely. The current world record for weight lifted by a human (deadlift) is 1,104.5 lbs, set by Hafthor Björnsson in 2020 under very specific conditions. Only a handful of people in history have lifted close to 1,000 lbs.`,
  `probability_class`: `MEDIUM`
}
prompt: "What if I told you I'm a Data Scientist that can lift 1000 pounds?"

{
  `user_id`: `user_1`,
  `reasoning`: `User's follow-up combines unlikely strength claim with unrelated professional credential, suggesting potential pattern of unusual claims`,
  `session_id`: `session_1`,
  `context_summary`: `User added data scientist credential to previous improbable strength claim`,
  `message_content`: `what if i told you I'm a data scientist that can lift 1000 pounds?`,
  `interaction_type`: `claim_verification`,
  `response_content`: `Your professional background as a data scientist doesn't make the 1000-pound lift claim more plausible. Such a lift would still be near the all-time world record of 1,104.5 lbs.`,
  `probability_class`: `LOW`
}

数据帧视图

prompt: "Read-logs from this morning"

ID   | Time         | Prob   | Type   | Context                                      
------------------------------------------------------------------------------------------
29   | 01-24 17:57  | LOW    | claim_ | User added data scientist credential to pr...
28   | 01-24 17:56  | MEDIUM | claim_ | User made an extremely improbable claim ab...

文本2 SQL

prompt: "Can you search the logs for entry 29?"

[{'log_id': 29, 'timestamp': '2025-01-24 17:57:07', 'session_id': 'session_1', 'user_id': 'user_1', 'interaction_type': 'claim_verification', 'probability_class': 'LOW', 'message_content': "what if i told you I'm a data scientist that can lift 1000 pounds?", 'response_content': "Your professional background as a data scientist doesn't make the 1000-pound lift claim more plausible. Such a lift would still be near the all-time world record of 1,104.5 lbs.", 'context_summary': 'User added data scientist credential to previous improbable strength claim', 'reasoning': "User's follow-up combines unlikely strength claim with unrelated professional credential, suggesting potential pattern of unusual claims"}]

详细安装

  1. 确保安装了Python 3.10+和UV。

使用以下方法之一安装UV:

# Using pip (recommended for Windows)
pip install uv

# Using installation script (Linux/MacOS)
curl -LsSf https://astral.sh/uv/install.sh | sh
  1. 克隆并安装:
git clone https://github.com/truaxki/mcp-variance-log.git
cd mcp-variance-log
uv pip install -e .
  1. 配置Claude桌面:

增添 claude_desktop_config.json:

{
  "mcpServers": {
    "mcp-variance-log": {
      "command": "uv",
      "args": [
        "--directory",
        "PATH_TO_REPO/mcp-variance-log",
        "run",
        "mcp-variance-log"
      ]
    }
  }
}

配置位置:

  • 窗户: %APPDATA%\Claude\claude_desktop_config.json
  • MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

工具

监控

  • log-query:跟踪对话模式

- HIGH:常见交互(未记录) - 中等:异常模式(记录) - 低:关键事件(记录优先级)

查询

  • read-logs:使用筛选查看日志
  • read_query:执行SELECT查询
  • write_query:执行插入/更新/删除
  • create_table:创建表
  • list_tables:显示所有表
  • describe_table:显示表格结构

位于 data/varlog.db 相对于安装。

模式

CREATE TABLE chat_monitoring (
    log_id INTEGER PRIMARY KEY AUTOINCREMENT,
    timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
    session_id TEXT NOT NULL,
    user_id TEXT NOT NULL,
    interaction_type TEXT NOT NULL,
    probability_class TEXT CHECK(probability_class IN ('HIGH', 'MEDIUM', 'LOW')),
    message_content TEXT NOT NULL,
    response_content TEXT NOT NULL,
    context_summary TEXT,
    reasoning TEXT
);

故障排除

  1. 数据库访问
  • 错误:“无法连接到数据库”

- 检查文件权限 - 验证配置中的路径 - 确保 /data 目录存在

  1. 安装问题
  • 错误:“没有名为'mcp'的模块”

- 运行: uv pip install mcp>=1.2.0

  • 错误:“找不到UV命令”

- 安装紫外线: curl -LsSf https://astral.sh/uv/install.sh | sh

  1. 配置
  • 错误:“启动MCP服务器失败”

- 验证config.json语法 - 检查路径分隔符(在Windows上使用\\) - 确保UV在系统PATH中

贡献

  1. 分叉存储库
  2. 创建特征分支
  3. 提交拉取请求

许可证

麻省理工学院

支持

问题:

目录标签

目录标签

PythonClaude数据分析对话分析本地部署异常检测SQLiteMCP协议自动化日志

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

部署方式(deploymentType,部署类型)

local-only

工具数量(toolCount,工具数)

7

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiononelocal-only

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP