Skip to main content

Model Context Protocol server for Taiwan law history and article scraping from Legislative Yuan database

Project description

Taiwan Law MCP Server

PyPI version Python 3.9+ License: MIT

A Model Context Protocol (MCP) server for scraping Taiwan law information from the Legislative Yuan's legal database. This server provides comprehensive access to Taiwan's legal documents, including law articles, amendments history, and legal text processing utilities.

🚀 Features

This MCP server provides 6 different tools for interacting with Taiwan law data:

Available Tools

  1. 🔍 search_law - Search for laws by name and get basic information
  2. 📜 get_law_history - Get complete history of a specific law including all amendments
  3. 📋 get_law_articles - Get current articles of a specific law
  4. 🔧 parse_law_text - Parse and normalize law text, converting Chinese numbers to Arabic
  5. 📅 convert_dates - Convert ROC (Republic of China) dates to Western dates
  6. 🔢 normalize_article_number - Convert Chinese article numbers to Arabic format

📦 Installation

Using pip (Recommended)

pip install taiwan-law-history-mcp

Using UV

uv add taiwan-law-history-mcp

From source

git clone https://github.com/yourusername/taiwan-law-history-mcp.git
cd taiwan-law-history-mcp
pip install -e .

🔧 Usage

As an MCP Server

Add this to your MCP client configuration (e.g., Claude Desktop):

{
  "mcpServers": {
    "taiwan-law-history-mcp": {
      "command": "taiwan-law-history-mcp"
    }
  }
}

Command Line Usage

# Run the MCP server
taiwan-law-history-mcp

# Test functionality
python -c "from taiwan_law_mcp.server import normalize_article_no; print(normalize_article_no('第十九條之一'))"

Usage

As an MCP Server

Add this to your MCP client configuration (e.g., Claude Desktop):

{
  "mcpServers": {
    "law-history-mcp": {
      "command": "uv",
      "args": ["run", "law-history-mcp"],
      "cwd": "/path/to/law_history_mcp"
    }
  }
}

Example Tool Calls

Search for a law:

{
  "tool": "search_law",
  "arguments": {
    "law_name": "農業保險法"
  }
}

Get law history:

{
  "tool": "get_law_history",
  "arguments": {
    "law_name": "農業保險法"
  }
}

Convert ROC date:

{
  "tool": "convert_dates",
  "arguments": {
    "roc_date": "1110520 修正"
  }
}

Normalize article number:

{
  "tool": "normalize_article_number",
  "arguments": {
    "article_text": "第十九條之一"
  }
}

Data Format

The server returns structured JSON data with normalized fields:

  • Article numbers are converted from Chinese (第十九條之一) to Arabic format (19-1)
  • ROC dates are converted to Western dates (YYYY-MM-DD)
  • Text is cleaned and normalized
  • Modification types are extracted (制定, 修正, 全文修正, etc.)

Dependencies

  • mcp >= 1.0.0
  • requests >= 2.31.0
  • beautifulsoup4 >= 4.12.0
  • html5lib >= 1.1
  • lxml >= 4.9.0

Technical Notes

  • Uses custom SSL configuration to handle legacy government websites
  • Implements proper session management and retry logic
  • Handles timeout.html redirects automatically
  • Supports multiple HTML parsers (html5lib, lxml, html.parser)

License

MIT License

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

taiwan_law_history_mcp-0.1.2.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

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

taiwan_law_history_mcp-0.1.2-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file taiwan_law_history_mcp-0.1.2.tar.gz.

File metadata

  • Download URL: taiwan_law_history_mcp-0.1.2.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for taiwan_law_history_mcp-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0c4414ee7bf49481e6a47dc962090d685db596aabd01606261e0c91c9b9bc2f2
MD5 f20ae7df8fa6ee83e8071ea3a9e062c1
BLAKE2b-256 c21f34171131d65319ae991d7e98a57da01deb1dad26bfd71a5a0f0af3025ccd

See more details on using hashes here.

File details

Details for the file taiwan_law_history_mcp-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for taiwan_law_history_mcp-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9a26d1200d1bb33525ad624f08b92e769ca6d5663b66dcb59da1aa2307a26e6b
MD5 7b58db7cf31f83dd8e32db606cc198d1
BLAKE2b-256 0e5758f1e6c0b7214e989874bb7df49b93245df806ce6af59e4af29cfaff8d5c

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