Skip to content

feat: add keyword search functionality to registry service #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tuannvm
Copy link

@tuannvm tuannvm commented Jun 15, 2025

Motivation and Context

Summary

This pull request enhances the MCP Registry service to support keyword searching across server names and descriptions for both REST API clients and internal database queries. It introduces new methods and modifications across various layers, including API handlers, memory-based storage, MongoDB repository, and service interfaces, to enable efficient case-insensitive search with cursor-based pagination.

Key Details

  • Added search query parameter to /v0/servers API endpoint, supporting keywords for filtering servers.
  • Updated API handler to detect the search parameter and invoke appropriate database methods.
  • Implemented Search method in memory database with case-insensitive substring matching on server name and description.
  • Implemented Search method in MongoDB database using regular expressions for case-insensitive, partial matches.
  • Extended service interfaces and implementations to include Search functionality.
  • Updated test mocks and fake services to simulate search behavior.
  • Cursor-based pagination is maintained, with nextCursor calculated based on the last matched entry.

How Has This Been Tested?

  • Verify that /v0/servers endpoint accepts search parameter and returns filtered results:
    • Example: GET /v0/servers?search=redis
    • Confirm case-insensitive matches.
  • Check combined use with pagination parameters:
    • Example: GET /v0/servers?search=database&limit=10&cursor=...
  • Validate that search results are correctly sorted and paginated.
  • Run existing unit tests and add/verify tests for new search behavior in service and database layers.
  • Performance testing in large environments to ensure search efficiency.

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Signed-off-by: Tommy Nguyen <tuannvm@hotmail.com>
@tuannvm tuannvm marked this pull request as ready for review June 15, 2025 22:38
@tuannvm
Copy link
Author

tuannvm commented Jun 15, 2025

#135

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.

1 participant