kftc-decisions
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
KFTC Decision Search
Full-text search over every decision the Korea Fair Trade Commission (KFTC) publishes, running on your own machine. KFTC Decision Search downloads the decision list and PDFs from the KFTC case system (case.ftc.go.kr), extracts the text, masks text that the public PDFs left under black redaction boxes, and builds one SQLite file. You search it from the command line or let an AI assistant search it through an MCP server.
Coverage: 20,331 decision PDFs from 1981 to 2026 (21,760 list rows; several cases can share one decision), 208,773 pages, as of November 2026.
Local: search terms and questions never leave your machine. The only network traffic is collecting from case.ftc.go.kr.
Three MCP tools:
index_info,search_decisions(full text, with page numbers and surrounding sentences) andread_decision(outline or selected pages).Monthly update: picks up decisions that were published late, which is common (median 59 days after the decision, longest 634 days in 2025–26).
Ships no decision text. You build your own index with the collector.
Why
KFTC decisions are also searchable through the law.go.kr Open API, which is what korean-law-mcp uses. Its KFTC tool sends only the query, so law.go.kr searches case names. Questions about reasoning or penalty calculation return nothing. law.go.kr also has a full-text mode (search=2), but it splits a query into loose word parts.
Same queries, 2026-11-26:
Query | law.go.kr, case names | law.go.kr, full text | …of which contain the term (sampled) | This index, fast | This index, exact |
독립경영 (independent management) | 0 | 423 | 0/20 | 44 | 83 |
관련매출액 계약금액 (relevant sales, contract value) | 0 | 1,973 | 7/20 | 773 | 812 |
정상가격 부당지원 (arm's-length price, undue support) | 0 | 282 | 3/20 | 132 | 141 |
정보교환 (information exchange) | 0 | 585 | 4/20 | 212 | 276 |
감면 취소 (leniency revoked) | 0 | 36 | 20/20 | 123 | 144 |
조사 협력 감경 (reduction for cooperation) | 0 | 890 | 20/20 | 1,600 | 1,746 |
지정자료 허위 (false designation data) | 64 | 234 | 5/20 | 84 | 86 |
All 11 queries are in eval/. Case-name search returned 0 for 9 of them. law.go.kr full text holds 8,330 KFTC decisions, mostly from 2011 on; this index starts in 1981. In a 20-hit sample per query, all 220 hits of this index contained the query words.
Related MCP server: 갈피 법령조회 MCP
How it works
flowchart LR
S[(case.ftc.go.kr)] -->|list pages| L[list collect / build<br/>decisions.jsonl]
L --> P[pdf plan / collect<br/>20,331 PDFs]
P --> T[text run<br/>PDFKit]
T --> M[match<br/>case no. in text?]
T --> R[redact<br/>text under black boxes]
M --> I[(index<br/>decisions.sqlite)]
R --> I
I --> C[search CLI]
I --> X[MCP server]
I --> H[KR Public Data Hub<br/>decision tab]List. The case system shows 10 rows per page. The collector pages through the full list and each of the 21 violation-type filters. Rows that share a decision date come back in a different order on each request, so rows repeat or go missing at page boundaries. Dates with duplicates are fetched again one day at a time until the day's count matches the site.
PDFs. One request at a time. When the session expires (about every 10 minutes) and the site answers with a page instead of a PDF, a new session is opened.
Text. macOS PDFKit, one
.txtper PDF with=== p.N ===page markers.Match. The first 4,000 characters must contain the case number, the decision number or the respondent's name. Files that fail go to
text/review_<date>.tsv; almost all are site-side problems such as "full text withheld" notices or another case's document attached.Redact. Some public PDFs put a black box over text that is still in the text layer, so text extraction returns what the box hides. Every page is rendered, filled black rectangles are located, and characters at least half inside one are recorded by position. The ledger stores positions and a page fingerprint, never the hidden characters. The index writes ■ in their place. When it fails, it hides: a page whose ledger entries cannot be verified against the text is left out of the index, and so is every page of a decision that was not scanned.
Index. SQLite FTS5 (unicode61 tokens, prefix match) plus zlib-compressed page text, about 310 MB for 208,773 pages.
Search. Fast uses the index: the start of each word must match. It misses terms glued inside longer words (독립경영 inside 친족독립경영) and terms written with a space (정보 교환). Exact scans every page with spaces and punctuation removed and finds those too, in about 8 seconds.
Quick start
Python 3.10 or later. Text extraction and the redaction check need macOS with the Xcode Command Line Tools (xcode-select --install). Searching and the MCP server run anywhere once you have an index.
git clone https://github.com/hyeokyun-kr/kftc-decision-search
cd kftc-decision-search
python3 -m venv .venv && .venv/bin/pip install -e ".[mcp]"
.venv/bin/kftc all # list → PDFs → text → match → redact → index, into ./data
.venv/bin/kftc search '"부당한 공동행위" 관련매출액 -하도급'
.venv/bin/kftc update # later, about once a monthThe first full run is estimated at 10–12 hours with the default one-second pause between requests, almost all of it PDF downloads (the original collection took 6 hours for the PDFs with a 0.3-second pause), and needs about 3.7 GB (PDFs 3.0 GB, text 0.4 GB, index 0.3 GB). Every step can be stopped and resumed by running the same command again. Steps can also be run one by one: kftc list collect, list build, pdf plan, pdf collect, text run, match, redact, index. Use --data <folder> or KFTC_DATA_DIR to put the data elsewhere. Tests: .venv/bin/pip install -e ".[test]" && .venv/bin/python -m pytest.
MCP server
.venv/bin/kftc mcp # stdio
.venv/bin/kftc mcp --http 8792 # Streamable HTTP on 127.0.0.1Claude Code:
claude mcp add kftc-decisions -e KFTC_DATA_DIR=/path/to/data -- /path/to/.venv/bin/kftc mcpClaude Desktop and other MCP clients:
{
"mcpServers": {
"kftc-decisions": {
"command": "/path/to/.venv/bin/kftc",
"args": ["mcp"],
"env": {"KFTC_DATA_DIR": "/path/to/data"}
}
}
}Tool | What it returns |
| Count, years, build date, and the violation and remedy types to filter by |
| Matching decisions: decision and case numbers, date, name, pages with hits, two snippets with page numbers, link to the KFTC record. Filters: violation type, remedy, year range. |
| By decision or case number. Without |
Query syntax for both: space-separated words must all appear, "quoted phrase" must appear as written, -word excludes decisions containing it.
Verification
The rows down to MCP server checked the author's original pipeline, from which this repository was extracted. The last row checks that this repository's code gives the same results on the same inputs.
What | Check | By | Result |
List (2026-11-13) | Rows collected vs. site total; 60 rows across decades re-searched on the site | Author | 21,752 = 21,752; 60 of 60 matched on all 7 compared fields (spaces ignored) |
PDFs (2026-11-16) | Downloads, PDF header and end marker | Author | 20,323 files, 0 failures, all with both markers |
PDF vs. case | Case number, decision number or name in the first 4,000 characters | Author, script | 20,230 matched. The other 93 opened by hand: 2 fine, 91 site-side (54 withheld-text notices, 21 another case's document, 12 damaged, 2 DRM, 1 test file, 1 empty), 0 download errors |
Index (2026-11-17) | Re-read all text files independently of the indexer | Author, separate script | Page and character totals equal; 300 random pages identical; 12 terms: 24,145 of 24,187 term–decision matches found (99.83%), 0 false hits |
Redaction (2026-11-26) | 32 flagged spots cropped and viewed, 8 per size band | Author | 32 of 32 were text under a black box (3 of them ■-shaped bullets); 0 false positives |
Monthly update (2026-11-25) | First run, then site total re-counted and each new decision searched on the site | Author, separate script | 8 min 30 s, 8 new decisions, 8 of 8 confirmed |
MCP server | 19 tool calls on the full index | Author | 19 of 19 pass |
This repository (2026-11-30) | Same inputs through this code vs. the original pipeline | Author, script | List 21,752 of 21,752 rows identical; PDF plan 20,323 of 20,323; index 20,331 decisions in every column and 208,773 pages identical; text of 20 sampled PDFs byte-identical; redaction scan of 50 sampled PDFs 1,424 of 1,424 positions identical; the 19 MCP checks pass on this server; one live PDF download byte-identical; live |
The offline test suite (43 tests) builds an index from made-up decisions and runs search, masking, the hide-on-failure rules, the CLI and all MCP tools. On macOS it also writes PDFs with a black box over a number, checks that extraction finds the number and the index does not, and runs a full update against a stub site.
Limitations
Only decisions the KFTC case system publishes. Press releases, examiner reports and court rulings are not included. Some files on the site are notices that the full text is withheld.
Text extraction and the redaction check use macOS PDFKit. On other systems you can search an index built elsewhere.
The redaction check misses boxes narrower than 8 pt (one or two characters), dark grey rather than black fills, marks placed beside rather than over the text, and characters less than half covered.
The data folder keeps the original PDFs and extracted text, including anything under black boxes, and the ledger records where it is. Share the index file, not the data folder.
Fast search misses terms inside longer words; use
exact=truewhen you need every case.Scraping depends on the current layout of case.ftc.go.kr.
Site etiquette
Requests go one at a time with a one-second pause (KFTC_LIST_DELAY, KFTC_PDF_DELAY), back off 15, 60 and 180 seconds on errors, stop after ten failures in a row, and identify the tool with a User-Agent that links to this repository. Saved list pages are reused so a rebuild does not ask the site again.
Use with KR Public Data Hub
The decision tab of KR Public Data Hub reads the same file. Point DATAHUB_DECISION_DB to data/index/decisions.sqlite.
License
MIT for the code. Decisions are published by the Korea Fair Trade Commission; this repository contains none of them.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Korean law: statutes, precedents, ordinances, treaties and citation verification (법제처 API).
Full-text search over FSS/FSC accounting supervision documents for Korean accounting professionals
Korean company facts in English for AI agents: ~830 KOSPI-listed companies (DART profiles, KRW financials, recent filings) and ~110,000 corporate public procurement suppliers (12-month KONEPS contract awards), plus live National Tax Service business status checks. 4 tools, keyless, read-only.
Korean statutes, precedents, local business-district stats and public procurement for AI agents.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to search, retrieve, and analyze South Korean legal documents including statutes, precedents, constitutional decisions, and administrative rulings via the Ministry of Government Legislation Open API. Provides 89 specialized tools with features like legal abbreviation auto-recognition, annex extraction, and complex research chain workflows.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to search and retrieve Korean laws, regulations, administrative rules, legal interpretations, and precedents via official APIs for legal review workflows.1MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to query and analyze Korean law, including statutes, precedents, and ordinances, with citation verification and impact analysis.10MIT
- AlicenseAqualityBmaintenanceKorean tax law for AI agents: search NTS rulings, court and Tax Tribunal decisions; read point-in-time statutes with the Act → Decree → Rule chain and amendment history; basic rules and execution standards; 96 tax treaties with withholding rates; forms and schedules; and verify citations in drafts. Fact-pattern comparison is done by your AI (or optional on-prem/cloud Upstage Solar).541,626 PyPI13MIT