Riksarkivet MCP Server
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.
README
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
# Search for anything - uv will auto-install dependencies
uv run tools/ra.py search "Stockholm"
How to Use
1. Search for Keywords
Find documents containing specific words or phrases:
# Basic search
uv run tools/ra.py search "Stockholm"
# Search with full page transcriptions
uv run tools/ra.py search "trolldom" --context --max-pages 5
# Search without document grouping
uv run tools/ra.py search "vasa" --context --no-grouping --max-pages 3
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:
# View single page
uv run tools/ra.py browse "SE/RA/123" --page 5
# View page range
uv run tools/ra.py browse "SE/RA/123" --pages "1-10"
# View specific pages with search highlighting
uv run tools/ra.py browse "SE/RA/123" --page "5,7,9" --search-term "Stockholm"
Options:
--pageor--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:
# Find pages with keyword and show full transcriptions
uv run tools/ra.py show-pages "Stockholm" --max-pages 5
# Include surrounding pages for context
uv run tools/ra.py show-pages "trolldom" --context-padding 2
# Show pages individually
uv run tools/ra.py show-pages "vasa" --no-grouping
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 3 -
Browse specific documents:
uv run tools/ra.py browse "SE/RA/123456" --page "10-15" --search-term "Stockholm"
Advanced Usage
# Comprehensive search with context
uv run tools/ra.py show-pages "handelsbalansen" --context-padding 2 --max-pages 8
# Targeted document browsing
uv run tools/ra.py browse "SE/RA/760264" --pages "1,5,10-12" --search-term "export"
# Large search with selective display
uv run tools/ra.py search "järnväg" --max 100 --max-display 30
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
uv run tools/ra.py --help
uv run tools/ra.py search --help
uv run tools/ra.py browse --help
uv run tools/ra.py show-pages --help
MCP Server Development
Running the MCP Server
# Install dependencies
uv sync && uv pip install -e .
# Run the main MCP server (stdio)
cd src/ra_mcp && python server.py
# Run with SSE/HTTP transport on port 8000
cd src/ra_mcp && python server.py --http
Testing with MCP Inspector
Use the MCP Inspector to test and debug the MCP server:
# Test the server interactively
npx @modelcontextprotocol/inspector uv run python src/ra_mcp/server.py
The MCP Inspector provides a web interface to test server tools, resources, and prompts during development.
Current MCP Server Implementation
This server provides access to the Swedish National Archives (Riksarkivet) through multiple APIs.
SEARCH-BASED WORKFLOW (start here):
- search_records: Search for content by keywords (e.g., "coffee", "medical records")
- get_collection_info: Explore what's available in a collection
- get_all_manifests_from_pid: Get all image batches from a collection
- get_manifest_info: Get details about a specific image batch
- get_manifest_image: Download specific images from a batch
- get_all_images_from_pid: Download all images from a collection
URL BUILDING TOOLS:
- build_image_url: Build IIIF Image URLs with custom parameters
- get_image_urls_from_manifest: Get all URLs from an image batch
- get_image_urls_from_pid: Get all URLs from a collection
TYPICAL WORKFLOW:
1. search_records("your keywords") → find PIDs
2. get_collection_info(pid) → see what's available
3. get_manifest_info(manifest_id) → explore specific image batch
4. get_manifest_image(manifest_id, image_index) → download specific image
Example PID: LmOmKigRrH6xqG3GjpvwY3
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。