ChunkTuner
chunktuner
RAGパイプライン向けの自動チャンク分割チューナーおよびMCPサーバーです。
ドキュメントを渡すと、複数のチャンク分割戦略を試し、AIが最も正確に質問に回答できる戦略を測定して、最適なものを提示します。
機能
RAGパイプラインを構築する際、ドキュメントをどのようにチャンクに分割するかは、検索品質に直接影響します。chunktunerは、特定のコーパス、埋め込みモデル、ユースケースに最適なチャンク分割戦略を見つけるプロセスを自動化します。
固定トークンウィンドウ、再帰的文字分割、セマンティック分割、PDF構造的チャンク分割、ASTベースのコードチャンク分割などの戦略をベンチマークし、実際の検索メトリクス(トークン再現率、MRR、NDCG)やオプションの生成メトリクス(RAGASの忠実度、回答の関連性)に基づいて各戦略をスコアリングします。
Related MCP server: golden-dataset-mcp
インターフェース
Pythonライブラリ — パイプラインへのプログラムによる統合
CLI (
chunk-tune) — ターミナルからの人間によるチューニングMCPサーバー — Claude Desktopや任意のMCPホストから直接利用可能
クイックスタート
# Install
uv tool install chunktuner
# Initialize workspace
chunk-tune init --provider openai
# See cost estimate before running anything
chunk-tune estimate ./my_docs --use-case rag_qa
# Get a recommendation
chunk-tune recommend ./my_docs --use-case rag_qaPython API:
from pathlib import Path
from chunktuner import FileIngestor, LiteLLMEmbeddingFunction, AutoTuner
from chunktuner import default_registry, Evaluator, ScoreCalculator
docs = FileIngestor().ingest_dir(Path("./my_docs"))
embedding_fn = LiteLLMEmbeddingFunction("text-embedding-3-small")
tuner = AutoTuner(
strategies=default_registry,
evaluator=Evaluator(embedding_fn),
scorer=ScoreCalculator(use_case="rag_qa"),
)
result = tuner.recommend(docs, use_case="rag_qa")
print(result.best.config)サポートされている戦略
戦略 | 最適な用途 |
| ベースライン、均一なトークンウィンドウ |
| 一般的な文章やドキュメント |
| テーマ性の強い記事 |
| 構造化されたMarkdownドキュメント |
| レイアウト領域や表を含むPDF |
| レイアウトとテキストが混在するPDF/DOCX |
| 密な相互参照を含む長いドキュメント |
| 高価値な物語形式のドキュメント |
| コードリポジトリ (Python, JavaScript) |
| コードのベースライン (スライディングウィンドウ) |
MCPサーバー (Claude Desktop)
Python FastMCP (chunk-tune-mcp, stdio) を使用。Node.jsビルドは不要です。docs/mcp_setup.mdを参照してください。
.mcp.jsonに追加します:
{
"mcpServers": {
"chunktuner": {
"command": "uvx",
"args": ["--from", "chunktuner[mcp]", "chunk-tune-mcp"],
"env": {
"CHUNK_TUNER_BASE_DIR": "/path/to/your/corpus"
}
}
}
}利用可能なツール:list_strategies, preview_chunks, evaluate_chunking, recommend_config
CLIリファレンス
chunk-tune init Bootstrap workspace config
chunk-tune analyze Quick structural scan (no API cost)
chunk-tune estimate Dry-run cost/token estimate
chunk-tune evaluate Full evaluation across strategies
chunk-tune recommend Evaluation + best config recommendation
chunk-tune compare Side-by-side comparison of specific strategies
chunk-tune preview Inspect how a strategy splits a document
chunk-tune cache Manage embedding and chunk cacheインストールオプション
uv add chunktuner # library
uv tool install chunktuner # global CLI
uvx chunktuner # ephemeral, no install
# With optional extras
uv add "chunktuner[docling]" # PDF/DOCX support
uv add "chunktuner[ragas]" # generation metrics
uv add "chunktuner[semantic]" # semantic chunking
uv add "chunktuner[code]" # AST code chunking
uv add "chunktuner[all]" # everythingコントリビューション
CONTRIBUTING.mdを参照してください。
👨🏻💻 著者
E2E AIアプリケーション構築の経験を持つフルスタック開発者。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceExposes queryable GPU inference benchmark data (quantization, throughput, VRAM, concurrent users) as tools for LLM clients.MIT
- AlicenseAqualityBmaintenanceEnables version-controlled golden dataset management and semantic evaluation for RAG/LLM pipelines using TF-IDF cosine similarity, without requiring an LLM API key.9MIT
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to search and retrieve information from large technical documentation (OpenAPI specs, markdown) via intelligent chunking and semantic search.MIT
- AlicenseNot gradedqualityCmaintenanceEvaluates RAG outputs on faithfulness, answer relevancy, and context precision using an LLM-as-a-Judge backend. Exposes tools for running evaluations, scoring individual samples, and checking thresholds, enabling CI gating and on-demand assessment via MCP.MIT
Related MCP Connectors
Multi-LLM entity enrichment: schemas, single/batch enrichment, fusion, model benchmarks.
Bounded tools for rendering, extraction, RAG, enrichment, local discovery and review analysis.
Machine-readable utilities and datasets for AI agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/shantanu-deshmukh/chunktuner'
If you have feedback or need assistance with the MCP directory API, please join our Discord server