feat(mcp): expose skipRerank and candidateLimit in query tool#435
Open
DmitryPogodaev wants to merge 1 commit intotobi:mainfrom
Open
feat(mcp): expose skipRerank and candidateLimit in query tool#435DmitryPogodaev wants to merge 1 commit intotobi:mainfrom
DmitryPogodaev wants to merge 1 commit intotobi:mainfrom
Conversation
On CPU-only servers, LLM reranking (0.6B model) takes ~2s per document, making the query tool unusable with timeouts under 30s. This commit: - Adds `skipRerank` boolean parameter to the MCP `query` tool schema. When true, returns results scored by RRF fusion only (no LLM rerank). - Passes `candidateLimit` through to structuredSearch (was declared in schema but never forwarded to the store). Use case: automated RAG hooks with 1-2s timeouts on VPS without GPU. With skipRerank=true, queries complete in 30-50ms instead of 30-40s.
|
Was on my todo list as well. Should now make the mcp server pretty complete. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On CPU-only servers (no GPU), the LLM reranker model (Qwen3-Reranker-0.6B) takes ~2 seconds per document to score. A typical query with 20 candidates takes 30-40 seconds — far exceeding the 1-2s timeouts used by automated RAG hooks.
The internal
structuredSearchalready supportsskipRerankandcandidateLimit, but neither is exposed through the MCPquerytool.Changes
skipRerank(boolean, optional): added to MCPquerytool schema. Whentrue, returns results scored by RRF fusion only — no LLM rerank. Queries complete in 30-50ms instead of 30-40s.candidateLimit: was declared in the MCP schema but never forwarded tostore.search(). Now passed through.candidateLimitto theSearchOptionsinterface.Use case
Automated RAG hooks (e.g. Telegram bot preprocessing) on VPS without GPU, where the reranker model is prohibitively slow.
skipRerank: truegives fast approximate results; the LLM reranker remains available for interactive / CLI use.Performance
Tested on AMD EPYC 8-core (no GPU), QMD 2.0.1, node-llama-cpp 3.18.1.