MCP 분산 로그
대화 구조의 통계적 변화를 파악하고 SQLite 데이터베이스에 이상 이벤트를 기록하는 에이전트 도구입니다. 모델 컨텍스트 프로토콜(MCP)을 사용하여 구축된 이 시스템은 Claude Desktop 또는 기타 MCP 호환 클라이언트와 함께 사용하도록 설계되었습니다.
요구 사항
- 파이썬 ≥3.10
- MCP ≥1.2.0
- SQLite3
- UV(Python 패키지 설치 및 환경 관리자)
빠른 시작
지엑스피1
Claude Desktop 구성에 추가(Windows의 경우 %APPDATA%\Claude\claude_desktop_config.json
):
{
"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"}]
자세한 설치
- 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
- 복제하고 설치하세요:
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
- 리눅스:
~/.config/Claude/claude_desktop_config.json
도구
모니터링
log-query
: 대화 패턴을 추적합니다- 높음: 일반적인 상호작용(기록되지 않음)
- 중간: 비정상적인 패턴(기록됨)
- 낮음: 중요 이벤트(우선순위 기록됨)
질문
read-logs
: 필터링을 통해 로그 보기read_query
: SELECT 쿼리 실행write_query
: INSERT/UPDATE/DELETE 실행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
);
문제 해결
- 데이터베이스 액세스
- 오류: "데이터베이스에 연결하지 못했습니다"
- 파일 권한 확인
- 구성에서 경로 확인
/data
디렉토리가 있는지 확인하세요
- 설치 문제
- 오류: "이름이 'mcp'인 모듈이 없습니다"
- 실행:
uv pip install mcp>=1.2.0
- 오류: "UV 명령을 찾을 수 없습니다"
- UV 설치:
curl -LsSf https://astral.sh/uv/install.sh | sh
- 구성
- 오류: "MCP 서버를 시작하지 못했습니다"
- config.json 구문 확인
- 경로 구분 기호 확인(Windows에서는 \ 사용)
- UV가 시스템 PATH에 있는지 확인하세요.
기여하다
- 저장소를 포크하세요
- 기능 브랜치 생성
- 풀 리퀘스트 제출
특허
MIT
지원하다
문제: GitHub 문제