ai-session-tracker-mcp

mgrandau/ai-session-tracker-mcp

3.2

If you are the rightful owner of ai-session-tracker-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

MCP server for tracking AI coding sessions and measuring developer productivity.

ai-session-tracker-mcp

Python 3.13+ License: MIT MCP Protocol Code style: ruff

MCP server for tracking AI coding sessions and measuring developer productivity.

Track your AI-assisted coding sessions, measure effectiveness, calculate ROI, and identify workflow friction points — all through the Model Context Protocol.


✨ Features

  • 📊 Session Tracking — Start, log interactions, and end coding sessions with full context
  • 📈 ROI Metrics — Calculate time saved, cost savings, and productivity multipliers
  • 🎯 Effectiveness Ratings — Rate AI responses 1-5 to track quality over time
  • 🔍 Code Metrics — Analyze complexity and documentation quality of modified code
  • 🌐 Web Dashboard — Real-time charts and analytics via FastAPI + htmx
  • 🤖 Agent Files — Pre-configured chat modes and instruction files for VS Code

📦 Installation

From Git Repository

# Install directly from GitHub
pip install git+https://github.com/mgrandau/ai-session-tracker-mcp.git

# Or with pipx for isolated installation
pipx install git+https://github.com/mgrandau/ai-session-tracker-mcp.git

Configure for VS Code

After installing, run the install command in your project directory:

# Navigate to your project
cd /path/to/your/project

# Install MCP configuration and agent files
ai-session-tracker install

This creates:

  • .vscode/mcp.json — MCP server configuration
  • .github/instructions/ — AI instruction files
  • .github/chatmodes/ — VS Code chat mode definitions

🚀 Quick Start

1. Start a Session

The MCP tools are available in VS Code Copilot Chat when using the "Session Tracked Agent" chat mode:

@session Start a new session for "Implement user authentication"

2. Log Interactions

Interactions are logged automatically by the agent, or manually:

@session Log this interaction with rating 4

3. End Session

@session End the session with outcome "success"

4. View Dashboard

# Open the web dashboard
ai-session-tracker dashboard

# Then visit http://localhost:8050

🛠️ CLI Commands

# Start MCP server (for VS Code integration)
ai-session-tracker server

# Start MCP server with embedded dashboard
ai-session-tracker server --dashboard-host 0.0.0.0 --dashboard-port 8050

# Start standalone web dashboard
ai-session-tracker dashboard [--host HOST] [--port PORT]

# Generate text report to stdout
ai-session-tracker report

# Install MCP config and agent files to current project
ai-session-tracker install

🔧 MCP Tools

ToolDescription
start_ai_sessionBegin a new tracking session
log_ai_interactionRecord a prompt/response exchange
end_ai_sessionComplete session with outcome
flag_ai_issueReport problems for analysis
log_code_metricsAnalyze modified code quality
get_ai_observabilityRetrieve analytics report
get_active_sessionsList sessions not yet ended

📁 Project Structure

ai-session-tracker-mcp/
├── src/ai_session_tracker_mcp/    # Main package
│   ├── server.py                  # MCP server implementation
│   ├── models.py                  # Domain models
│   ├── storage.py                 # JSON persistence
│   ├── statistics.py              # Analytics engine
│   ├── presenters.py              # Dashboard view models
│   ├── cli.py                     # Command-line interface
│   ├── web/                       # FastAPI dashboard
│   └── agent_files/               # VS Code integration files
├── tests/                         # Test suite (414 tests)
└── utils/                         # Development utilities

📚 Architecture Documentation

Detailed AI-readable architecture docs for each component:

ComponentDocumentation
Main Package
Test Suite

🧪 Development

Setup

# Clone repository
git clone https://github.com/mgrandau/ai-session-tracker-mcp.git
cd ai-session-tracker-mcp

# Install with PDM
pdm install

# Run tests
pdm run test

# Run all checks (lint, typecheck, security, test-cov)
pdm run check-all

Available Scripts

CommandDescription
pdm run testRun pytest
pdm run test-covRun tests with coverage
pdm run lintRun ruff linter
pdm run formatFormat code with ruff
pdm run typecheckRun mypy type checker
pdm run securityRun bandit security scan
pdm run check-allRun all checks

📊 Data Storage

Session data is stored in .ai_sessions/ in your project root:

.ai_sessions/
├── sessions.json      # Session metadata
├── interactions.json  # Logged interactions
├── issues.json        # Flagged issues
└── charts/            # Generated chart images

🔒 Stability

  • MCP Tools — 🔒 ABI-frozen, breaking changes require major version bump
  • CLI Commands — 🔒 ABI-frozen
  • Core Classes — 🔒 ABI-frozen (Session, Interaction, Issue, etc.)
  • Internal APIs — ⚠️ Subject to change (Presenters, ViewModels)

📄 License

MIT License — see for details.


🤝 Contributing

Contributions welcome! Please ensure:

  • All tests pass (pdm run test)
  • Code is formatted (pdm run format)
  • No lint errors (pdm run lint)
  • Type checks pass (pdm run typecheck)