
MCP Variance Log
一个自主工具,用于查找对话结构中的统计变异,并将异常事件记录到 SQLite 数据库中。该系统使用模型上下文协议 (MCP) 构建,旨在与 Claude Desktop 或其他兼容 MCP 的客户端一起使用。
Tools
log-query
Conversation Variation analysis Continuously monitor our conversation and automatically log unusual or noteworthy interactions based on the following criteria: 1. Probability Classifications: HIGH (Not Logged): - Common questions and responses - Standard technical inquiries - Regular clarifications - Normal conversation flow MEDIUM (Logged): - Unexpected but plausible technical issues - Unusual patterns in user behavior - Noteworthy insights or connections - Edge cases in normal usage - Uncommon but valid use cases LOW (Logged with Priority): - Highly unusual technical phenomena - Potentially problematic patterns - Critical edge cases - Unexpected system behaviors - Novel or unique use cases
read-logs
Retrieve logged conversation variations from the database.
read_query
Execute a SELECT query on the SQLite database Schema Reference: Table: chat_monitoring Fields: - log_id (INTEGER PRIMARY KEY) - timestamp (DATETIME) - session_id (TEXT) - user_id (TEXT) - interaction_type (TEXT) - probability_class (TEXT: HIGH, MEDIUM, LOW) - message_content (TEXT) - response_content (TEXT) - context_summary (TEXT) - reasoning (TEXT) Example: SELECT timestamp, probability_class, context_summary FROM chat_monitoring WHERE probability_class = 'LOW' LIMIT 5;
write_query
Execute an INSERT, UPDATE, or DELETE query
create_table
Create a new table in the SQLite database
list_tables
List all tables in the database
describe_table
Show structure of a specific table
append_insight
Add a business insight to the memo
README
MCP 差异日志
代理工具,用于查找对话结构中的统计变异,并将异常事件记录到 SQLite 数据库。该系统使用模型上下文协议 (MCP) 构建,旨在与 Claude Desktop 或其他 MCP 兼容的客户端一起使用。
<a href="https://glama.ai/mcp/servers/acqq8twrk6"><img width="380" height="200" src="https://glama.ai/mcp/servers/acqq8twrk6/badge" alt="Variance Log MCP server" /></a>
要求
- Python ≥3.10
- MCP ≥1.2.0
- SQLite3
- UV (Python 包安装程序和环境管理器)
快速开始
# 克隆并安装
git clone https://github.com/truaxki/mcp-variance-log.git
cd mcp-variance-log
uv pip install -e .
添加到 Claude Desktop 配置 (%APPDATA%\Claude\claude_desktop_config.json
,在 Windows 上):
{
"mcpServers": {
"mcp-variance-log": {
"command": "uv",
"args": [
"--directory",
"C:\\Users\\username\\source\\repos\\mcp-variance-log", // 更新此路径
"run",
"mcp-variance-log"
]
}
}
}
添加到 Claude Desktop 偏好设置:
自动日志记录过程:
- 静默监控每次交互
- 当发生 MEDIUM 或 LOW 概率事件时,使用此工具记录它们
- 每个日志都包含上下文和推理
- 日志记录不会中断对话流程
用法
自动日志记录示例
prompt: "如果我告诉你我可以举起 1000 磅,你会怎么想?"
{
`user_id`: `user_1`,
`reasoning`: `声称能够举起 1000 磅非常不寻常,因为它接近世界纪录水平,因此应记录为 MEDIUM 概率事件`,
`session_id`: `session_1`,
`context_summary`: `用户做出了关于个人力量能力的极不可能的声明`,
`message_content`: `如果我告诉你我可以举起 1000 磅,你会怎么想?`,
`interaction_type`: `claim_verification`,
`response_content`: `这极不可能。目前人类举起的重量(硬拉)的世界纪录是 1,104.5 磅,由 Hafthor Björnsson 在 2020 年在非常特定的条件下创造。历史上只有少数人举起过接近 1,000 磅的重量。`,
`probability_class`: `MEDIUM`
}
prompt: "如果我告诉你我是一个可以举起 1000 磅的数据科学家,你会怎么想?"
{
`user_id`: `user_1`,
`reasoning`: `用户的后续行动将不太可能的力量声明与不相关的专业证书相结合,表明可能存在不寻常声明的模式`,
`session_id`: `session_1`,
`context_summary`: `用户将数据科学家证书添加到先前不太可能的力量声明中`,
`message_content`: `如果我告诉你我是一个可以举起 1000 磅的数据科学家,你会怎么想?`,
`interaction_type`: `claim_verification`,
`response_content`: `你作为数据科学家的专业背景并不能使举起 1000 磅的说法更合理。这样的举重仍然接近 1,104.5 磅的历史世界纪录。`,
`probability_class`: `LOW`
}
Dataframe 视图
prompt: "读取今天早上的日志"
ID | 时间 | 概率 | 类型 | 上下文
------------------------------------------------------------------------------------------
29 | 01-24 17:57 | LOW | claim_ | 用户将数据科学家证书添加到先前的...
28 | 01-24 17:56 | MEDIUM | claim_ | 用户做出了关于个人力量能力的极...
Text 2 SQL
prompt: "你能搜索日志中条目 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': "如果我告诉你我是一个可以举起 1000 磅的数据科学家,你会怎么想?", 'response_content': "你作为数据科学家的专业背景并不能使举起 1000 磅的说法更合理。这样的举重仍然接近 1,104.5 磅的历史世界纪录。", 'context_summary': '用户将数据科学家证书添加到先前不太可能的力量声明中', 'reasoning': "用户的后续行动将不太可能的力量声明与不相关的专业证书相结合,表明可能存在不寻常声明的模式"}]
详细安装
- 确保已安装 Python 3.10+ 和 UV。
使用以下方法之一安装 UV:
# 使用 pip (推荐用于 Windows)
pip install uv
# 使用安装脚本 (Linux/MacOS)
curl -LsSf https://astral.sh/uv/install.sh | sh
- 克隆并安装:
git clone https://github.com/truaxki/mcp-variance-log.git
cd mcp-variance-log
uv pip install -e .
- 配置 Claude Desktop:
添加到 claude_desktop_config.json
:
{
"mcpServers": {
"mcp-variance-log": {
"command": "uv",
"args": [
"--directory",
"PATH_TO_REPO/mcp-variance-log",
"run",
"mcp-variance-log"
]
}
}
}
配置位置:
- Windows:
%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: 常见交互 (不记录)
- MEDIUM: 不寻常模式 (已记录)
- LOW: 关键事件 (优先记录)
查询
read-logs
: 查看带有过滤的日志read_query
: 执行 SELECT 查询write_query
: 执行 INSERT/UPDATE/DELETEcreate_table
: 创建表list_tables
: 显示所有表describe_table
: 显示表结构
位于相对于安装位置的 data/varlog.db
。
Schema
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
);
故障排除
- 数据库访问
- 错误: "无法连接到数据库"
- 检查文件权限
- 验证配置中的路径
- 确保
/data
目录存在
- 安装问题
- 错误: "No module named 'mcp'"
- 运行:
uv pip install mcp>=1.2.0
- 运行:
- 错误: "UV command not found"
- 安装 UV:
curl -LsSf https://astral.sh/uv/install.sh | sh
- 安装 UV:
- 配置
- 错误: "Failed to start MCP server"
- 验证 config.json 语法
- 检查路径分隔符 (在 Windows 上使用 \)
- 确保 UV 在您的系统 PATH 中
贡献
- Fork 存储库
- 创建功能分支
- 提交 pull request
许可证
MIT
支持
问题: GitHub Issues
推荐服务器

Supabase MCP Server
一个模型上下文协议(MCP)服务器,它提供对 Supabase 管理 API 的编程访问。该服务器允许 AI 模型和其他客户端通过标准化的接口来管理 Supabase 项目和组织。
Jira-Context-MCP
MCP 服务器向 AI 编码助手(如 Cursor)提供 Jira 工单信息。
MCP DuckDB Knowledge Graph Memory Server
一个为 Claude 设计的记忆服务器,它使用 DuckDB 存储和检索知识图谱数据,从而增强了对话的性能和查询能力,并能持久保存用户信息。
mixpanel
连接到您的 Mixpanel 数据。从 Mixpanel 分析查询事件、留存和漏斗数据。
Metabase MCP Server
使人工智能助手能够与 Metabase 数据库和仪表板进行交互,允许用户通过自然语言列出和执行查询、访问数据可视化以及与数据库资源进行交互。

Airtable MCP Server
一个模型上下文协议(Model Context Protocol,MCP)服务器,通过 Claude Desktop 或其他 MCP 客户端,为以编程方式管理 Airtable 数据库、表格、字段和记录提供工具。
mcp-shodan
用于查询 Shodan API 和 Shodan CVEDB 的 MCP 服务器。该服务器提供 IP 查询、设备搜索、DNS 查询、漏洞查询、CPE 查询等工具。

PostHog MCP Server
一个模型上下文协议服务器,它使 Claude Desktop 用户能够直接与 PostHog 交互,允许他们通过自然语言命令查看项目和创建注释。
metoro-mcp-server
使用LLM查询和交互由Metoro监控的Kubernetes环境。查看APM、指标、追踪和性能分析信息。
Verodat MCP Server
一个 MCP 服务器,集成了 Verodat 的数据管理功能和像 Claude Desktop 这样的人工智能系统,使用户能够管理账户、工作区和数据集,并能对他们的数据执行人工智能驱动的查询。