Skip to main content
Glama
korean-docs-mcp

korean-docs-mcp

README.md
# korean-docs-mcp

<!-- mcp-name: io.github.RionHwang0/korean-docs-mcp -->

[![CI](https://github.com/RionHwang0/korean-docs-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/RionHwang0/korean-docs-mcp/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/korean-docs-mcp)](https://pypi.org/project/korean-docs-mcp/)
[![korean-docs-mcp MCP server](https://glama.ai/mcp/servers/RionHwang0/korean-docs-mcp/badges/score.svg)](https://glama.ai/mcp/servers/RionHwang0/korean-docs-mcp)

An MCP server that lets Claude, Cursor and other agents search a folder of
Korean documents (**HWP, HWPX, PDF, DOCX, XLSX, PPTX**, Markdown, text) on your
own machine.

- **Reads HWP and HWPX directly**, along with PDF and Office files. Tables come
  back as Markdown tables with their rows intact, not as a run of cell text.
- **Merged cells are filled in.** A row under a merged cell repeats its value
  (`| 교육 | AI 튜터 | 209 |`, not `| | AI 튜터 | 209 |`), so every row a search
  returns says which group it belongs to.
- **Search that understands Korean.** Text is split into morphemes with
  [Kiwi](https://github.com/bab2min/kiwipiepy) before it is indexed, so
  `예산을`, `예산의` and `국가예산` all match `예산`. Ranking is BM25.
- **Local and zero-config.** One SQLite file, no server, no API key, no
  embeddings to pay for (an optional local embedding model can be added).
  Documents never leave your machine.
- **Incremental.** Re-indexing a folder only re-reads files that changed and
  drops files that were deleted.

Design notes and measurements (in Korean):
[Claude가 내 컴퓨터의 HWP 공문서를 검색하게 만들기](https://ai-dev.selfdeveloper01.com/posts/korean-docs-mcp/).

```text
You: 2027년 예산안에서 디지털 교과서 예산 얼마였는지 찾아줘
Claude: → search("디지털 교과서 예산")
        ← 2027 예산.hwpx, chunk 0
          | 분야 | 사업명 | 예산(억 원) |
          | 교육 | 디지털 교과서 | 495 |
        디지털 교과서 예산은 495억 원입니다 (2027 예산.hwpx 표 기준).
```

## Setup

You need [uv](https://docs.astral.sh/uv/getting-started/installation/)
(`brew install uv` or `pipx install uv`). The first start installs the
package with its Kiwi model (about 130 MB in total), so it takes a minute;
later starts are immediate.

**Claude Code**

```bash
claude mcp add korean-docs -- uvx korean-docs-mcp
```

**Claude Desktop** (`claude_desktop_config.json`), **Cursor** (`.cursor/mcp.json`)
and other clients that take the same format:

```json
{
  "mcpServers": {
    "korean-docs": {
      "command": "uvx",
      "args": ["korean-docs-mcp"]
    }
  }
}
```

Then ask the agent to index a folder, e.g. *"~/Documents/공문서 폴더 색인해줘"*,
and search it in plain Korean.

To index folders when the server starts, add them to `args`:
`["korean-docs-mcp", "--index", "/Users/me/Documents/공문서"]`.

## Try it on Glama

korean-docs-mcp is listed on [Glama](https://glama.ai/mcp/servers/RionHwang0/korean-docs-mcp).
There you can browse its tools, check its quality score, and test it online with
[MCP Inspector](https://glama.ai/mcp/inspector) before installing.

## Tools

| Tool | What it does |
|---|---|
| `index_documents(folder, recursive=True)` | Index `.hwp`, `.hwpx`, `.pdf`, `.docx`, `.xlsx`, `.pptx`, `.md`, `.txt` files under a folder. Only new or changed files are parsed. |
| `search(query, limit=8, folder=None, match_all=False, mode="auto")` | BM25 search over morphemes (plus vectors if enabled). Each hit has the chunk text, its heading, document path and chunk number. |
| `read_document(path, chunk=None, max_chars=6000, offset=None)` | Read a document as Markdown, from the start, around a search hit, or from `offset`. Long documents page with `next_offset`. |
| `list_documents(folder=None, limit=100, offset=0)` | Indexed documents with titles, sizes and chunk counts, paged. |
| `remove_document(path)` | Take a document, or every document under a folder, out of the index. Files on disk are never touched. |

Every tool declares MCP annotations (read-only, destructive, idempotent) and
describes each parameter in its schema.

## Search quality

KorQuAD 1.0 dev: for each of 5,774 questions, find the paragraph it was
written from among 964 paragraphs. Every row is SQLite FTS5 with its built-in
BM25; only the way text is split into terms changes.

| Method | Recall@1 | Recall@5 | Recall@10 | MRR@10 |
|---|---|---|---|---|
| FTS5 `unicode61` (SQLite default) | 0.761 | 0.887 | 0.911 | 0.816 |
| FTS5 `trigram` | 0.716 | 0.859 | 0.882 | 0.776 |
| **korean-docs-mcp** (Kiwi morphemes) | **0.896** | **0.980** | **0.988** | **0.933** |

Morpheme analysis costs about 0.5 ms per query. Reproduce with
[`benchmarks/korquad.py`](benchmarks/korquad.py).

Indexing 50 real government press releases (HWP and HWPX from korea.kr)
takes about 3 seconds, and a search takes under 1 ms.

## Optional semantic search

Keyword search over morphemes is the default and needs nothing else. To add
an embedding model (run locally with ONNX Runtime, no API key, downloaded once
on first use):

```json
{
  "mcpServers": {
    "korean-docs": {
      "command": "uvx",
      "args": ["--from", "korean-docs-mcp[embeddings]", "korean-docs-mcp", "--embeddings"]
    }
  }
}
```

`--embeddings` uses `multilingual-e5-large` (a 2.2 GB download). It is the
only model offered that is good at Korean (alone it finds the right KorQuAD
paragraph first 80% of the time, against 34% for the smaller MiniLM), but it
is slow on a CPU: about one second per chunk when indexing, so a folder of a
few hundred documents takes several minutes the first time (later runs only
embed new or changed files). `--embeddings minilm` (220 MB) is much faster
and much weaker. Turning embeddings on for an existing index embeds the chunks
already there on the next `index_documents` call.

How the two are combined was decided by measurement. Morpheme BM25 already
puts the right KorQuAD paragraph first 90% of the time, and mixing a model's
ranking in by reciprocal rank fusion (RRF) disturbs those answers: with
MiniLM it made results worse at every weight tried. So the server keeps the
keyword ranking as it is and gives the last quarter of the hits to passages
the keyword search did not return, such as a paraphrase that shares no word
with the text. That can never push a keyword hit out of the top
three-quarters, and with e5-large it gives the best Recall@10 of everything
tried:

| KorQuAD 1.0 dev, 10 hits | Recall@1 | Recall@5 | Recall@10 | MRR@10 |
|---|---|---|---|---|
| Keyword (morpheme BM25) | 0.896 | 0.980 | 0.988 | 0.933 |
| e5-large alone | 0.800 | 0.959 | 0.979 | 0.869 |
| RRF, e5-large at equal weight | 0.878 | 0.984 | 0.994 | 0.924 |
| RRF, e5-large at weight 0.1 | 0.897 | 0.984 | 0.990 | 0.935 |
| **Keyword + reserved slots, e5-large (default)** | **0.896** | **0.980** | **0.995** | **0.934** |
| MiniLM alone | 0.336 | 0.548 | 0.634 | 0.427 |
| RRF, MiniLM at equal weight | 0.573 | 0.815 | 0.916 | 0.678 |
| Keyword + reserved slots, MiniLM | 0.896 | 0.980 | 0.988 | 0.933 |

Reproduce with [`benchmarks/fusion_experiment.py`](benchmarks/fusion_experiment.py).

## How it works

1. **Parse.** HWP and HWPX are converted to Markdown with
   [unhwp](https://pypi.org/project/unhwp/), which scored best overall in
   [hwp-parser-bench](https://github.com/RionHwang0/hwp-parser-bench)
   (100% text and 95.5% table cells on public HWPX files); DOCX, XLSX and
   PPTX with [undoc](https://pypi.org/project/undoc/); PDF with
   [unpdf](https://pypi.org/project/unpdf-markdown/). Tables are requested as
   HTML, which keeps `rowspan`/`colspan`, and rewritten as Markdown tables with
   merged cells repeated in every position they cover.
2. **Chunk.** Paragraphs are grouped into chunks of up to 1,200 characters
   under their nearest heading. A table is always its own chunk; a long table
   is split by rows with its header repeated in every piece.
3. **Analyze.** [kohybrid](https://github.com/RionHwang0/kohybrid)'s
   `KoreanTokenizer` keeps nouns, numbers, foreign words and dictionary-form
   verbs and adjectives, and drops particles and endings.
4. **Index.** The lexemes go into an SQLite FTS5 table. Document titles are
   indexed with double weight. The original Markdown is stored for display.

The index lives at `~/.local/share/korean-docs-mcp/index.sqlite3`. Change it
with `--db` or the `KOREAN_DOCS_DB` environment variable.

## Limits

- Images, charts and scanned pages are not read (no OCR).
- PDF text depends on how the file was made: a word broken across a line can
  come out with a space in it, which a keyword search may miss.
- No vector search yet. BM25 over morphemes handles keyword-style questions
  well; paraphrased questions with no shared words are not found.

## Development

```bash
git clone https://github.com/RionHwang0/korean-docs-mcp && cd korean-docs-mcp
python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
pytest
```

`tests/test_server.py` starts the server over stdio and drives it with the
MCP Python client.

## License

MIT

TDQS

A4.5/5.0

Scored across 5 tools

Disambiguation5/5

Each tool targets a distinct action on the index: list, remove, index, search, and read. The descriptions actively disambiguate by cross-referencing each other (e.g. 'use list_documents instead to see which documents exist', 'use search instead' to find content), leaving no realistic misselection path.

Naming Consistency4/5

Names follow a clear verb_noun pattern: list_documents, remove_document, index_documents, read_document. The one deviation is 'search', a bare verb with no object, whereas 'search_documents' would complete the pattern; also singular/plural noun forms are mixed but readably so.

Tool Count5/5

Five tools exactly cover the lifecycle of a document index: ingest, query, read, enumerate, and purge. Nothing feels padded or missing at the count level; each tool earns its place.

Completeness4/5

Index, search, read, list and remove cover the core loop, including a re-index path via index_documents. Minor gaps: indexing is folder-only with no single-file option, and there is no status/stats or 'what changed since last index' tool beyond list_documents output.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues