MCP server for searching Taiwan judicial judgments (司法院裁判書系統) — AI-callable tools over Model Context Protocol
Project description
MCP Taiwan Judgment Search
An MCP server for searching Taiwan judicial judgments, exposing AI-callable tools over Model Context Protocol (MCP).
Features
- Two MCP tools — full-text search across all Taiwan judicial judgments and full-document fetch by ID
- stdio JSON-RPC 2.0 — standard MCP transport protocol
@mcp.tool()decorator — Pydantic-typed tool registration- Two-step scraping — handles the judicial site's iframe-based result rendering
- No-auth public endpoint — 司法院裁判書系統 is fully public; no API keys required
- Pure HTML parser layer —
parser/is decoupled from HTTP and tested offline with saved fixtures
Available Tools
| Tool | Description |
|---|---|
search_judgments |
Full-text keyword search across all judicial judgments. Paginated 20 per page. Returns judgment_id, title, ruling date, case reason, URL, and a text preview per entry. |
get_judgment |
Fetch the complete text and metadata of a single judgment by its judgment_id. |
lookup_legal_term |
Look up a legal term in the 司法院裁判書用語辭典. Returns definitions for each applicable legal domain (民事、刑事、行政、家事). Optionally filter by domain. |
Requirements
- Python
3.12+ - One of:
uv(recommended) orpip
Installation
Option 1 — uvx (no install, runs on demand)
uvx mcp-tw-judgment
Option 2 — pip / uv pip
pip install mcp-tw-judgment
# or
uv pip install mcp-tw-judgment
After install, the mcp-tw-judgment console script is available.
Option 3 — From source
git clone https://github.com/asgard-ai-platform/mcp-tw-judgment.git
cd mcp-tw-judgment
uv sync
uv run mcp-tw-judgment
Usage
The server speaks MCP over stdio. Add it to your client of choice:
Claude Desktop
~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"tw-judgment": {
"command": "uvx",
"args": ["mcp-tw-judgment"]
}
}
}
Claude Code
Add to your project's .mcp.json:
{
"mcpServers": {
"tw-judgment": {
"command": "uvx",
"args": ["mcp-tw-judgment"]
}
}
}
Cursor
~/.cursor/mcp.json:
{
"mcpServers": {
"tw-judgment": {
"command": "uvx",
"args": ["mcp-tw-judgment"]
}
}
}
Example Tool Usage
You: 最近有哪些和著作權有關的判決
AI call: tw-judgment - search_judgments (MCP)(keyword: "著作權")
{
"keyword": "著作權",
"total": 55265,
...
}
Result: 以下是最近的著作權相關判決(共 55,265 筆,以下列出最新 10 件核心案件):
115.04.15 │ 智慧財產及商業法院 │ 114年民著訴52 │ 侵害著作權有關人格權爭議
...
You: 請告訴我 114年民著訴52 的詳細資訊
AI call: tw-judgment - get_judgment (MCP)(judgment_id: "IPCV,114,民著訴,52,20260415,1")
Result: 114年民著訴52 的詳細資訊如下:...
Project Structure
mcp-tw-judgment/
├── app.py # FastMCP singleton
├── mcp_server.py # Entry point (stdio transport)
├── config/settings.py # API base URL, endpoints, request headers
├── connectors/rest_client.py # HTTP GET helper with retry + encoding detection
├── auth/none.py # No-op auth module (public endpoint)
├── parser/
│ ├── judgment_parser.py # Pure HTML parsers for judgments (no HTTP)
│ └── terms_parser.py # Pure HTML parsers for 用語辭典 (no HTTP)
├── tools/judgment_tools.py # MCP tool definitions
├── tests/
│ ├── fixtures/ # Saved HTML responses for offline unit tests
│ ├── test_judgment_parser.py # Unit tests (no network)
│ ├── test_terms_parser.py # Unit tests for terms parser (no network)
│ └── test_all_tools.py # Tool tests (live API, opt-in via RUN_LIVE_TESTS=1)
└── scripts/auth/test_connection.py
Development
# Setup
uv sync
# Connection check
uv run python scripts/auth/test_connection.py
# Run server locally
uv run mcp-tw-judgment
# Offline tests (parser + tool registration)
uv run python -m unittest tests.test_judgment_parser tests.test_all_tools -v
# Live API tests (hits 司法院 endpoint)
RUN_LIVE_TESTS=1 uv run python -m unittest tests.test_all_tools -v
See CONTRIBUTING.md for adding new tools.
License
MIT License — see LICENSE for details.
Data Source & Disclaimer
This project directly scrapes the 司法院裁判書系統 public search interface — this is not an official API.
Please note: This tool is intended for personal research and ad-hoc queries only. Do not use it for bulk automated access or scraping, as this may place undue load on the judicial system's servers. Use at your own discretion and in accordance with the website's terms of use.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_tw_judgment-0.2.0.tar.gz.
File metadata
- Download URL: mcp_tw_judgment-0.2.0.tar.gz
- Upload date:
- Size: 78.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc2547c77bbb08d5521381278e7bb04c9eeb26351fb743b575bc7fc0db105c98
|
|
| MD5 |
e0c7cf7c42b82f97682fce5d0d4c9c84
|
|
| BLAKE2b-256 |
9bb3d00d66065d45d16d13e14c40802b9689d279774cba9e6c9445705e80017f
|
Provenance
The following attestation bundles were made for mcp_tw_judgment-0.2.0.tar.gz:
Publisher:
publish.yml on asgard-ai-platform/mcp-tw-judgment
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_tw_judgment-0.2.0.tar.gz -
Subject digest:
bc2547c77bbb08d5521381278e7bb04c9eeb26351fb743b575bc7fc0db105c98 - Sigstore transparency entry: 1326014433
- Sigstore integration time:
-
Permalink:
asgard-ai-platform/mcp-tw-judgment@734671cb827ead71a2247ca1f08b176f134669fe -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/asgard-ai-platform
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@734671cb827ead71a2247ca1f08b176f134669fe -
Trigger Event:
release
-
Statement type:
File details
Details for the file mcp_tw_judgment-0.2.0-py3-none-any.whl.
File metadata
- Download URL: mcp_tw_judgment-0.2.0-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
828f582759bab4682a2af1227b77e460d2b2aba42692cf7a7ecba90a133462c9
|
|
| MD5 |
0d608f74bd8ed10ba2f2c22e9cf0697f
|
|
| BLAKE2b-256 |
e014fe712e5e7220fdfc939a723d92cf822418af1ccd0c2f6bc9f2089dc7e18a
|
Provenance
The following attestation bundles were made for mcp_tw_judgment-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on asgard-ai-platform/mcp-tw-judgment
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_tw_judgment-0.2.0-py3-none-any.whl -
Subject digest:
828f582759bab4682a2af1227b77e460d2b2aba42692cf7a7ecba90a133462c9 - Sigstore transparency entry: 1326014531
- Sigstore integration time:
-
Permalink:
asgard-ai-platform/mcp-tw-judgment@734671cb827ead71a2247ca1f08b176f134669fe -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/asgard-ai-platform
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@734671cb827ead71a2247ca1f08b176f134669fe -
Trigger Event:
release
-
Statement type: