ra-mcp (WIP)
MCPs for Riksarkivet
A MCP server and command-line tools for searching and browsing transcribed historical documents from the Swedish National Archives (Riksarkivet).
Features
Full-text search across millions of transcribed historical documents
Complete page transcriptions with accurate text extraction from historical manuscripts
Reference-based document browsing using official archive reference codes
Contextual search highlighting to identify relevant content quickly
High-resolution image access to original document scans via IIIF
Getting Started
Quick Setup
How to Use
1. Search for Keywords
Find documents containing specific words or phrases:
Options:
--max N
- Maximum search results (default: 50)--max-display N
- Maximum results to display (default: 20)--context
- Show full page transcriptions--max-pages N
- Maximum pages to load context for (default: 10)--no-grouping
- Show pages individually instead of grouped by document
2. Browse Specific Documents
When you find interesting documents, browse them directly:
Options:
--page
or--pages
- Page numbers (e.g., "5", "1-10", "5,7,9")--search-term
- Highlight this term in the text--max-display N
- Maximum pages to display (default: 20)
3. Get Full Context
See complete pages with surrounding context for better understanding:
Options:
--max-pages N
- Maximum pages to display (default: 10)--context-padding N
- Include N pages before/after each hit (default: 1)--no-grouping
- Show pages individually instead of grouped by document
Output Features
Search Results
Grouped by document for better context
Institution and date information
Page numbers with search hits
Snippet previews with keyword highlighting
Browse command examples for further exploration
Full Page Display
Complete transcriptions from ALTO XML
Keyword highlighting in yellow
Document metadata (title, date, hierarchy)
Direct links to images, ALTO XML, and Bildvisning
Context pages marked clearly
Links Provided
ALTO XML - Full transcription data
IIIF Images - High-resolution document images
Bildvisning - Interactive viewer with search highlighting
Collections & Manifests - IIIF metadata
Examples
Basic Workflow
Search for a keyword:
uv run tools/ra.py search "Stockholm"Get full context for interesting hits:
uv run tools/ra.py search "Stockholm" --context --max-pages 3Browse specific documents:
uv run tools/ra.py browse "SE/RA/123456" --page "10-15" --search-term "Stockholm"
Advanced Usage
Technical Details
Riksarkivet APIs & Data Sources
This tool integrates with multiple Riksarkivet APIs to provide comprehensive access to historical documents:
Current Integrations
Search API - Primary endpoint for full-text search across transcribed materials (Documentation)
IIIF Collections - Access to digitized document collections via IIIF standard (Documentation)
ALTO XML - Structured text transcriptions with precise positioning data
IIIF Images - High-resolution document images with zoom and cropping capabilities
Bildvisning - Interactive document viewer with search highlighting
OAI-PMH - Metadata harvesting for archive records and references (Documentation)
Additional Resources
The Riksarkivet Data Platform Wiki provides comprehensive documentation for building additional MCP integrations.
Experimental Features
Förvaltningshistorik - Semantic search interface (under evaluation)
AI-Riksarkivet HTRflow - Handwritten text recognition pipeline (PyPI package)
Troubleshooting
Common Issues
No results found: Try broader search terms or check spelling
Page not loading: Some pages may not have transcriptions available
Network timeouts: Tool includes retry logic, but very slow connections may time out
Getting Help
MCP Server Development
Running the MCP Server
Testing with MCP Inspector
Use the MCP Inspector to test and debug the MCP server:
The MCP Inspector provides a web interface to test server tools, resources, and prompts during development.
Current MCP Server Implementation
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Enables users to search and access digital collections from the Swedish National Archives (Riksarkivet) through multiple APIs. Supports searching records by keywords, exploring collections, and downloading historical images and documents.