HGB Basel MCP Server
Enables querying the Historisches Grundbuch Basel corpus, including full-text search, person lookups, and property dossier retrieval, through MCP-compatible clients like Claude.
README
HGB Basel — MCP Server
An MCP server that exposes the Historisches Grundbuch Basel (HGB) corpus for use with Claude and other MCP-compatible clients.
Architecture
hgb_full_*.xml ──► build_db.py ──► hgb.db (SQLite + FTS5)
│
server.py (FastMCP / HTTP SSE)
│
http://<host>:8000/sse
The 800 MB XML is parsed once into a ~100 MB SQLite database. The server then runs stateless queries against it.
Setup
1. Install dependencies
cd mcp_server
pip install -r requirements.txt
2. Build the database
python build_db.py --xml ../hgb_full_26_05_29_05.xml --db hgb.db
This takes ~10 minutes and produces hgb.db. Run it once; repeat only when the XML changes.
3. Start the server
python server.py --db hgb.db --host 0.0.0.0 --port 8000
4. Connect a client
Add to your claude_desktop_config.json (or equivalent):
{
"mcpServers": {
"hgb": {
"url": "http://<server-ip>:8000/sse"
}
}
}
Or for Claude Code:
claude mcp add hgb --transport sse --url http://<server-ip>:8000/sse
Docker deployment (recommended for the vServer)
Build image
docker compose build
First-time: build the database
# Copy XML to /data/hgb/ on the server, then:
docker run --rm \
-v /data/hgb:/data \
hgb-mcp \
python build_db.py --xml /data/hgb_full_26_05_29_05.xml --db /data/hgb.db
Run
docker compose up -d
Update /data/hgb in docker-compose.yml to match the actual path on the vServer.
Reverse proxy (nginx, optional but recommended)
server {
listen 443 ssl;
server_name hgb-mcp.example.unibe.ch;
location / {
proxy_pass http://localhost:8000;
proxy_http_version 1.1;
# Required for SSE
proxy_set_header Connection '';
proxy_buffering off;
proxy_cache off;
chunked_transfer_encoding on;
}
}
Available tools
| Tool | Description |
|---|---|
corpus_stats |
Document/span/person/event counts and year range |
search_persons(query, limit) |
FTS search for person names (FTS5 syntax) |
get_document(doc_id) |
Full document: text, all spans, events |
get_dossier(dossier_id) |
All documents for a property, ordered by year |
search_text(query, limit) |
Keyword search over raw transcriptions with snippets |
get_persons_in_year_range(year_from, year_to, limit) |
Person mentions filtered by year |
get_cooccurrences(person_name, limit) |
Other persons in the same documents |
list_dossiers(limit) |
All properties with coordinates and year ranges |
Available resources
| URI | Description |
|---|---|
hgb://stats |
Corpus statistics (JSON) |
hgb://dossiers |
All dossiers (JSON) |
hgb://document/{doc_id} |
Single document (JSON) |
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.