hls_mcp
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., "@hls_mcpsearch for the biography of Alfred Escher"
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.
hls_mcp
HLS (Historisches Lexikon der Schweiz | Dizionario Storico della Svizzera |
Dictionnaire Historique de la Suisse) — MCP server using the MCP 2.0
MCPServer API with streamable HTTP transport.
Corpus
33,506 articles across four categories:
bio(biographies),fam(families),geo(places),tem(topics/institutions)24,277 bio articles with birth/death dates and family names
Full-text content in German, French, Italian
Related MCP server: ch-eli-mcp
Building the database
The hls.db is built from the HLS CSV export on first run (or on demand):
docker compose run --rm hls-mcp python build_db.pyOr outside Docker:
HLS_SRC_CSV=/path/to/hls_articles.csv HLS_OUT_DB=/path/to/hls.db python build_db.pyRunning
docker compose up -dThe endpoint is http://localhost:8004/mcp by default, and whatever --http-path
says otherwise — see Transport.
Connect Claude Code with — note the name and URL are positional, there is no --url
flag:
claude mcp add --transport http hls http://<server-ip>:8004/mcp -s user-s user makes the server available in every project; -s project writes it to
.mcp.json to share with a repository. In Claude Desktop, Cowork or claude.ai, use
Customize → Connectors → + → Add custom connector with the same URL; those
clients connect from Anthropic's cloud, so the server must be reachable over the public
internet. In a .mcp.json the entry is {"type": "http", "url": "…"} — a url
without a type is read as a stdio server and skipped.
Tools
Tool | Description |
| Corpus summary: article/person counts, text size, categories |
| Meaning-based passage search — answers questions across languages |
| Coverage and provenance of the semantic index |
| FTS5 full-text search across title, text, lexical class |
| Full article record by HLS id (e.g. |
| Browse articles by type: bio, fam, geo, tem |
| Articles whose time-span overlaps a given year range |
| Paginated person authority list |
| Search persons by family name or forename |
| Person record by HLS person id (e.g. |
Semantic search
search_articles finds articles containing the words you typed. search_semantic
finds passages that mean what you asked — which is a different, and for this corpus
a more useful, thing:
It works across languages. HLS text is overwhelmingly German. Asking "Que sait-on du Pacte fédéral de 1291 ?" through
search_articlesreturns noise, because the French words are not in the German text. Throughsearch_semanticit returns Bundesvertrag and Schweizerische Eidgenossenschaft.It does not need the right word. Asking about the monastery at Königsfelden by keyword returned Franz Ludwig Haller von Königsfelden and passing mentions; by meaning, the Königsfelden article ranks first at 0.77.
It returns passages, not articles. A hit is one ~1000-character window with its offsets into the article, so an answer can quote and cite the paragraph rather than a 20,000-character biography.
Use search_articles when the exact string matters (a name, a spelling, a phrase) and
search_semantic when the question matters.
Building the index
GPUSTACK_API_KEY=... python embed_db.py # whole corpus
GPUSTACK_API_KEY=... python embed_db.py --limit 500 # trial run on a sample
GPUSTACK_API_KEY=... python embed_db.py --recompute # after changing the modelArticles are windowed into ~1000-character passages (150 overlap), each prefixed with
its article title so a passage lifted from mid-article still carries its subject, and
embedded with qwen3-embedding-0.6b on GPUStack (1024 dimensions). Vectors are stored
L2-normalised as float32 BLOBs.
Runs are resumable — chunks already embedded with the same model are skipped, and
each batch is committed — so an interrupted run continues rather than restarting.
Every run is recorded in embedding_runs with its model, dimensions and window
settings.
Measured on the full corpus (2026-08-21): 57,538 passages over all 33,506 articles, 183 seconds at ~320 passages/s. The database grows from 202 MB to 511 MB; the server holds 225 MB of vectors resident and loads them at startup, so no user query pays for the load. A search is one matrix multiply — exact, no approximate index, nothing to tune — and takes ~100 ms including the round trip to embed the query.
Query-time requirements
The server embeds the incoming query, so it needs GPUSTACK_API_KEY at runtime even
though the article vectors are already in the database. GPUStack is reachable only
from inside the UniBE network; from outside it returns 403 before checking the key,
so a 403 means the wrong network, not a bad credential. Without a key the other tools
work normally and search_semantic returns an explanatory error.
Transport
Streamable HTTP — one endpoint answering POST (requests), GET (the
server→client stream), and DELETE (session teardown).
This replaces the SSE transport this server used previously. SSE is deprecated, and
its handshake hands the client an absolute /messages/ path computed from the app's
own mount point — a path the client cannot reach when the server sits behind a
reverse-proxy sub-path. Clients pointed at /sse must be repointed.
Behind a reverse proxy
Set --http-path (or HLS_HTTP_PATH) to the public path, and give nginx a
location with the same string. Then nginx forwards the path unchanged:
location /mcp/hls/mcp {
proxy_pass http://127.0.0.1:8004; # no trailing slash
proxy_http_version 1.1;
proxy_set_header Connection '';
proxy_buffering off;
proxy_read_timeout 3600s;
chunked_transfer_encoding on;
}The app's path and the nginx location must agree exactly or every request 404s.
The startup line prints what is actually being served:
Starting HLS MCP server on 0.0.0.0:8004/mcp/hls/mcpEnvironment variables
Variable | Default | Description |
|
| Path to the SQLite database |
|
| Bind address |
|
| TCP port |
|
| Path the MCP endpoint is served at |
|
| bm25 column weights for |
|
| Embedding endpoint |
| — | Required to embed queries for |
|
| Embedding model (1024 dimensions) |
|
| Passages per embedding request |
|
| Passage windowing |
| (Qwen instruction) | Instruction prefix for query embedding |
|
| Host directory mounted at |
Query behaviour
Limits. Every limit is clamped to at most 500; a negative, zero, or non-numeric
value falls back to that tool's own default rather than returning the whole table.
Name search. SQL wildcards in a query are escaped, so searching for 100% finds a
literal "100%" rather than matching every record.
Full-text search. search_articles passes the query to FTS5, so operators work —
Bern OR Brugg, Zwing*, NEAR(...). An invalid FTS5 query falls back to quoted
phrases and then to a literal title search instead of raising.
Snippets. Each hit's snippet is drawn from the article body, with the matched
terms wrapped in <b>. Before this was fixed the snippet was taken from the title
column, so every hit's snippet was simply its own title — a RAG client had no way to
judge relevance without fetching each article in full.
Ranking
search_articles orders by bm25() with per-column weights rather than the
unweighted default, because a title match is the strongest signal that an article is
about the query, while an unweighted score lets any long article that mentions the
term often outrank it.
Column | Weight | Why |
| 0 | unindexed |
| 10 | the headword is what the article is about |
| 1 | baseline |
| 0.5 | classification, not content |
| 3 | a person search should reach the person |
Override with HLS_BM25_WEIGHTS (seven comma-separated numbers, in the column order
above). A malformed value is ignored in favour of the defaults, so it can never reach
the SQL.
These weights are reasoned, not yet tuned against the full corpus. Searching
Königsfeldenon the live corpus returnedFranz Ludwig Haller von Königsfeldenand several passing mentions ahead of the place itself; re-check that query after deploying and adjust the title weight if it still does.
Year ranges. list_articles_by_year reads the free-text time_span field, so the
overlap test runs in Python — over the candidate set before paging. It examines at
most YEAR_SCAN_CAP (5000) rows.
Result size. Claude.ai and Claude Desktop truncate a tool or resource result at roughly 150,000 characters; the 500-row ceiling keeps every tool under it.
Deployment
This server runs on tei.dh.unibe.ch at
https://tei.dh.unibe.ch/mcp/hls/mcp, alongside four sibling MCP servers:
Königsfelden, SSRQ, HBLS, EOS / HGB Basel.
What they share — the nginx routing, the landing pages, and the deploy sequence —
lives in tei_mcp_ops. Start there for
anything that spans the fleet; in particular, the app's --http-path and the nginx
location have to be the same string, which is the rule a sub-path deployment turns
on.
Tests
pip install pytest
pytest test_hls_mcp.pyUnit tests build their own throwaway database and need no setup. DB and server tests skip unless pointed at them:
HLS_DB=/data/hls.db HLS_SERVER=http://localhost:8004 pytest test_hls_mcp.pyRequires Python 3.10+ (X | None annotations); the container image is
python:3.12-slim.
This server cannot be installed
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
- AlicenseAqualityAmaintenanceMCP server for searching Swiss court decisions from federal and cantonal courts via entscheidsuche.ch. Enables full-text search, law reference lookup, and filtering by canton, court level, and date without API keys.81MIT
- AlicenseAqualityAmaintenanceMCP server for Swiss federal legislation metadata via Fedlex, enabling search and retrieval of act details with ELI URIs, SR numbers, and multilingual support.2Apache 2.0
- AlicenseAqualityAmaintenanceMCP server for TERMDAT, the terminology database of the Swiss Federal Administration, giving AI agents officially validated designations of Swiss authorities, departments, and legal acts across DE/FR/IT/EN with source references and validation status.71MIT

entscheidsuche-mcpofficial
AlicenseNot gradedqualityBmaintenanceMCP server for Swiss court decisions, enabling full-text search and retrieval of published decisions from all Swiss federal and cantonal courts in German, French, and Italian.3MIT
Related MCP Connectors
MCP server for Open Archives: Dutch genealogical records and historical page transcriptions.
Bible corpus MCP server: scripture, Greek/Hebrew interlinear data, cross-refs, semantic search.
opendata.swiss MCP — Switzerland's federal open-data portal (CKAN catalogue).
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/thodel/hls_mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server