Skip to content

Conversation

@prosdev
Copy link
Collaborator

@prosdev prosdev commented Nov 27, 2025

Summary

Adds the dev_history MCP tool for semantic search over git commit history and file-specific history retrieval.

Changes

HistoryAdapter (packages/mcp-server/src/adapters/built-in/history-adapter.ts)

Tool: dev_history

Two modes of operation:

  1. Semantic Search (query): Search commit messages by meaning

    • "authentication token expiry fix" → finds relevant commits
    • Uses GitIndexer for vector similarity search
  2. File History (file): Get history for a specific file

    • Uses GitExtractor directly with --follow for rename tracking
    • Supports since and author filters

Parameters:

  • query: Semantic search over commit messages
  • file: Get history for a specific file path
  • limit: Maximum commits to return (1-50, default: 10)
  • since: Date filter (ISO or relative like "2 weeks ago")
  • author: Filter by author email
  • tokenBudget: Maximum tokens for output (100-10000, default: 2000)

Output includes:

  • Commit hash, subject, author, date
  • File change stats (+additions, -deletions)
  • Issue/PR references
  • Files changed (abbreviated)
  • Body for first commit

MCP Server Integration

  • Added HistoryAdapter to built-in adapters
  • Created separate VectorStorage for git commits (-git suffix)
  • Proper shutdown handling for git vector storage

Tests

  • 17 comprehensive unit tests covering:
    • Semantic search functionality
    • File history retrieval
    • Input validation
    • Output formatting
    • Token budgeting
    • Error handling

Example Usage

# Semantic search
dev_history query="authentication token expiry"

# File history
dev_history file="src/auth/token.ts" since="2 weeks ago"

Closes

Closes #93

Part of

Epic: Intelligent Git History (v0.4.0) #90

- Add HistoryAdapter for semantic search over git commits
- Support both query-based (semantic) and file-based history
- Include date/author filtering options
- Token budget management for output
- Rich formatting with commit details, stats, and refs
- Register adapter in MCP server entry point
- Add separate vector storage for git commits
- Add 17 comprehensive unit tests

Part of Epic: Intelligent Git History (v0.4.0) #90
@prosdev prosdev merged commit 4d3b6b6 into main Nov 27, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dev_history MCP adapter

1 participant