Skip to content

Conversation

@tnm
Copy link
Contributor

@tnm tnm commented Jan 7, 2026

Summary

Addresses GitHub Issue #37 - MCP server timing out on large codebases (Linux kernel, Kubernetes, etc.).

Changes:

  • Increase grep timeout from 30s → 120s (configurable via KIT_GREP_TIMEOUT env var)
  • Add grep early termination using -m flag for faster results
  • Add get_file_tree pagination with limit/offset params (default 10K files per page)
  • Add warm_cache MCP tool to pre-warm caches before heavy operations
  • Add 16 tests for new features
  • Update MCP docs with large codebase guidance

Benchmarks (Linux kernel - 98K files, 1.9GB)

Operation Before After Improvement
File tree (cold) N/A 3.65s baseline
File tree (cached) N/A 0.015s 248x faster
Grep (max 100 results) timeout at 30s 18s ✅ completes
Pagination not supported ✅ works unlimited repo size

Key Design Decisions

  1. warm_cache is opt-in: Users call it explicitly before heavy operations (not automatic)
  2. Pagination defaults to 10K files: Enough for most repos, prevents context explosion
  3. Grep timeout configurable: Set KIT_GREP_TIMEOUT=300 for very large repos
  4. All speedups work without env vars: Settings are optional overrides

Test plan

  • All 16 new tests pass
  • Existing test suite passes (197 tests)
  • Verified on Linux kernel (98K files)
  • Verified on Kubernetes (28K files)

Addresses GitHub Issue #37 - MCP server timing out on large codebases.

Changes:
- Increase grep timeout from 30s to 120s (configurable via KIT_GREP_TIMEOUT)
- Add grep early termination using -m flag for faster results
- Add get_file_tree pagination with limit/offset params (default 10K files)
- Add warm_cache MCP tool to pre-warm caches before operations
- Add 16 tests for new features
- Update MCP docs with large codebase guidance

Tested on Linux kernel (98K files, 1.9GB):
- File tree: 3.65s cold → 0.015s cached (248x speedup)
- Grep: Completes in 18s (well under 120s timeout)
- Pagination: Works correctly across all 98K files
@tnm tnm merged commit 19f1c7a into main Jan 7, 2026
2 checks passed
@tnm tnm deleted the feat/large-codebase-support branch January 7, 2026 20:30
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.

2 participants