Welcome to the Git Telemetry MCP Server handbook. This server provides a Development Time Machine for AI assistants, exposing 16 tools that analyze git reflogs, commit histories, working directory state, branch health, and shell commands to provide rich temporal context.
- Protocol Target & Architecture
- Quick Start & Transport Endpoints
- MCP Client Integration
- Data Privacy & Forensic Hygiene
- Telemetry Envelope & Schema Standard
- Interactive Confirmation Flow (
input_required) - Comprehensive Tool Reference
- Testing & Verification
- Protocol target: MCP
2026-07-28focused subset; see the supported-method list below. Unsupported methods return JSON-RPC-32601rather than being silently accepted. - Transport: Stateless HTTP JSON-RPC + Server-Sent Events (SSE). SSE state is bounded and in-memory, not a durable session store.
- Runtime: Python
>= 3.13(managed viauv)
git_telemetry_mcp/
├── __init__.py
├── server.py # Starlette server, JSON-RPC dispatch, SSE handler
├── privacy.py # Secret scrubber (PII/key redaction serializer gate)
├── schema.py # telemetry_payload wrapper & outputSchema generator
└── tools/
├── __init__.py # Registry of 16 tools with draft-07 schemas & annotations
├── git_timeline.py # Reflog + commit analysis
├── working_dir_delta.py # Dirty working tree diff stats + entropy
├── dev_activity.py # Shell history correlation
├── session_timeline.py # Unified session timeline
├── uncommitted_drift.py # Architectural direction summary
├── file_evolution.py # File diff history across commits/stashes
├── active_context_pack.py # Prompt-optimized context pack
├── safe_operations.py # safe_git_reset, safe_git_checkout (confirmation flows)
├── stash_isolate.py # Pre-operation stash isolation
├── stale_branches.py # Merged and inactive branch scanner
├── smart_commit.py # Conventional Commits inference
├── developer_velocity.py # Code churn and commit frequency
├── conflict_check.py # Dry-run merge conflict detection
├── temporal_snapshot.py # Aggregated temporal snapshot
└── compare_checkpoints.py# Multi-checkpoint diff comparison
# Clone & install dependencies
uv sync
# Run server (default host: 127.0.0.1, port: 8787)
uv run git-telemetry-mcp
# Run dev mode with auto-reload
uv run uvicorn git_telemetry_mcp.server:app --reload --port 8787| Endpoint | Method | Purpose |
|---|---|---|
/mcp |
POST | Stateless HTTP JSON-RPC 2.0 endpoint |
/sse |
GET | Server-Sent Events (SSE) streaming session connection |
/health |
GET | Health check returning server version and status |
Add git-telemetry to your MCP settings file:
{
"mcpServers": {
"git-telemetry": {
"url": "http://127.0.0.1:8787/mcp"
}
}
}For SSE connection, use http://127.0.0.1:8787/sse.
The server applies a serializer privacy boundary before returning tool payloads. serialize_telemetry_payload() scrubs known secret patterns and configured filesystem path patterns from telemetry and prompt context; repo_checksum is a one-way correlation value. This is defense in depth, not a guarantee that arbitrary command text, commit content, or repository data is safe to disclose.
Tool-call arguments are validated against each advertised inputSchema before a handler executes. Invalid arguments receive JSON-RPC -32602; handler failures return a generic error without exception details.
Git-derived text included in prompts is explicitly delimited as untrusted data so commit messages, branch names, and diffs cannot be mistaken for instructions. Do not expose the local development endpoint to an untrusted network without authentication and an appropriate proxy.
- Private Keys: PEM, RSA, OpenSSH, EC, PGP blocks
- Authorization Headers:
Authorization: Bearer ...,Authorization: Basic ... - Embedded Credentials in URLs:
https://user:pass@domain.com,postgres://user:pass@host/db - AWS Keys:
AKIA...,ASIA...,aws_secret_access_key - GitHub Tokens:
ghp_...,gho_...,github_pat_... - AI Service Keys: OpenAI
sk-proj-..., Anthropicsk-ant-... - SaaS Tokens: Slack
xoxb-..., Stripesk_live_..., JWTs
You can supply additional custom regex patterns via the GIT_TELEMETRY_EXCLUDE_PATTERNS environment variable (comma or newline separated):
export GIT_TELEMETRY_EXCLUDE_PATTERNS="COMPANY_TOKEN_[A-Z0-9]+,INTERNAL_KEY_.*"Every tool handler returns a standardized JSON envelope called telemetry_payload.
{
"timezone_offset": "+00:00",
"repo_checksum": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"confidence_score": 1.0,
"data": { ... }
}| Field | Type | Description |
|---|---|---|
timezone_offset |
string | Local ISO 8601 offset (e.g. "+00:00" or "-05:00") |
repo_checksum |
string | SHA-256 hash of the resolved absolute repository path |
confidence_score |
float | 0.0 to 1.0 indicator of data accuracy/completeness |
data |
object/array | Tool-specific structured result |
Each tool in tools/list contains explicit annotations indicating its operational behavior:
readOnlyHint(boolean): True if tool only queries state without modifying disk or refs.destructiveHint(boolean): True if tool performs reset/checkout/commit operations that alter git history or working tree.idempotentHint(boolean): True if repeated calls with identical parameters return identical side effects.
Destructive operations (safe_git_reset, safe_git_checkout) implement a two-round-trip confirmation flow:
- Initial Call: Tool previews affected files/commits, generates a random
confirmation_id, and returnsresultType: "input_required". - User Confirmation: Client sends a second call providing
confirmation_id. The operation executes and returns the finaltelemetry_payload.
Analyzes reflogs and commit history over a specified time window to identify branch switches, resets, rebases, and commits.
-
Annotations:
readOnlyHint: true,destructiveHint: false,idempotentHint: true -
Arguments:
Argument Type Required Description sincestring Yes Start time (e.g. "3.hours.ago","2026-08-01")untilstring No End time (default: "now")repo_pathstring No Path to git repository (default: cwd) -
Sample Request:
{ "method": "tools/call", "params": { "name": "git_timeline", "arguments": { "since": "2.hours.ago" } } }
Combines reflog events, commit logs, stashes, and file mtime attributes to summarize activity during a work session.
- Annotations:
readOnlyHint: true,destructiveHint: false,idempotentHint: true - Arguments:
Argument Type Required Description sincestring Yes Start time (e.g. "4.hours.ago")untilstring No End time (default: "now")repo_pathstring No Path to repository (default: cwd)
Aggregates active branch, recent commits, uncommitted modified files, remotes, and merge/rebase state into a prompt-optimized context pack.
- Annotations:
readOnlyHint: true,destructiveHint: false,idempotentHint: true - Arguments:
Argument Type Required Description repo_pathstring No Path to repository (default: cwd)
Correlates zsh/bash shell history with git commits and reflog entries to reconstruct developer commands and workflow.
- Annotations:
readOnlyHint: true,destructiveHint: false,idempotentHint: true - Arguments:
Argument Type Required Description sincestring Yes Start time (e.g. "1.day.ago")untilstring No End time (default: "now")repo_pathstring No Repository path (default: cwd) shell_history_pathstring No Optional regular file under GIT_TELEMETRY_ALLOWED_HISTORY_ROOTSor a detected home history file; rejected paths yield a safe partial result
History access is intentionally narrow. shell_history_path must resolve to a
regular file beneath one of the path-separated directories in
GIT_TELEMETRY_ALLOWED_HISTORY_ROOTS, or to a detected history file under the
server process user's home directory. Reads are capped at one MiB by default;
GIT_TELEMETRY_MAX_HISTORY_BYTES can lower the limit. Rejected paths are not
echoed, and successful history_file output is passed through serializer path
scrubbing.
The Time Machine entry point. Aggregates git_timeline, working_dir_delta, and dev_activity into a unified temporal window.
- Annotations:
readOnlyHint: true,destructiveHint: false,idempotentHint: true - Arguments:
Argument Type Required Description time_rangestring Yes Time range string (e.g. "last 45m","1.hour.ago")repo_pathstring No Path to repository granularitystring No Detail level (default: "raw")
Summarizes dirty working directory status: staged, unstaged, and untracked changes alongside diff stats and a calculated change entropy score.
- Annotations:
readOnlyHint: true,destructiveHint: false,idempotentHint: true - Arguments:
Argument Type Required Description repo_pathstring No Path to repository include_diffboolean No Include full diff hunk text (default: false)
Compares unstaged and staged changes against HEAD to summarize architectural trends (new function definitions, dependencies pulled in, refactoring balance).
- Annotations:
readOnlyHint: true,destructiveHint: false,idempotentHint: true - Arguments:
Argument Type Required Description repo_pathstring No Path to repository
Traces commit history, stashes, and line blame for a specific file to pinpoint where changes or bugs were introduced.
- Annotations:
readOnlyHint: true,destructiveHint: false,idempotentHint: true - Arguments:
Argument Type Required Description file_pathstring Yes Target file path relative to repo root repo_pathstring No Repository path max_commitsinteger No Maximum commits to trace (default: 10)
Calculates code churn (lines added/deleted), top touched files, and commit frequency per day over a time range.
- Annotations:
readOnlyHint: true,destructiveHint: false,idempotentHint: true - Arguments:
Argument Type Required Description sincestring Yes Start time (e.g. "7.days.ago")untilstring No End time repo_pathstring No Repository path authorstring No Author name/email filter
Compares two historical git checkpoints (commit SHAs, branches, or date strings) against each other and current HEAD.
- Annotations:
readOnlyHint: true,destructiveHint: false,idempotentHint: true - Arguments:
Argument Type Required Description ref1string Yes First reference (e.g. "HEAD~1","1.day.ago")ref2string Yes Second reference (e.g. "HEAD","main")repo_pathstring No Repository path include_diff_contentboolean No Include full unified diff content
Performs a dry-run merge check via git merge-tree to identify potential merge conflicts before modifying the working directory.
- Annotations:
readOnlyHint: true,destructiveHint: false,idempotentHint: true - Arguments:
Argument Type Required Description target_branchstring No Target branch (default: "main")source_branchstring No Source branch (default: current branch) repo_pathstring No Repository path
Scans local and remote tracking branches to identify merged or inactive branches eligible for deletion.
- Annotations:
readOnlyHint: true,destructiveHint: false,idempotentHint: true - Arguments:
Argument Type Required Description repo_pathstring No Repository path days_inactiveinteger No Days threshold (default: 30)include_remoteboolean No Check remote tracking branches (default: true)
Safely resets workspace state with confirmation prompts for hard resets.
- Annotations:
readOnlyHint: false,destructiveHint: true,idempotentHint: false - Arguments:
Argument Type Required Description targetstring No Target ref (default: "HEAD")modestring No Reset mode ( "--hard","--soft","--mixed")repo_pathstring No Repository path confirmation_idstring No Confirmation token for second round-trip
Safely switches branches or checkouts commits, requiring explicit confirmation if --force is requested.
- Annotations:
readOnlyHint: false,destructiveHint: true,idempotentHint: false - Arguments:
Argument Type Required Description targetstring Yes Target branch/commit forceboolean No Force checkout flag repo_pathstring No Repository path confirmation_idstring No Confirmation token
Stashes uncommitted changes (including untracked files) into a named isolation checkpoint before executing risky commands.
- Annotations:
readOnlyHint: false,destructiveHint: false,idempotentHint: false - Arguments:
Argument Type Required Description repo_pathstring No Repository path messagestring No Custom stash description operationstring No Operation name tag
Analyzes staged diffs and infers a Conventional Commits message (feat, fix, refactor, docs, test, chore). Optionally creates the commit.
- Annotations:
readOnlyHint: false,destructiveHint: true,idempotentHint: false - Arguments:
Argument Type Required Description repo_pathstring No Repository path executeboolean No Create commit if true (default: false)
The server advertises resources and prompts capabilities during initialize.
Supported request methods are initialize, tools/list, tools/call,
resources/list, resources/read, prompts/list, and prompts/get.
notifications/initialized is accepted as a notification. Other MCP methods,
including completion, sampling, logging, and resource subscriptions, are not
implemented and receive JSON-RPC -32601 (Method not found). HTTP requests
are stateless; SSE provides only a bounded in-memory response queue.
resources/list exposes these stable resources:
| URI | MIME type | Purpose |
|---|---|---|
telemetry://session/current |
application/json |
Recent activity and current session |
telemetry://history/standup |
application/json |
JSON standup telemetry envelope |
git://delta/latest |
application/json |
JSON telemetry envelope containing latest diff |
Call resources/read with the URI. A repository may be selected with the optional
repo_path parameter, or with a URI query such as
telemetry://session/current?repo_path=/workspace/project. The path must resolve to
an existing Git working tree. Dynamic resource data passes through the privacy
serializer and oversized payloads are returned as bounded, explicitly truncated
previews.
prompts/list and prompts/get expose reusable context assembly:
review_debug_loop— active context plus working-tree delta.generate_commit_message_context— staged-change context for commit wording.handover_notes— current state plus recent activity for a handoff.
Prompt arguments accept an optional repo_path, which is validated as a Git
working tree before telemetry is collected.
Run the comprehensive unit and contract test suite using uv:
# Execute unit, privacy, schema, and contract tests
uv run pytest
# Run with verbose output
uv run pytest -vAutomated tests exercise tool input validation, telemetry output envelopes, prompt delimiters, and secret/path redaction. CI also runs Ruff, Mypy, package build, and the pytest suite.