Skip to content

feat: MCP server with pagination support - #59

Merged
runonthespot merged 6 commits into
mainfrom
ck-serve
Sep 21, 2025
Merged

feat: MCP server with pagination support#59
runonthespot merged 6 commits into
mainfrom
ck-serve

Conversation

@runonthespot

@runonthespot runonthespot commented Sep 21, 2025

Copy link
Copy Markdown
Contributor

Summary

  • Adds Model Context Protocol (MCP) server for semantic code search
  • Implements session-based pagination to prevent 25K+ token responses
  • Provides semantic, regex, and hybrid search tools via MCP
  • Preserves existing CLI behavior completely unchanged

Key Features

  • MCP Server: Full implementation with --serve flag
  • Search Tools: semantic_search, regex_search, hybrid_search, index_status, reindex
  • Pagination: Configurable page sizes (default 50, max 200) with cursor-based navigation
  • Session Management: 5-minute TTL with automatic cleanup
  • CLI Compatibility: All existing CLI commands work unchanged

Changes

  • Added MCP server in ck-cli/src/mcp_server.rs
  • Added pagination infrastructure in ck-cli/src/mcp/session.rs
  • Increased top_k from 10 to 500 to enable proper pagination
  • Added comprehensive test coverage for MCP functionality
  • Updated README with MCP usage examples

Test plan

  • All existing tests pass
  • New MCP integration tests validate all tools
  • Pagination with cursor navigation tested
  • Session expiration and cleanup tested
  • CLI behavior remains unchanged

🤖 Generated with Claude Code

Comment thread ck-cli/tests/mcp_tests.rs Fixed
Comment thread ck-cli/tests/mcp_tests.rs Fixed
Implements Model Context Protocol (MCP) server for semantic code search:
- Full MCP server with semantic, regex, and hybrid search tools
- Session-based pagination to prevent 25K+ token responses
- Default 50 results per page (max 200) with 5-minute TTL
- Opaque cursor system for secure pagination
- Preserves existing CLI behavior completely
- Increases top_k from 10 to 500 for proper pagination

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@runonthespot runonthespot changed the title feat: MCP pagination for search tools feat: MCP server with pagination support Sep 21, 2025
runonthespot and others added 5 commits September 21, 2025 08:17
Resolves clippy::collapsible_if warnings in test code.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Major feature addition: MCP (Model Context Protocol) server support
- Semantic, regex, and hybrid search tools via MCP
- Session-based pagination for large result sets
- Complete CLI compatibility maintained

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fix stale index handling: Skip missing files during snippet extraction to prevent crashes
- Restore MCP default top_k=100 behavior for consistent API defaults
- Fix pagination cursor persistence: Add original_page_size to maintain consistent page sizes across pagination
- Fix page_size metadata: Return original request size instead of dynamic slice length
- Add comprehensive tests for missing file scenarios and top_k/page_size interactions
- Update README with clarified pagination defaults and best practices

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Move MCP server integration to prominent headline features section
- Reduce sprawl from 615 to 429 lines with better organization
- Improve structure with clear emoji headers and logical flow
- Move installation instructions higher for better discoverability
- Consolidate examples into clearer categories
- Enhanced readability while preserving all technical content

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add clear exclusion pattern examples with .gitignore syntax (Issue #16)
- Clarify package manager availability status (Issue #31)
- Document that text files are indexed regardless of extension (Issue #18)
- Add note about safe Ctrl+C interruption during indexing (Issue #29)
- Update testing section to use cargo test instead of old shell scripts
- Add CI requirements section for contributors (fmt, clippy, tests)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@runonthespot
runonthespot merged commit 0cf0308 into main Sep 21, 2025
13 checks passed
@runonthespot
runonthespot deleted the ck-serve branch September 21, 2025 20:50
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