hbls_mcp
MCP server providing full-text search and structured access to the Historisches Biographisches Lexikon der Schweiz, including biographies, articles, and volume listings.
README
hbls_mcp
Model Context Protocol (MCP) server for the Historisches Biographisches Lexikon der Schweiz (HBLS), offering full-text search and structured access to the 8-volume encyclopedia published 1921–1934.
Corpus
- 18,244 articles (3,718 biographies), 19,707 persons
- 8 volumes covering Swiss history, families, geography, and topics
- Source PDF: digibern.ch
- Predecessor to the Historisches Lexikon der Schweiz (HLS)
Quick start
# Requires hbls.db at /data/hbls.db
docker compose up --build -d
The server listens on port 8003 with streamable HTTP transport. The endpoint is
http://localhost:8003/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 hbls http://<server-ip>:8003/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_stats |
Corpus summary: article/member counts, text size, volumes |
search |
FTS5 full-text search across headwords + article text |
get_article |
Full article by headword + volume |
get_article_by_page |
Article at a given volume + page |
list_volume |
Paginated list of all articles in a volume |
get_family_members |
All persons listed under a family article |
search_persons |
Search persons by forename or family name |
search_bio |
Search biographies only (bio category) |
get_pdf_url |
Direct PDF URL for headword/volume/page |
get_articles_by_category |
List articles by category (fam/bio/geo/tem) |
get_category_stats |
Article counts per category |
Resources
hbls://stats— static corpus statistics snapshothbls://volume/{n}— article index for volume n:{volume, total, returned, truncated, articles: [...]}, capped at 1000 rows and flagged when truncatedhbls://article/{headword}/{volume}— single article
Database
The server expects the SQLite database at /data/hbls.db inside the container.
Mount the host directory containing hbls.db to /data. db.SCHEMA_SQL holds the
schema the server expects — the contract between the build pipeline and this server,
and what the tests build their fixtures from.
Transport
<a id="transport"></a>
Streamable HTTP — one endpoint answering POST (requests), GET (the
server→client stream), and DELETE (session teardown). A /health endpoint returns
{"status":"ok"}.
The endpoint path was previously hard-coded to /messages/, which belongs to the SSE
transport and made the endpoint impossible to guess from any client configuration. It
is now --http-path (default /mcp).
Behind a reverse proxy
Set --http-path (or HBLS_HTTP_PATH) to the public path, and give nginx a
location with the same string. Then nginx forwards the path unchanged:
location /mcp/hbls/mcp {
proxy_pass http://127.0.0.1:8003; # 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 HBLS MCP server on 0.0.0.0:8003/mcp/hbls/mcp
Environment variables
| Variable | Default | Description |
|---|---|---|
HBLS_DB |
/data/hbls.db |
Path to SQLite DB |
HBLS_HOST |
0.0.0.0 |
Listen address |
HBLS_PORT |
8003 |
Listen port |
HBLS_HTTP_PATH |
/mcp |
Path the MCP endpoint is served 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. The previous min(limit, 200) guard let
every negative through, and SQLite reads LIMIT -1 as unbounded.
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 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 headword search instead of raising.
Result size. Claude.ai and Claude Desktop truncate a tool or resource result at
roughly 150,000 characters. Search results therefore carry a snippet rather than the
full article_text — 20 full articles ran well past that limit. Use get_article for
the text of one article.
Tests
pip install pytest
pytest test_hbls_mcp.py
Unit tests build their own throwaway database and need no setup. DB and server tests skip unless pointed at them:
HBLS_DB=/data/hbls.db HBLS_SERVER=http://localhost:8003 pytest test_hbls_mcp.py
Requires Python 3.10+ (X | None annotations); the container image is
python:3.12-slim.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。