DHLAB MCP Server
The DHLAB MCP Server provides tools for searching and analyzing the National Library of Norway's digital collections, enabling text analysis, linguistic research, and corpus statistics.
Text Search: Search the digital collection for books, newspapers, or journals by keyword, with optional filters for year range and media type.
NGram Frequency Analysis: Analyze and compare word frequency trends over time across book or newspaper corpora (1810–2020).
Concordance (HTML): Retrieve HTML-formatted in-context occurrences of a word within a specific document, useful for display purposes.
Concordance (Structured): Retrieve clean, structured concordance data (before/target/after fields) for programmatic analysis of word contexts.
Collocations: Discover words that frequently appear near a target word within a document, with a configurable context window.
Word Form Lookup: Retrieve all morphological forms of a given Norwegian word.
Word Lemma Lookup: Find the base/dictionary form (lemma) of a given Norwegian word.
Image Search: Search for images in the digital collection by keyword and optional year range.
Corpus Statistics: Retrieve statistical metadata about a set of documents identified by their URNs.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@DHLAB MCP Serversearch for texts about Ibsen from 1900-1950"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
dhlab-mcp
MCP server providing access to DHLAB (National Library of Norway Digital Humanities Lab) functionality through the Model Context Protocol.
Overview
This server exposes tools for:
Text search: Search the National Library's digital text collection
NGram analysis: Analyze word frequency trends over time
Concordance: Find word contexts in documents
Collocations: Discover words that appear together
Word lookup: Look up Norwegian word forms and lemmas
Image search: Search for images in the digital collection
Corpus statistics: Get information about document collections
Related MCP server: KB MCP Server
Installation
This project uses uv, which can be installed with:
# On macOS and Linux.
curl -LsSf https://astral.sh/uv/install.sh | shClone and install:
git clone https://github.com/marksverdhei/dhlab-mcp.git
cd dhlab-mcp
uv sync --devOr install directly:
pip install git+https://github.com/marksverdhei/dhlab-mcp.gitUsage
Configuring in Claude Code CLI
Add the MCP server to your Claude Code configuration:
# inside the repo directory:
claude mcp add --transport stdio dhlab -- uv --directory $PWD run dhlab-mcpor under user scope:
claude mcp add --scope user --transport stdio dhlab -- uv --directory $PWD run dhlab-mcpVerify the server is added:
claude mcp listThe DHLAB tools will then be available in your Claude Code sessions.
Running the MCP Server Standalone
You can also run the server directly for testing:
dhlab-mcpOr in development mode:
uv run dhlab-mcpRunning as a Local HTTP API
To run the MCP server as a local HTTP API on a custom port:
# Run on default port 8000
dhlab-mcp --transport http
# Run on a custom port
dhlab-mcp --transport http --port 9000
# Run on a specific host and port
dhlab-mcp --transport http --host 0.0.0.0 --port 8080The server supports the following transport options:
stdio(default): Standard input/output for CLI integrationhttp: Streamable HTTP transport (recommended for network access)sse: Server-Sent Events transport (legacy, for backward compatibility)
Once running, the HTTP server will be available at http://<host>:<port>/mcp/.
Available Tools
1. search_texts
Search for texts in the digital collection.
{
"query": "ibsen",
"limit": 10,
"from_year": 1900,
"to_year": 1950,
"media_type": "aviser" # or "bøker", "tidsskrift"
}2. ngram_frequencies
Get word frequency trends over time.
{
"words": ["frihet", "demokrati"],
"corpus": "bok", # or "avis"
"from_year": 1810,
"to_year": 2020
}3. find_concordances
Find word contexts in a document (returns HTML-formatted text).
{
"urn": "URN:NBN:no-nb_digibok_2008051404065",
"word": "Norge",
"window": 25
}Output format: HTML-formatted concordance with <b> tags highlighting matches.
4. word_concordance
Find word contexts with structured output (no HTML formatting).
{
"urn": "URN:NBN:no-nb_digibok_2008051404065",
"word": "Norge",
"window": 12
}Output format: Clean structured data with separate fields:
dhlabid: Document identifierbefore: Text before the matched wordtarget: The matched word itselfafter: Text after the matched word
Use cases:
Use
find_concordancesfor display/UI (HTML-formatted)Use
word_concordancefor analysis/processing (structured data)
5. find_collocations
Find words that appear near the target word.
{
"urn": "URN:NBN:no-nb_digibok_2008051404065",
"word": "frihet",
"window": 5
}6. lookup_word_forms
Look up different forms of a Norwegian word.
{
"word": "løpe"
}7. lookup_word_lemma
Look up the lemma (base form) of a word.
{
"word": "løper"
}8. search_images
Search for images in the collection.
{
"query": "Oslo",
"limit": 10,
"from_year": 1900,
"to_year": 1950
}9. get_corpus_statistics
Get statistics about a set of documents.
{
"urns": ["URN:NBN:no-nb_digibok_2008051404065"]
}Development
For development, install with:
uv sync --devRun tests:
pytestFormat code:
ruff format src/ tests/About DHLAB
DHLAB is a Python library for qualitative and quantitative analyses of digital texts from the National Library of Norway's collection. For more information, visit:
License
See LICENSE file.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityAmaintenanceEnables 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.217Apache 2.0
- Flicense-qualityDmaintenanceProvides access to Sweden's National Library (Kungliga biblioteket) open APIs, enabling search and retrieval of 20M+ bibliographic records, 10M+ cultural heritage objects, 2M+ research publications, and linked data through 52 tools across 10 endpoints.1
- Alicense-qualityBmaintenanceProvides programmatic access to the Directmedia Publishing 'Digitale Bibliothek' collection, a 1990s German electronic book library containing 101 volumes of classic literature and philosophy with text extraction, search, and navigation capabilities.MIT
- AlicenseBqualityDmaintenanceEnables interaction with the Norwegian Business Registry (Brønnøysundregistrene) API to search and retrieve detailed information about Norwegian companies, subunits, roles, organization forms, municipalities, and NACE industry codes.18141MIT
Related MCP Connectors
Search and analyze global news coverage and US TV transcripts via the GDELT Project APIs.
Unofficial NTNU course data: search, timetables, grades, course info, and exam logistics.
Congressional Documents — full-text search and retrieval over the official
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/marksverdhei/dhlab-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server