Provides access to KB’s open APIs for national library data, culture, research, and linked data via a centralized MCP server.
Configuration
View docs{
"mcpServers": {
"isakskogstad-kb-mcp": {
"url": "https://your-service.onrender.com/mcp"
}
}
}You can access Sweden’s national library API ecosystem through the MCP server, enabling unified queries across libraries, cultural heritage objects, publications, and authority vocabularies. This server consolidates data sources like Libris, K-samsök, Swepub, and id.kb.se, and exposes a coherent set of tools you can use from a client to search, retrieve, and export metadata.
Connect to the MCP server from your client (HTTP) or run it locally (stdio) to access tools that search bibliographic records, artefacts, publications, authorities, and linked data. You can perform full-text searches, retrieve specific records, run advanced queries, export bibliographies, and explore data with SPARQL and demographic prompts. Use the HTTP endpoint for remote access or run the local Python server to host the API on your machine.
Prerequisites you need before installation: Python 3.8+ and pip. You may also want a virtual environment to isolate dependencies.
# Clone or download the project
# Replace with your actual path
cd kb-mcp-server
# Create a virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Linux/Mac
# or: venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Run tests
python test_kb_mcp.pyFor Claude Desktop configuration (Mac), add an MCP server entry to Claude’s config to run the local server from the editor:
{
"mcpServers": {
"kb-api": {
"command": "python",
"args": ["kb_mcp_server.py"],
"cwd": "/full/path/to/kb-mcp-server"
}
}
}Remote deployment using Render:
# Push to GitHub
# In Render, create a new Web Service using this repository
Build Command: pip install -r requirements.txt
Start Command: python kb_mcp_server.py --http --port $PORT
```
"https://your-service.onrender.com" will be your service URL.Dockerize the server for local experimentation:
docker build -t kb-mcp-server .
docker run -p 8000:8000 kb-mcp-serverThe server exposes multiple endpoints for health, information, and streaming messages via MCP. Use the public URL or run the stdio version locally to access the full set of tools.
If you run into port or networking issues, ensure the port specified in the Start Command is open and not blocked by a firewall. When running locally, verify your Python environment is activated and dependencies from requirements.txt are installed.
Hitting Libris and K-samsök endpoints is straightforward via your MCP client. For example, you can search for authors, fetch records, or retrieve related works across multiple data sources using the unified toolset.
Fritextsökning för Libris bibliotekscatalogen
Sök efter författare i Libris
Sök efter titel i Libris
Sök efter ämne i Libris
Sök efter bok- eller dokument-ISBN i Libris
Hämta specifik Libris post
Avancerad sökning i Libris med operatorer
Hämta biblioteksbestånd för ett verk eller post
Hämta alla utgåvor av ett verk
Sökförslag i Libris
Relaterade verk i Libris
CQL-sökning i K-samsök
Geografisk sökning i K-samsök
Sök efter objekttyp i K-samsök
Sök efter tidsperiod i K-samsök
Hämta specifikt objekt i K-samsök
Objektrelationer i K-samsök
Statistik och facetter i K-samsök
Lista poster i OAI-PMH
Hämta enskild post i OAI-PMH
Tillgängliga sets i OAI-PMH
Metadataformat i OAI-PMH
Paginering i OAI-PMH
Lista samlingar i data.kb.se
Hämta objekt från data.kb.se
Sök digitaliserat material i data.kb.se
IIIF-manifest från data.kb.se
Metadata i olika format från data.kb.se
Sök publikationer i Swepub
Sök efter forskare i Swepub
Sök efter lärosäte i Swepub
Sök efter ämne i Swepub
Hämta publikation i Swepub
Exportera till RIS/BibTeX i Swepub
Hämta entitet i id.kb.se
Sök auktoriteter i id.kb.se
Hämta vokabulärterm i id.kb.se
Lista vokabulär i id.kb.se
Kör SPARQL SELECT queries i Sparql
Beskriv resursen i Sparql
Räkna SPARQL-resultat
Frågemallar för SPARQL
Författarbibliografi export
Ämnesbibliografi export
Exportera sökresultat
Skapa publikationslista
Information om format
Översikt över alla API:er
Kontrollera serverstatus
Sök- tips och syntax
Datadefinitioner
Exempelfrågor
Sök i flera databaser samtidigt
Snabbstatistik från alla API:er
Hitta relaterade verk
Sök efter historisk period
Lista svenska län