原型 · 预览版:收录官方注册中心里的全部服务器,每 30 分钟同步一次。评价和账户功能将在后续阶段推出。
PopNx MCP为使用 AI 的人准备的 MCP 服务器 · 用大白话讲清楚

Openlex MCP

作者:malkreide版本 0.3.0i★ –i在你的电脑上运行
注册名称io.github.malkreide/openlex-mcp

安装

概览

作者提供的说明(英文原文)

Canton Zurich legislation via ZH-Lex with full-text search and article extraction

PopNx MCP 的三大支柱

这三项永远不会合并成一个分数:意见、测量和人气是不同的东西。

它能帮你做什么

我们还没有为它写通俗的介绍。下面是我们从注册中心读取到的事实。

  • 连接方式: 在你的电脑上运行
  • 传输方式: stdio
  • 分类: 法律与政府数据

安装

选择你使用的 AI 应用,然后复制设置。

安装之前

  • 基础检查:1 项中通过 1 项
  • 在你的电脑上运行,拥有你的用户账户的权限(文件、网络、应用)。
  • 注册中心没有列出需要填写的密钥。

你需要

  • PyPI已安装 Python 的 uv(用于 uvx 命令)

你用的是哪个应用?

在上方选择你的应用。我们会记住它,下次按钮会显示“安装到 …”。

打开 Claude Desktop → Settings → Developer → Edit Config,把下面的内容粘贴到 claude_desktop_config.json

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

在终端中运行这条命令

claude mcp add openlex -- uvx openlex-mcp

在 Cursor 中打开

或者自己复制设置

粘贴到项目中的 .cursor/mcp.json,或 ~/.cursor/mcp.json

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

浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。

在 VS Code 中打开

或者自己复制设置

粘贴到项目中的 .vscode/mcp.json

{
  "servers": {
    "openlex": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "openlex-mcp"
      ]
    }
  }
}

浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。

这个服务器在你的电脑上运行,而 ChatGPT 只能连接互联网上的服务器。请选择其他应用。

你的选择通过 Cookie 保存在这台设备上,无需账户。

这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。

它能做什么

它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。

基础检查i

我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月8日

  • ✓ 通过

    作者与仓库一致

    注册名称已通过 GitHub 账户 malkreide 验证,该账户拥有此仓库

  • … 尚未检查

    仍在维护

    我们还没有从 GitHub 读取这个仓库

  • … 尚未检查

    有许可证

    我们还没有从 GitHub 读取这个仓库

  • – 不适用

    端点有响应

    它在你的电脑上运行,没有互联网端点

  • – 不适用

    使用 OAuth 登录

    在你的电脑上运行,改用本地设置

  • … 尚未检查

    工具描述中没有隐藏指令

    它在你的电脑上运行;我们只能读取互联网端点的工具列表

与“法律与政府数据”中的其他服务器比较i

  • 星标数多于此分类中其他 1731 个服务器的 0%
  • 发布到注册中心的时间比此分类中其他 1731 个服务器的 45% 更新
  • 基础检查结果等于或优于此分类中其他 1731 个服务器的 100%

与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。

常见问题

Openlex MCP 安全吗?

它在 1 项适用的基础检查中通过了 1 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。

它需要哪些密钥或代码?

注册中心没有列出必需的密钥,不过有些服务器会在首次使用时要求你登录。

它在我的电脑上运行还是在云端?

它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。

它还在维护吗?

GitHub 仓库最后更新于–,最新版本(0.3.0)于41天前进入注册中心。

哪些应用可以使用它?

支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Python (uv)。

有什么可以替代它?

同一分类中有:Korea Stay, Contract Compass, SONAR: KYB due diligence

替代选择

同一分类中其他作者的服务器,按星标数排序。

如何看卡片:★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i

Korea Stay

作者:sallim.app

Korean lodging: 84,490 stays from 4 government permit ledgers + KTO TourAPI, honest gaps

在云端运行今天更新
安装

Contract Compass

作者:sallim-app

Korean public procurement law: rule-engine rulings, statutes search, live court precedents

在云端运行今天更新
安装

SONAR: KYB due diligence

作者:Ivanolegvak

Company register lookups and KYB checks: registries, sanctions, PEP, offshore leaks, adverse media.

在你的电脑上运行今天更新
安装

作者的 README

打开 README

按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。

🇨🇭 Part of the [Swiss Public Data MCP Portfolio](https://github.com/malkreide)

⚖️ openlex-mcp

MCP Server for Canton Zurich legislation (ZH-Lex) — full-text search, article extraction, and education law tools for ~970 cantonal laws

🇩🇪 Deutsche Version


Overview

openlex-mcp provides AI-native access to the entire legal collection of Canton Zurich (Zürcher Gesetzessammlung). It combines full-text data from HuggingFace with live metadata from the official zh.ch website, storing everything in a local SQLite database with FTS5 full-text indexing for sub-50ms search performance.

SourceDataAccess
HuggingFace974 ZH laws — full text (PDF extracts)Cached locally as SQLite + FTS5
zh.ch ZH-LexCurrent metadata, PDF links, validity statusLive HTTP requests

Built for the Schulamt (school department) of the City of Zurich, but covers all areas of cantonal law — from tax law to building regulations.

Anchor demo query: *"What does the Volksschulgesetz say about parental involvement? Show me Art. 55 VSG and find all articles that mention 'Elternrat'."*


Features

  • ⚖️ 8 tools covering search, retrieval, article extraction, and cache management
  • 🔍 FTS5 full-text search across ~970 cantonal laws with BM25 ranking
  • 📑 Article extraction — parse individual articles (Art. / §) with paragraph detection
  • 🏫 Education law shortcuts — specialized search for LS 412.x series (Volksschulgesetz, Lehrpersonalverordnung, etc.)
  • 🌐 Live metadata from zh.ch for current validity status and PDF links
  • 💾 Hybrid architecture — cached full-text (HuggingFace) + live metadata (zh.ch)
  • 🔓 No API key required — all data under open licenses (CC-BY-SA 4.0)
  • ☁️ Dual transport — stdio (Claude Desktop) + Streamable HTTP (cloud)

Development Phase

Current phase: Phase 1 — Read-Only. All tools are read-only (readOnlyHint: true); no writes to external systems. See ROADMAP.md for the phase plan and transition gates before any write or multi-agent capability is added.


Prerequisites

  • Python 3.11+
  • uv (recommended) or pip
  • Internet connection (for initial data download and live metadata)

Installation

# Clone the repository

git clone https://github.com/malkreide/openlex-mcp.git cd openlex-mcp

Install

pip install -e .

or with uv:

uv pip install -e .


Quickstart

# stdio (for Claude Desktop)

python -m openlex_mcp.server

Streamable HTTP — binds to 127.0.0.1:8000 by default (localhost only)

python -m openlex_mcp.server --http --port 8000

Network binding

By default the HTTP transport binds to `127.0.0.1` (localhost only). The host and port are configurable via the MCP_HOST / MCP_PORT environment variables (or the --host / --port CLI flags, which take precedence).

Never bind to 0.0.0.0 outside a container — it exposes the server to your local network (NeighborJack risk). For containerized/cloud deployments set MCP_HOST=0.0.0.0 explicitly; when that happens outside a detected container the server logs a warning.

Try it immediately in Claude Desktop:

*"What is the Volksschulgesetz (VSG)?"*

*"Find all Zurich laws about data protection"*

*"Show me Art. 1 of the Volksschulgesetz"*

*"Which education laws mention 'Schulleitung'?"*


Configuration

Claude Desktop

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

{

"mcpServers": { "openlex": { "command": "python", "args": ["-m", "openlex_mcp.server"] } } }

Or with the installed entry point:

{

"mcpServers": { "openlex": { "command": "openlex-mcp" } } }

Config file locations:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
Cloud Deployment (SSE 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 → connect GitHub repo
  3. Set start command: python -m openlex_mcp.server --http --port 8000
  4. Set environment variable MCP_HOST=0.0.0.0 so the container is reachable (the code default is 127.0.0.1; Render sets the RENDER env var, so no NeighborJack warning is logged)
  5. Set MCP_CORS_ORIGINS=https://claude.ai so the browser can read the Mcp-Session-Id header (comma-separated list; no wildcard — defaults to empty, i.e. no cross-origin access)
  6. In claude.ai under Settings → MCP Servers, add: https://your-app.onrender.com/sse

💡 *"stdio for the developer laptop, SSE for the browser."*


Available Tools

Search & Browse
ToolDescription
openlex__zhlaw_search_lawsFull-text search across all ~970 ZH laws (FTS5 + BM25 ranking)
openlex__zhlaw_get_lawRetrieve a law by LS number (e.g. 412.100) or abbreviation (e.g. VSG)
openlex__zhlaw_list_lawsList and filter laws by legal area prefix
openlex__zhlaw_find_education_lawsSpecialized search in education law (LS 412.x series)
Article Extraction
ToolDescription
openlex__zhlaw_get_articleExtract a specific article from a law (e.g. Art. 28 VSG)
openlex__zhlaw_search_articlesSearch within all articles of a specific law
Metadata & Cache
ToolDescription
openlex__zhlaw_get_law_metadataGet live metadata from zh.ch (PDF links, validity status)
openlex__zhlaw_update_cacheRefresh the local data cache from HuggingFace
Key Legal Area Prefixes (LS Numbers)
PrefixLegal AreaExample
131Constitution and popular rightsKantonsverfassung
170Administrative procedureDatenschutzgesetz
331Tax lawSteuergesetz
412Education and schoolsVolksschulgesetz (VSG)
700Spatial planning and buildingPlanungs- und Baugesetz
810HealthGesundheitsgesetz
Example Use Cases
QueryTool
*"What is the Volksschulgesetz?"*openlex__zhlaw_get_law
*"Find laws about data protection"*openlex__zhlaw_search_laws
*"Show me Art. 55 VSG"*openlex__zhlaw_get_article
*"Which education laws mention Schulleitung?"*openlex__zhlaw_find_education_laws
*"Find all articles about Elternrat in the VSG"*openlex__zhlaw_search_articles
*"Is LS 412.100 still in force?"*openlex__zhlaw_get_law_metadata

Architecture

┌─────────────────┐     ┌──────────────────────────────┐     ┌──────────────────────────┐

│ Claude / AI │────▶│ OpenLex MCP │────▶│ HuggingFace │ │ (MCP Host) │◀────│ (MCP Server) │◀────│ rcds/swiss_legislation │ └─────────────────┘ │ │ │ (974 ZH laws, cached) │ │ 8 Tools │ ├──────────────────────────┤ │ SQLite + FTS5 Cache │────▶│ zh.ch ZH-Lex │ │ Stdio | HTTP │◀────│ (live metadata + PDFs) │ │ │ ├──────────────────────────┤ │ No authentication required │ │ LexFind.ch │ └──────────────────────────────┘ │ (links only) │ └──────────────────────────┘

Data Source Characteristics
SourceProtocolCoverageAuthLicense
HuggingFace rcds/swiss_legislationDatasets API974 ZH laws (full text)NoneCC-BY-SA 4.0
zh.ch ZH-LexHTTP/HTMLCurrent metadata, PDFsNonePublic
LexFind.chHTTPCross-cantonal linksNonePublic
Design Decision: Tools-only (no MCP Resources)

All 8 endpoints are exposed as Tools rather than MCP Resources. Rationale:

  • Every lookup is parametric — queries, abbreviations, article numbers vary per call. Static Resources (one URI per document) don't capture this naturally.
  • The corpus is 974 laws × many articles — registering each as a Resource URI would create an impractically large resource list.
  • MCP Resource templates (zhlex://laws/{sr_number}) are a future consideration for Phase 2 if clients benefit from resource-level caching or subscriptions.
Scaling Constraints

The constraint depends on the protocol era the client speaks:

  • `2026-07-28` (modern) — every request is a self-contained POST carrying its own _meta envelope; the server answers without issuing an Mcp-Session-Id and keeps no session between requests. Any replica can answer any request; no shared store, no sticky routing. (subscriptions/listen streams live on the replica that opened them — this server's lists are fixed at import, so there is nothing to fan out.)
  • Handshake era (`initialize`, up to `2025-11-25`) — session state is kept in-process. Multiple replicas break active sessions because there is no shared session store (Redis, Durable Objects, etc.). A single-replica Render deployment routes all requests to one process, so no sticky-session LB is needed today.

Before scaling handshake-era clients beyond one instance: either add a shared session store or configure your edge load balancer to route on the Mcp-Session-Id header with a stick-table and an appropriate TTL.


MCP Protocol Version

ItemValue
Served via the `initialize` handshake2024-11-05 … `2025-11-25` — the handshake ceiling
Served via the per-request envelope`2026-07-28`
Who picksThe client's first request, once per connection. A request carrying the 2026-07-28 _meta envelope opens a modern connection; anything else opens a handshake connection.
SDKmcp[cli]>=2.0.0,<3
Cache hintstools/list, prompts/list, resources/list, resources/templates/list and server/discover: ttlMs 300000, cacheScope public
`serverInfo.version`The package version (openlex_mcp.__version__), in every server/discover result
Deprecated in `2026-07-28`, not usedLogging (ctx.info/ctx.warning, SEP-2577) — status goes into the tool result, diagnostics into the server log
Pinned insrc/openlex_mcp/server.py — MCP_PROTOCOL_VERSION constant
Update policy
  1. When mcp is upgraded (via Dependabot PR), verify the protocol version in the SDK release notes.
  2. If the protocol version changes, update MCP_PROTOCOL_VERSION in server.py, regenerate docs/tool-hashes.json (PYTHONPATH=src python scripts/gen_tool_hashes.py --write), and note the change in CHANGELOG.md.
  3. Run pytest tests/ -m "not live" to confirm compatibility before merging.

Project Structure

openlex-mcp/

├── src/openlex_mcp/ │ ├── init.py # Pa

只显示了开头部分;其余内容请在仓库中阅读

问 PopNx