Skip to main content

MCP server for education statistics of the Canton and City of Zurich (BISTA)

Project description

๐Ÿ‡จ๐Ÿ‡ญ Part of the Swiss Public Data MCP Portfolio

๐Ÿ“Š zh-education-mcp

Version License: MIT Python 3.11+ MCP No Auth Required CI

MCP server for education statistics of the Canton and City of Zurich (BISTA)

๐Ÿ‡ฉ๐Ÿ‡ช Deutsche Version


Overview

zh-education-mcp connects AI assistants to the Bildungsstatistik Kanton Zรผrich (BISTA) โ€” the official education statistics of the Canton of Zurich. It provides structured access to pupil numbers, school district trends, secondary school profiles, nationality breakdowns, and gymnasium graduation rates.

Source Data API
BISTA Kanton Zรผrich Learner statistics (Volksschule, Mittelschulen, Maturitรคt) REST/CSV

All data is fetched from the BISTA public API (bista.zh.ch/basicapi/ogd/) โ€” no API key required. Data is updated annually on 15 September (reference date).

Anchor demo query: "How has the number of pupils in school district Letzi developed over the last 5 years?"


Demo

zh-education-mcp demo: Claude queries BISTA data


Features

  • ๐Ÿ“Š 8 tools for education data across all school levels
  • ๐Ÿ” School district trends โ€” pupil numbers for all Schulkreise (Letzi, Glattal, Schwamendingen, Oerlikon, Uto, Waidberg, Zรผrichberg) from 2000 to present
  • ๐Ÿซ Secondary school profiles โ€” breakdown by requirement type (Sek A/B/C, Mittelschule, special classes)
  • ๐ŸŒ Nationality structure โ€” top nationalities of pupils per school community
  • ๐ŸŽ“ Gymnasium graduation rates โ€” Maturitรคtsquote by municipality, district, and canton
  • ๐Ÿ“ˆ Canton-wide overview โ€” all learners by school level, type, gender, and nationality
  • ๐Ÿ  Residence-based trends โ€” pupil counts by place of residence (Bezirk / Gemeinde)
  • ๐Ÿ›๏ธ Mittelschulen โ€” Gymnasium, FMS, HMS statistics
  • ๐Ÿ”“ No API key required โ€” all data under CC BY 4.0
  • โ˜๏ธ Dual transport โ€” stdio (Claude Desktop) + Streamable HTTP (cloud)

Prerequisites

  • Python 3.11+
  • uv (recommended) or pip

Installation

# Clone the repository
git clone https://github.com/malkreide/zh-education-mcp.git
cd zh-education-mcp

# Install
pip install -e .
# or with uv:
uv pip install -e .

Or with uvx (no permanent installation):

uvx zh-education-mcp

Quickstart

# stdio (for Claude Desktop)
python -m zh_education_mcp.server

# Streamable HTTP (port 8000)
python -m zh_education_mcp.server --http --port 8000

Try it immediately in Claude Desktop:

"Wie hat sich die Lernendenzahl im Schulkreis Letzi entwickelt?" "Zeige die Maturitรคtsquote der Stadt Zรผrich" "Welche Nationalitรคten sind in Adliswil am hรคufigsten?"

โ†’ More use cases by audience โ†’


Configuration

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "zh-education": {
      "command": "python",
      "args": ["-m", "zh_education_mcp.server"]
    }
  }
}

Or with uvx:

{
  "mcpServers": {
    "zh-education": {
      "command": "uvx",
      "args": ["zh-education-mcp"]
    }
  }
}

Config file locations:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Cloud Deployment (Streamable HTTP for browser access)

For use via claude.ai in the browser (e.g. on managed workstations without local software):

Render.com (recommended):

  1. Push/fork the repository to GitHub
  2. On render.com: New Web Service โ†’ runtime Docker (uses the provided Dockerfile)
  3. Set env vars: MCP_TRANSPORT=streamable-http, MCP_HOST=0.0.0.0, MCP_PORT=8000, and MCP_CORS_ORIGINS=https://claude.ai
  4. In claude.ai under Settings โ†’ MCP Servers, add: https://your-app.onrender.com/mcp

๐Ÿ’ก "stdio for the developer laptop, Streamable HTTP for the browser."

Health probe: GET /health. Full deployment guide (container, load balancing, CORS, resource limits): docs/deployment.md.


Available Tools

Tool Description
zh_edu_list_schulgemeinden List all school communities / Schulkreise in Canton Zurich
zh_edu_schulkreis_trend Pupil trend by Schulkreis (2000โ€“present)
zh_edu_overview Canton-wide learner overview by school level
zh_edu_sek1_profil Secondary I profile (Sek A/B/C breakdown)
zh_edu_staatsangehoerigkeiten Nationality structure of pupils per school community
zh_edu_maturitaetsquote Gymnasium graduation rates by municipality / district
zh_edu_wohnort_trend Residence-based learner trend (Bezirk / Gemeinde)
zh_edu_mittelschulen Secondary school statistics (Gymnasium, FMS, HMS)

Example Use Cases

Query Tool
"List all Schulkreise in Zurich" zh_edu_list_schulgemeinden
"Pupil trend in Letzi over 5 years" zh_edu_schulkreis_trend
"How many Sek A vs Sek B in Winterthur?" zh_edu_sek1_profil
"Top nationalities in Zรผrich-Letzi" zh_edu_staatsangehoerigkeiten
"Maturitรคtsquote of Stadt Zรผrich" zh_edu_maturitaetsquote

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Claude / AI   โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  zh-education-mcp            โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  BISTA Kanton Zรผrich     โ”‚
โ”‚   (MCP Host)    โ”‚โ—€โ”€โ”€โ”€โ”€โ”‚  (MCP Server)                โ”‚โ—€โ”€โ”€โ”€โ”€โ”‚  REST/CSV (Public API)   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚                              โ”‚     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                        โ”‚  8 Tools                     โ”‚
                        โ”‚  Stdio | Streamable HTTP     โ”‚
                        โ”‚  24h Cache                   โ”‚
                        โ”‚  No authentication required  โ”‚
                        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Data Source Characteristics

Source Protocol Coverage Auth Update
BISTA Kanton ZH REST/CSV Learner statistics 2000โ€“present None Annual (15 Sep)

Project Structure

zh-education-mcp/
โ”œโ”€โ”€ src/zh_education_mcp/
โ”‚   โ”œโ”€โ”€ __init__.py              # Package
โ”‚   โ”œโ”€โ”€ config.py               # ENV settings (MCP_*)
โ”‚   โ”œโ”€โ”€ constants.py            # API base, endpoints, timeouts
โ”‚   โ”œโ”€โ”€ logging_setup.py        # structured stderr logging
โ”‚   โ”œโ”€โ”€ provenance.py           # response envelope, license attribution
โ”‚   โ”œโ”€โ”€ http_client.py          # egress guard, connection pool, lifespan
โ”‚   โ”œโ”€โ”€ data.py                 # cache, CSV fetch, filters, error handling
โ”‚   โ”œโ”€โ”€ models.py               # Pydantic input models
โ”‚   โ”œโ”€โ”€ tools.py                # FastMCP instance, 8 tools, 2 resources
โ”‚   โ””โ”€โ”€ server.py               # thin composition layer + entrypoint
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ test_server.py           # Unit tests (mocked HTTP with respx)
โ”œโ”€โ”€ docs/                        # deployment, security, egress, roadmap, โ€ฆ
โ”œโ”€โ”€ Dockerfile                   # multi-stage, non-root, healthcheck
โ”œโ”€โ”€ docker-compose.yml           # resource limits, read-only rootfs
โ”œโ”€โ”€ .github/workflows/ci.yml     # GitHub Actions (Python 3.11/3.12/3.13)
โ”œโ”€โ”€ .github/dependabot.yml       # monthly dependency updates
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ CHANGELOG.md
โ”œโ”€โ”€ CONTRIBUTING.md              # + CONTRIBUTING.de.md
โ”œโ”€โ”€ SECURITY.md                  # + SECURITY.de.md
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ README.md                    # This file (English)
โ””โ”€โ”€ README.de.md                 # German version

Known Limitations

  • Annual updates only: BISTA data is updated once per year (reference date: 15 September). The 24h in-memory cache matches this cycle.
  • CSV-based API: The BISTA API returns CSV data; large datasets may take a moment to parse.
  • School community names: Names must match exactly (use zh_edu_list_schulgemeinden to find valid names).

Safety & Limits

Topic Details
No personal data BISTA statistics are aggregated โ€” no individual pupil data is exposed or accessible. All figures are anonymized at the school community level.
Read-only All tools are read-only (readOnlyHint: true). The server cannot modify, delete, or write any data.
No authentication The BISTA API is fully public. No API keys, tokens, or credentials are stored or transmitted.
Rate limits The BISTA API has no documented rate limit, but the server uses a 24h in-memory cache to minimize requests. Please use responsibly.
Data license All data is published under CC BY 4.0 by the Canton of Zurich. Attribution: Bildungsstatistik Kanton Zรผrich (BISTA).
Terms of Service Usage is subject to the BISTA terms of use. The MCP server is an independent open-source project and is not affiliated with the Canton of Zurich.
AI output disclaimer Statistics are passed through as-is from the BISTA API. AI-generated interpretations or summaries should be verified against the official BISTA portal.

Testing

# Unit tests (no API calls)
PYTHONPATH=src pytest tests/ -m "not live"

# Integration tests (live API calls)
pytest tests/ -m "live"

MCP Protocol Version

This server targets the MCP specification as implemented by the pinned mcp[cli] SDK (see pyproject.toml). Protocol/spec-version bumps are recorded in CHANGELOG.md. Dependencies (incl. the MCP SDK) receive monthly update PRs via Dependabot (.github/dependabot.yml).

Project phase: Phase 1 โ€” read-only (all tools readOnlyHint: true). See docs/roadmap.md.


Changelog

See CHANGELOG.md


Contributing

See CONTRIBUTING.md ยท ๐Ÿ‡ฉ๐Ÿ‡ช Beitragen


Security

See SECURITY.md ยท ๐Ÿ‡ฉ๐Ÿ‡ช Sicherheit


License

MIT License โ€” see LICENSE


Author

Hayal Oezkan ยท malkreide


Credits & Related Projects

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zh_education_mcp-0.2.3.tar.gz (116.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zh_education_mcp-0.2.3-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

Details for the file zh_education_mcp-0.2.3.tar.gz.

File metadata

  • Download URL: zh_education_mcp-0.2.3.tar.gz
  • Upload date:
  • Size: 116.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for zh_education_mcp-0.2.3.tar.gz
Algorithm Hash digest
SHA256 147a0a6c2f3e38616ad532a6654d7b65ac06256e250fef0d57b2cc9d302cef4b
MD5 9033c0047c01eb55c6fd7f0ebf9aa3bf
BLAKE2b-256 7543467efd5d1adbbc04b8ff4d16b1255f9c3122d31eed7edbcf4c6d28ea0215

See more details on using hashes here.

File details

Details for the file zh_education_mcp-0.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for zh_education_mcp-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 585dad8e4c891d4b58c2b21daab4ff07ca6a37e7c3c96a23b9e74499866282ea
MD5 a6a7503433f548d77d18949fece2fe18
BLAKE2b-256 bbac78fcb3ac3a9d4054e2a86d9e6e2bd29a365a0711fa83f1fa9405c3297193

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page