The MCP Variance Log is an agentic tool that monitors conversations for statistical variations and logs unusual events to a SQLite database. Built using the Model Context Protocol (MCP), it works with Claude Desktop and other MCP-compatible clients to identify and record interactions that fall outside normal patterns.
# Clone and install
git clone https://github.com/truaxki/mcp-variance-log.git
cd mcp-variance-log
uv pip install -e .
If you don't have UV installed:
# Using pip (recommended for Windows)
pip install uv
# Using installation script (Linux/MacOS)
curl -LsSf https://astral.sh/uv/install.sh | sh
Add the server to your Claude Desktop configuration file:
{
"mcpServers": {
"mcp-variance-log": {
"command": "uv",
"args": [
"--directory",
"PATH_TO_REPO/mcp-variance-log", # Update this path
"run",
"mcp-variance-log"
]
}
}
}
The config file location depends on your operating system:
%APPDATA%\Claude\claude_desktop_config.json
~/Library/Application Support/Claude/claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
Add the following to Claude Desktop preferences:
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
The tool silently monitors conversations and logs unusual events. Here are examples of how it works:
When a user makes an improbable claim:
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`
}
When the user follows up with another unusual claim:
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`
}
You can view logs in a dataframe format:
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...
You can search specific log entries:
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"}]
log-query
: Tracks conversation patterns with probability classifications:
read-logs
: View logs with filtering optionsread_query
: Execute SELECT querieswrite_query
: Execute INSERT/UPDATE/DELETEcreate_table
: Create tableslist_tables
: Show all tablesdescribe_table
: Show table structureThe database is located at data/varlog.db
relative to the installation directory.
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
);
If you see "Failed to connect to database":
/data
directory existsIf you encounter "No module named 'mcp'":
uv pip install mcp>=1.2.0
If you see "UV command not found":
curl -LsSf https://astral.sh/uv/install.sh | sh
If you get "Failed to start MCP server":
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "mcp-variance-log" '{"command":"uv","args":["--directory","PATH_TO_REPO/mcp-variance-log","run","mcp-variance-log"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"mcp-variance-log": {
"command": "uv",
"args": [
"--directory",
"PATH_TO_REPO/mcp-variance-log",
"run",
"mcp-variance-log"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"mcp-variance-log": {
"command": "uv",
"args": [
"--directory",
"PATH_TO_REPO/mcp-variance-log",
"run",
"mcp-variance-log"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect