KB
- python
0
GitHub Stars
python
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
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.
How to use
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.
How to install
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.py
For 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-server
## Additional notes
The 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.
## Troubleshooting and tips
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.
## Examples of usage
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.
## Available tools
### libris\_search
Fritextsökning för Libris bibliotekscatalogen
### libris\_search\_author
Sök efter författare i Libris
### libris\_search\_title
Sök efter titel i Libris
### libris\_search\_subject
Sök efter ämne i Libris
### libris\_search\_isbn
Sök efter bok- eller dokument-ISBN i Libris
### libris\_get\_record
Hämta specifik Libris post
### libris\_find
Avancerad sökning i Libris med operatorer
### libris\_get\_holdings
Hämta biblioteksbestånd för ett verk eller post
### libris\_get\_work
Hämta alla utgåvor av ett verk
### libris\_autocomplete
Sökförslag i Libris
### libris\_related
Relaterade verk i Libris
### ksamsok\_search
CQL-sökning i K-samsök
### ksamsok\_search\_location
Geografisk sökning i K-samsök
### ksamsok\_search\_type
Sök efter objekttyp i K-samsök
### ksamsok\_search\_time
Sök efter tidsperiod i K-samsök
### ksamsok\_get\_object
Hämta specifikt objekt i K-samsök
### ksamsok\_get\_relations
Objektrelationer i K-samsök
### ksamsok\_statistics
Statistik och facetter i K-samsök
### oaipmh\_list\_records
Lista poster i OAI-PMH
### oaipmh\_get\_record
Hämta enskild post i OAI-PMH
### oaipmh\_list\_sets
Tillgängliga sets i OAI-PMH
### oaipmh\_list\_formats
Metadataformat i OAI-PMH
### oaipmh\_resume
Paginering i OAI-PMH
### kb\_data\_list\_collections
Lista samlingar i data.kb.se
### kb\_data\_get\_item
Hämta objekt från data.kb.se
### kb\_data\_search
Sök digitaliserat material i data.kb.se
### kb\_data\_get\_manifest
IIIF-manifest från data.kb.se
### kb\_data\_get\_metadata
Metadata i olika format från data.kb.se
### swepub\_search
Sök publikationer i Swepub
### swepub\_search\_author
Sök efter forskare i Swepub
### swepub\_search\_affiliation
Sök efter lärosäte i Swepub
### swepub\_search\_subject
Sök efter ämne i Swepub
### swepub\_get\_publication
Hämta publikation i Swepub
### swepub\_export
Exportera till RIS/BibTeX i Swepub
### idkb\_get\_entity
Hämta entitet i id.kb.se
### idkb\_search
Sök auktoriteter i id.kb.se
### idkb\_get\_vocab\_term
Hämta vokabulärterm i id.kb.se
### idkb\_list\_vocab
Lista vokabulär i id.kb.se
### sparql\_query
Kör SPARQL SELECT queries i Sparql
### sparql\_describe
Beskriv resursen i Sparql
### sparql\_count
Räkna SPARQL-resultat
### sparql\_templates
Frågemallar för SPARQL
### export\_author\_bibliography
Författarbibliografi export
### export\_subject\_bibliography
Ämnesbibliografi export
### export\_search\_results
Exportera sökresultat
### export\_publication\_list
Skapa publikationslista
### export\_formats\_info
Information om format
### kb\_api\_info
Översikt över alla API:er
### kb\_api\_status
Kontrollera serverstatus
### kb\_search\_tips
Sök- tips och syntax
### kb\_data\_dictionary
Datadefinitioner
### kb\_example\_queries
Exempelfrågor
### combined\_search
Sök i flera databaser samtidigt
### quick\_stats
Snabbstatistik från alla API:er
### find\_related\_works
Hitta relaterade verk
### historical\_periods\_search
Sök efter historisk period
### swedish\_counties\_info
Lista svenska län