BM 25 Search
FreeNot checkedMCP server and CLI for BM25 keyword search over a local Markdown corpus — drop .md files into data/ and query from any MCP-compatible client or the command line
About
MCP server and CLI for BM25 keyword search over a local Markdown corpus — drop .md files into data/ and query from any MCP-compatible client or the command line.
README
A lightweight BM25 search server for querying a folder of Markdown files, exposed as an MCP server.
Repository layout
bm-25/
├── mcp_server.py # MCP server exposing the `search` tool over stdio
├── search.py # BM25 indexing + search logic (also usable as a CLI)
├── requirements.txt # Python dependencies
└── data/ # Place your .md files here
├── information_retrieval.md
├── machine_learning.md
└── python_intro.md
Setup
Install Python 3.9+ (if not already installed).
Install dependencies:
pip install -r requirements.txt
Usage
MCP server
Run the server over stdio:
python mcp_server.py
It registers a single tool, search(query: str, top_n: int = 3), which returns the top-N BM25 matches (score, path, line range, and chunk text) from the markdown corpus in data/. OpenTelemetry spans are emitted to stderr so stdout stays clean for JSON-RPC.
Example client config (e.g. ~/.config/claude/mcp.json or equivalent):
{
"mcpServers": {
"bm25-search": {
"command": "python",
"args": ["/absolute/path/to/bm-25/mcp_server.py"]
}
}
}
Docker
Build the image:
docker build -t bm25-mcp-server .
Configure Claude Desktop to use the containerized server (in claude_desktop_config.json):
{
"mcpServers": {
"bm25-search": {
"command": "docker",
"args": ["run", "-i", "--rm", "bm25-mcp-server"]
}
}
}
CLI: interactive mode
Run the script without arguments to enter an interactive query loop:
python search.py
Loading documents from '.../data' …
Indexed 3 document(s): ['information_retrieval.md', 'machine_learning.md', 'python_intro.md']
Enter a search query (or 'quit' to exit):
> machine learning algorithms
1. machine_learning.md (score: 0.4210)
2. python_intro.md (score: 0.1898)
3. information_retrieval.md (score: 0.0751)
> quit
CLI: single-query mode
Pass a query directly on the command line:
python search.py "BM25 ranking"
Loading documents from '.../data' …
Indexed 3 document(s): ['information_retrieval.md', 'machine_learning.md', 'python_intro.md']
Query: 'BM25 ranking'
1. information_retrieval.md (score: 1.6854)
Adding your own documents
Drop any .md files into the data/ directory.
They are automatically discovered and indexed the next time search.py is run.
How it works
- All
.mdfiles indata/are read and tokenized (lowercased, punctuation stripped). - A BM25Okapi index is built over the token lists.
- Each query is tokenised the same way, and the top-scoring documents are returned.
BM25 key parameters (can be tuned inside search.py):
| Parameter | Default | Effect |
|---|---|---|
k1 |
1.5 | Term-frequency saturation |
b |
0.75 | Document-length normalization |
Installing BM 25 Search
This server has no published package — it is built from source. Open the repository and follow its README.
▸ github.com/Mandoa-Labs/BM-25-SearchFAQ
Is BM 25 Search MCP free?
Yes, BM 25 Search MCP is free — one-click install via Unyly at no cost.
Does BM 25 Search need an API key?
No, BM 25 Search runs without API keys or environment variables.
Is BM 25 Search hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install BM 25 Search in Claude Desktop, Claude Code or Cursor?
Open BM 25 Search on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
GitHub
PRs, issues, code search, CI status
by GitHubFilesystem
Secure file operations with configurable access controls.
Memory
Knowledge graph-based persistent memory system.
Template MCP Server
A CLI tool to create a new Model Context Protocol server project with TypeScript support, dual transport options, and an extensible structure
by mcpdotdirectCompare BM 25 Search with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All development MCPs
