mcp-reranker
mcp-reranker
sentence-transformers를 사용하여 문서 재순위 지정(reranking) 기능을 제공하는 범용 Model Context Protocol (MCP) 서버입니다.
이 서버는 RAG(검색 증강 생성)의 정확도를 높이거나, 쿼리와 여러 후보 간의 관련성 점수를 매겨 에이전트가 더 나은 결정을 내릴 수 있도록 돕기 위해 Roo Code, Claude Desktop 또는 커스텀 에이전트와 같은 모든 MCP 호환 클라이언트에서 사용할 수 있는 독립형 도구로 설계되었습니다.
주요 기능
Cross-Encoder 재순위 지정: 높은 정확도의 관련성 점수 산출을 위해
sentence-transformers의CrossEncoder모델을 활용합니다.프로젝트 독립성: 특정 애플리케이션 로직과 완전히 독립적입니다.
모델 커스터마이징: 다양한 HuggingFace 모델을 지원합니다. 환경 변수를 통해 기본 모델을 구성할 수 있습니다(기본값:
BAAI/bge-reranker-v2-m3).JSON 출력: 정렬된 결과를 구조화된 JSON 형식으로 반환합니다.
Related MCP server: ragi
도구
rerank_documents
주어진 쿼리에 대해 문서 목록의 관련성 점수를 계산하고 점수순으로 정렬하여 반환합니다.
인자:
query(string): 비교할 검색 쿼리 또는 핵심 의도.documents(array of strings): 순위를 매길 문서 설명 또는 텍스트 목록.model_name(string, optional): HuggingFace 모델 식별자.RERANKER_MODEL_NAME환경 변수 또는"BAAI/bge-reranker-v2-m3"가 기본값으로 사용됩니다.
응답 예시: JSON 형식 문자열:
[
{ "document": "The most relevant document text.", "score": 0.985 },
{ "document": "A partially relevant text.", "score": 0.452 },
{ "document": "Completely irrelevant text.", "score": 0.012 }
]설치 및 사용법
uvx로 실행하기
MCP 설정(예: brownie_core_mcp_config.json)에 다음을 추가하세요.
RERANKER_MODEL_NAME 환경 변수를 설정하여 사용할 모델을 커스터마이징할 수 있습니다.
{
"mcpServers": {
"mcp-reranker": {
"command": "uvx",
"args": [
"--from",
"git+[https://github.com/globalpocket/mcp-reranker.git](https://github.com/globalpocket/mcp-reranker.git)",
"mcp-reranker"
],
"env": {
"RERANKER_MODEL_NAME": "BAAI/bge-reranker-v2-m3"
}
}
}
}개발
사전 요구 사항
Python 3.10+
설정
git clone [https://github.com/globalpocket/mcp-reranker.git](https://github.com/globalpocket/mcp-reranker.git)
cd mcp-reranker
uv sync --extra dev테스트 실행
uv run pytest라이선스
MIT 라이선스
Available Tools
1 toolrerank_documentsA
Reranks a list of documents based on their relevance to a given query.
Args: query: The core intent or query string to compare against. documents: A list of document descriptions/strings to be ranked. model_name: The HuggingFace model name for the CrossEncoder. Default is from env RERANKER_MODEL_NAME or 'BAAI/bge-reranker-v2-m3'.
Returns: A JSON string representing a sorted list of dictionaries containing 'document' and 'score'.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| documents | Yes | ||
| model_name | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description must disclose behavioral traits. It does explain that it uses a CrossEncoder, mentions the model default, and describes the return format. However, it does not mention potential side effects like model downloads, network requirements, or that scores are sorted in descending order (only says 'sorted'). These are meaningful behavioral details that are missing.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured and efficient: a one-sentence summary, clear Args, and Returns. No wasted words, and the core purpose is front-loaded. Every sentence serves a purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers the essential inputs, behavior, and output format for a simple reranking tool. However, it omits the sort order (ascending/descending) and potential edge cases like empty document lists. Since an output schema exists, it is mostly complete but has minor gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has no descriptions (0% coverage), but the description's Args section fully compensates by explaining each parameter, including the optional model_name and its default from env or 'BAAI/bge-reranker-v2-m3'. This adds complete semantic meaning beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: 'Reranks a list of documents based on their relevance to a given query.' The verb 'reranks' is specific and the resource is clearly identified. Though no sibling tools are listed, the purpose is unambiguous and distinct.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies when to use the tool (when you need to rerank documents by relevance) but does not explicitly state scenarios or provide exclusions. Since there are no sibling tools, explicit alternatives are not needed, but there is no guidance on when to prefer this tool over other potential approaches.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v0.1.2- First observed
rerank_documents
TDQS
Scored across 1 tool
Only one tool exists, so there is no possibility of confusion or overlap. The tool's purpose is clearly defined and distinct.
The single tool name 'rerank_documents' follows a clear verb_noun convention and is descriptive. With only one tool, consistency is inherently maintained.
The server has only one tool, which is at the low end of acceptable scope. While it fulfills its core reranking purpose, the count feels thin for a general utility server.
The tool fully covers the domain of reranking documents against a query. No additional operations are necessary for the stated purpose, making the surface complete.
Maintenance
Related MCP Connectors
DocBase MCP server for AI agents
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Remote ChromaDB vector database MCP server with streamable HTTP transport
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceMCP Server for ZeroEntropy collections, top documents and rerankers-
- AlicenseAqualityDmaintenanceLocal-first RAG indexing and semantic search MCP server. Enables document retrieval and context-aware queries using local embedding models.313 npmMIT
- AlicenseNot gradedqualityDmaintenanceMCP server for semantic and hybrid search over RHEL documentation using docs2db RAG, with cross-encoder reranking and support for multiple MCP clients.4Apache 2.0
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that provides powerful RAG (Retrieval-Augmented Generation) capabilities for PDF documents. This server uses ChromaDB for vector storage, sentence-transformers for embeddings, and semantic chunking for intelligent text segmentation.MIT