Skip to content

Conversation

@prosdev
Copy link
Collaborator

@prosdev prosdev commented Nov 25, 2025

Summary

Implements issue #30 by adding two new MCP adapters:

ExploreAdapter ()

  • Pattern search: Find code by semantic meaning
  • Similar code detection: Find files similar to a reference
  • Relationship mapping: Discover code dependencies
  • Supports file type filtering
  • Token-efficient compact/verbose output formats

GitHubAdapter ()

  • Semantic search: Search issues and PRs by meaning
  • Context retrieval: Get full details for specific issues/PRs
  • Related items: Find related issues and pull requests
  • Supports filtering by type, state, labels, and author
  • Compact and verbose output formats

Implementation Details

  • ✅ Both adapters use token-efficient formatters
  • ✅ Comprehensive unit tests (34 tests, 100% pass rate)
  • ✅ Proper error handling with actionable suggestions
  • ✅ Registered in MCP server bin with lazy GitHub indexer initialization
  • ✅ All core dev-agent features now accessible via MCP

Testing

  • 17 unit tests for ExploreAdapter covering all actions and edge cases
  • 17 unit tests for GitHubAdapter covering search/context/related
  • Type-safe with proper handling of unknown types
  • Mocked dependencies for fast, isolated tests

What's Next

All core dev-agent functionality is now exposed via MCP:

  • ✅ Code search (SearchAdapter)
  • ✅ Repository status (StatusAdapter)
  • ✅ Issue planning (PlanAdapter)
  • ✅ Code exploration (ExploreAdapter)
  • ✅ GitHub integration (GitHubAdapter)

Closes #30

- Add ExploreAdapter with pattern/similar/relationships actions
- Add GitHubAdapter with search/context/related actions
- Both adapters use token-efficient formatters (compact/verbose)
- Comprehensive unit tests (34 tests total, all passing)
- Register both adapters in MCP server bin
- Initialize GitHubIndexer with lazy loading
- All dev-agent features now accessible via MCP

Closes #30
- Update LanceDBVectorStore to use mergeInsert API for upsert operations
- Add scalar index on 'id' column to speed up merge operations
- Implement optimize() method for vector store compaction
- Add new 'dev compact' CLI command for database optimization
- Prevents duplicate entries when re-indexing repository

This resolves the duplicate search results issue by using LanceDB's
merge_insert API instead of simple append operations. The compact
command allows users to optimize their vector store by merging
fragments and updating indices for better query performance.
@prosdev prosdev force-pushed the feat/mcp-explore-github-adapters branch from d6b515a to f7921f6 Compare November 25, 2025 04:25
## Features

### 1. Prompts System (MCP Protocol)
- Implement prompts/list and prompts/get handlers
- Add 8 guided workflow prompts:
  - analyze-issue: Full issue analysis with implementation plan
  - find-pattern: Search codebase for patterns
  - repo-overview: Comprehensive repository health dashboard
  - find-similar: Find code similar to a file
  - search-github: Search issues/PRs by topic
  - explore-relationships: Analyze file dependencies
  - create-plan: Generate detailed task breakdown
  - quick-search: Fast semantic code search
- Enable prompts capability in server initialization
- Create PromptRegistry with argument validation

### 2. Token Cost Visibility
- Add 🪙 coin emoji footers to all tool outputs
- Display accurate token estimates at end of responses
- Helps users make informed decisions about format choices
- Shows ~36 tokens (compact) vs ~462 tokens (verbose) examples

### 3. Calibrated Token Estimation
- Improve accuracy from 12.9% error to 0.6% error
- Change formula: 4 chars/token → 4.5 chars/token
- Adjust word estimate: 1.3 → 1.25 tokens/word
- Validated against actual Cursor usage (178 tokens)
- Add comprehensive accuracy tests

## Bug Fixes

### GitHub Indexing Status
- Fix path mismatch: use consistent vectorStorePath-github pattern
- Load repository name from state file to avoid gh CLI calls
- Enable offline operation with cached GitHub data
- Fix GitHubAdapter and StatusAdapter initialization
- Now correctly shows: ✅ GitHub (40 items) instead of ⚠️ not indexed

### CLI Stats Command
- Add GitHub integration section to 'dev stats' output
- Display issues, PRs, and sync status
- Load GitHubIndexer with repository from state file
- Show comprehensive repository and GitHub metrics

## Tests
- Update all formatter tests for token footers
- Add token footer validation tests
- Fix status adapter test expectations (debug → warn)
- Add calibrated token estimation accuracy tests
- All 246 tests passing

## Documentation
- Update token estimation comments with calibration details
- Add prompt definitions with descriptions and arguments
- Document offline GitHub operation capability

Closes #26 (MCP Integration improvements)
@prosdev prosdev merged commit 563f1b7 into main Nov 25, 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.

Explore + GitHub Adapters

1 participant