rag-chunk-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@rag-chunk-mcp Compare fixed, sentence, and recursive chunking on this policy doc at size 200."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
rag-chunk-mcp
An MCP server that gives agents RAG text-chunking tools with source offsets for citations. Built on rag-chunk-lab.
Agents that answer questions over enterprise documents live or die by chunking: split a policy clause in half and the answer is wrong even when the model is fine; lose the offsets and the answer cannot cite its source. This server lets an agent chunk a document, compare strategies on the actual text, and pick deliberately instead of guessing.
Tools
Tool | What it does |
| Chunk text with one strategy ( |
| Run all three strategies at the same size and compare counts, sizes, and coverage |
| Explain when to use each strategy |
Example compare_strategies result on a 753-character Chinese policy
document at size 200:
{
"fixed": {"count": 5, "avg_chars": 190.4, "min_chars": 152, "max_chars": 200, "coverage": 0.9987},
"sentence": {"count": 6, "avg_chars": 159.8, "min_chars": 69, "max_chars": 194, "coverage": 0.9987},
"recursive": {"count": 6, "avg_chars": 123.8, "min_chars": 34, "max_chars": 191, "coverage": 0.9867}
}And a chunk_text result keeps whole policy articles together with
offsets an agent can cite:
{"index": 1, "start": 36, "end": 216, "chars": 180, "text": "第一条 为规范公司考勤管理…第三条 考勤管理实行打卡制…"}Related MCP server: rag-mcp
Install
git clone https://github.com/leofannf/rag-chunk-mcp.git
cd rag-chunk-mcp
pip install -e .Use with an MCP client
Add the server to your client's MCP configuration (see
examples/mcp-config.json):
{
"mcpServers": {
"rag-chunk": {
"command": "rag-chunk-mcp",
"args": []
}
}
}The server speaks MCP over stdio and works with both the v1 (FastMCP) and v2 (MCPServer) Python SDKs. You can also run it directly:
rag-chunk-mcp # or: python -m rag_chunk_mcp中文简介
rag-chunk-mcp 是一个 MCP 服务器,把 RAG 文本分块能力提供给智能体调用:固定窗口、按句打包、递归分隔符三种策略,每块带原文字符偏移方便引用溯源,并可一键对比三种策略在同一文档上的块数、大小与覆盖率。适合企业制度问答等需要“答得准、引得出”的场景。
Roadmap
chunk_filetool for local files (txt/md) with heading-path metadataToken-based sizing alongside character counts
Semantic chunking option (split where embedding similarity drops)
Streamable HTTP transport option
Contributing
Issues and pull requests are welcome. Run the tests before submitting:
python -m unittest discover -s tests -vLicense
MIT, see LICENSE.
Available Tools
3 toolschunk_textA
Split a document into RAG chunks with source offsets for citations.
strategy is one of "fixed", "sentence", "recursive". size is the max characters per chunk. overlap applies to "fixed"; overlap_sentences applies to "sentence".
Inputs: text (required), size, overlap, strategy, +1 more.
compare_strategiesB
Compare fixed, sentence, and recursive chunking on the same text.
Returns per-strategy chunk counts, size statistics, and source coverage so an agent can pick a strategy before embedding.
Inputs: text (required), size.
explain_strategyB
Explain when to use the "fixed", "sentence", or "recursive" strategy.
Inputs: strategy (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool has a fairly distinct role: explain_strategy is static guidance, chunk_text performs chunking, and compare_strategies runs an empirical comparison. The only mild overlap is between explain_strategy and compare_strategies, since both serve strategy selection, but descriptions make the boundary (advice vs. measured statistics) clear enough.
All three names follow a consistent verb_noun pattern: explain_strategy, chunk_text, compare_strategies. No style mixing or vague verbs.
Three tools for a narrow chunking utility is well-scoped: one for guidance, one for execution, one for comparison. Each earns its place and nothing extraneous is included.
The surface covers the core lifecycle of choosing a strategy, applying it, and validating the choice via comparison. Minor gaps exist (no token-based sizing, custom separator control, or direct chunk preview/inspection tool), but agents can work around these.
Maintenance
Related MCP Connectors
Ingest, manage, and retrieve documents for RAG-powered AI applications
Turn documents into structured, AI-ready data by parsing, enriching, chunking, and embedding.
PDF, Word, PowerPoint, Excel, HTML, EPUB to clean Markdown for LLMs/RAG; OCR for scans; chunks.
Hosted document tools for agents: extract, parse, classify, convert, OCR, sign, and redact.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceProvides AI agents with comprehensive document parsing capabilities including PDF text extraction, OCR, HTML-to-markdown conversion, table extraction, and summarization, optimized for agent workflows.65 npmMIT
- AlicenseAqualityDmaintenanceEnables ingestion and semantic search over text documents using PostgreSQL + pgvector and OpenAI-compatible embeddings, allowing any LLM agent to retrieve relevant chunks for grounded answers.41AGPL 3.0
- FlicenseNot gradedqualityDmaintenanceEnables document Q&A and knowledge retrieval through hybrid semantic and keyword search, with tools for document ingestion, chunking, summarization, PII redaction, and RAGAS-based evaluation.-
- AlicenseNot gradedqualityDmaintenanceProvides AI agents with document conversion to Markdown, intelligently routing small and large files, and enabling targeted extraction via sections, search, and token budgets.6MIT