/ra-mcp-tools:htr-transcriptionfrom ra-mcp-tools
Transcribes handwritten historical documents using HTRflow MCP tools. Batches images into a single transcription call and presents an interactive viewer with per-line JSON and archival exports.
Ships in ra-mcp-tools. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Transcribe handwritten historical documents using the HTRflow MCP server. Returns an interactive viewer, per-line transcription JSON, and archival exports.
htr_transcribe — Transcribe images and return result URLs/upload-files skill, then continue to step 2.Call htr_transcribe once with ALL image URLs in a single call.
Batching rule: Never call htr_transcribe multiple times for separate
images. Each call runs an expensive GPU pipeline — batch everything.
After transcription, present results as an inline artifact for the viewer and downloadable links for data exports.
Download the viewer HTML, then inline all external dependencies (OpenSeadragon JS and images) so the artifact is fully self-contained (the artifact sandbox blocks external requests).
curl -sL "{viewer_url}" -o /home/claude/viewer.html
Then run this Python script to embed dependencies:
import re, base64, urllib.request
with open("/home/claude/viewer.html", "r") as f:
html = f.read()
# Inline OpenSeadragon JS (CDN script -> inline script)
osd_match = re.search(r'<script src="(https://cdn[^"]+openseadragon[^"]+)">\s*</script>', html)
if osd_match:
with urllib.request.urlopen(osd_match.group(1)) as resp:
osd_js = resp.read().decode()
html = html.replace(osd_match.group(0), f"<script>{osd_js}</script>")
# Embed all Gradio image URLs as base64 data URIs
for url in set(re.findall(
r'https://riksarkivet-htr-demo\.hf\.space/gradio_api/file=[^\s"]+\.(?:jpg|png)', html
)):
with urllib.request.urlopen(url) as resp:
img_data = resp.read()
ext = "jpeg" if url.endswith(".jpg") else "png"
data_uri = f"data:image/{ext};base64,{base64.b64encode(img_data).decode()}"
html = html.replace(url, data_uri)
with open("/mnt/user-data/outputs/viewer.html", "w") as f:
f.write(html)
Then call present_files with /mnt/user-data/outputs/viewer.html to render
the interactive viewer as an inline artifact.
Provide the remaining URLs as clickable download links:
- Transcription data: [pages_url] (per-line JSON)
- Export: [export_url] (archival export)
Do NOT reproduce document text as plain text in your response — present the artifact and links instead.
| Value | Use when |
|---|---|
swedish | Swedish handwriting (default) |
norwegian | Norwegian handwriting |
english | English handwriting |
medieval | Medieval scripts |
| Value | Use when |
|---|---|
single_page | Single pages, snippets, cropped regions (default) |
spread | Two-page book openings (Swedish only) |
| Value | Description |
|---|---|
alto_xml | ALTO XML — standard archival (default) |
page_xml | PAGE XML — alternative archival format |
json | JSON — structured data format |
custom_yaml accepts a raw HTRflow YAML config string. Overrides
language and layout. Use only when user explicitly provides one.
Example — English modern handwriting with a custom TrOCR model:
steps:
- step: Segmentation
settings:
model: yolo
model_settings:
model: Riksarkivet/yolov9-lines-within-regions-1
- step: TextRecognition
settings:
model: TrOCR
model_settings:
model: microsoft/trocr-base-handwritten
generation_settings:
batch_size: 16
- step: OrderLines
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub ai-riksarkivet/ra-mcp --plugin ra-mcp-tools8 skills in this plugin
/archival-guideWhich Swedish records exist and where — maps a research topic to the right Förvaltningshistorik chapter (served as MCP resources), so you know what record type answers a question and which authority created it. Use when the user asks where to find records about something, what a record type is, or about court, church, tax, military, or population records (folkbokföring, bouppteckning, dombok, husförhörslängd, mantalslängd).
/archive-researchHow to browse, cite, and present archival findings — load AFTER search, when reading documents or reporting results. Covers research-integrity rules (never fabricate reference codes, always cite the exact page), old-Swedish translation, and the browse→synthesize workflow. Use when the user wants to browse or read pages, examine or interpret a document, translate old Swedish, or have findings cited and presented.
/archive-searchHow to query the Riksarkivet search tools — load BEFORE calling search_transcribed or search_metadata. Picks the right tool and builds queries with the fuzzy, wildcard, and old-Swedish-spelling tactics that AI transcription errors demand. Use when the user wants to search, find, or look up documents, people, places, or events in the Swedish National Archives (Riksarkivet) — including terms like trolldom, häxprocess, bouppteckning, or dombok.
/feedback-lsSend document pages to Label Studio for human review — pre-annotated tasks from ALTO XML, or blank image-only tasks to annotate from scratch. Use when the user wants human review, correction, or quality assurance of transcriptions or line/region segmentation, or wants to build annotation tasks from browse results.
/pdf-guideSearches and reads Riksarkivet's archival PDF guides (medieval Sweden, governance 1520-1920, Sami history). Use when user asks about Swedish history, archives, medieval charters, governance, Sami, or wants to open/search PDF guides. Provides section-level references with page numbers for citation./upload-filesTurn local files or user attachments into public URLs by uploading them to the Gradio server, so tools that require http(s) URLs (htr_transcribe, the viewer) can reach them. Use when you have local images or ALTO/PAGE XML — an attachment or a file path — but a tool needs a URL.
Other plugins' skills for the same job