tw-law-mcp
This server is a source-bound MCP assistant for Taiwan (New Taipei City) interior renovation submission workflows. It helps route procedures, build document packets, parse correction notices, and enforce audit gates — without providing legal opinions or professional sign-offs.
Procedure Routing & Requirements
Determine the appropriate renovation procedure stage (e.g., plan review, completion inspection) with confidence scores; low-confidence decisions route to human confirmation
Return stage-specific New Taipei interior renovation procedure requirements
Document Packet Assembly
Build New Taipei submission/completion document checklists with missing-item hints and source references
Build sheet manifests from drawing/source snapshot filenames without reading raw content
Correction Notice Processing (Two-Stage Workflow)
Parse masked official correction notices into atomic correction items with source spans
Stage 1: Analyze masked text and metadata to produce analysis artifacts
Stage 2: Generate correction response drafts after human answers are applied
Law & Source Management
Search, retrieve, and verify Taiwan/New Taipei regulations from a deterministic P0 law snapshot with authority rank, license status, and source URL
Verify citations, check claim support, and retrieve local rules
Specialized Routing
Fail-closed routing for fire equipment, fire compartments, material evidence, and illegal-construction indicators
Human-in-the-Loop (HITL)
Build confirmation packets for low-confidence or professional-judgment items; apply human answers with fail-closed validation
Audit & Governance
Run deterministic audit gates (schema, citation, source, claim, redline, data governance) on correction items
Source Policy & Fallback
Retrieve and compare official-source authority rank, license, and update policies
Produce official-source fallback plans for corpus misses without performing live web searches
Metadata Handling
Extract metadata from files without ingesting raw drawing or document content into agent prompts
Acceptance & Verification
Run a full suite of acceptance tests covering source policies, jurisdiction registry, packaging, scenario matrix, data layout, source adapters, fixture pipeline, and two-stage flow integrity
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@tw-law-mcpsearch for interior decoration permit requirements in New Taipei City"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
cc-crossbeam-tw
Crossbeam TW is a source-bound document workflow for Taiwan interior-renovation submissions: route the case, check the packet, decompose corrections, and preserve the evidence needed for human review.
This repository is a prototype for architects, interior-renovation contractors, and administrative coordinators who spend more time reconciling procedures, drawings, correction notices, and missing documents than making the professional decisions themselves.
tw-law-mcp turns that work into deterministic, traceable MCP tools. A compatible assistant can inspect the local corpus and source snapshots, return the relevant artifacts and uncertainty, and stop for human confirmation when the evidence is incomplete. It is deliberately not a legal-advice or professional-sign-off system.
繁體中文說明 · Public Pages · Architecture · Acceptance evidence · Contributing
Contents
Related MCP server: mcp-tw-lvr
Why
The difficult part of an interior-renovation submission is rarely a single lookup. The difficult part is keeping these questions connected without losing their provenance:
Which procedure is this case actually approaching?
Which documents, drawings, photos, and evidence belong in the submission packet?
What does each correction item ask someone to change or confirm?
Which source, date, gate, and professional decision support the next action?
Crossbeam TW is built around that handoff. It keeps domain logic in a standalone MCP server, makes uncertainty visible, and treats human review as a required output rather than an exception.
The current domain focus is New Taipei interior renovation. Other jurisdictions are represented by registry stubs and fail closed until their source corpus and review policy are ready.
How it works
The repository has two related surfaces:
Standalone MCP server — the host-neutral
tw-law-mcpdomain boundary used by Codex, Claude Code, or another MCP client.Secure Web pilot — a local or single-user browser workflow for case intake, quarantine upload, masking, HITL review, artifacts, audit events, and deletion.
flowchart LR
A[Masked text + file metadata] --> B[tw-law-mcp]
B --> C[Procedure route]
B --> D[Submission packet]
B --> E[Correction items]
B --> F[Sources + gates]
C --> G[Human confirmation]
D --> G
E --> G
F --> G
R[Raw browser bytes] --> Q[Private quarantine]
Q --> W[Python scan + masking worker]
W --> A
G --> S[Sanitized artifacts]The Secure Web path keeps raw bytes out of the Next.js request body, model prompt, and logs. The local Codex provider is a worker credential only; it is never the website identity provider.
TODO (demo asset): the GitHub Pages site is static documentation, not a hosted instance of the Secure Web pilot — the actual HITL flow requires local Google/LINE auth and a locally running worker, which cannot be captured as a real screenshot or GIF from this environment. A walkthrough recording of the Secure Web HITL flow (intake → quarantine → masking → human confirmation) is still needed; track it as a follow-up once the pilot runs somewhere reachable for capture.
What it does
Workflow | Output |
Procedure routing | A candidate stage for drawing review, completion inspection, change-of-use plus completion inspection, or simple interior renovation, with confidence and follow-up questions. |
Submission checks | A New Taipei document packet, missing-item list, sheet/file manifest, and source-bound references. |
Correction handling | Masked-document parsing, atomic correction items, response-draft inputs, and a professional confirmation packet. |
Professional-domain routing | Evidence prompts for fire equipment, fire compartments, egress, and material documentation. |
Auditability | Law snapshots, source policy, authority rank, license/update status, as-of dates, gate results, and human-review state. |
The server currently exposes 38 MCP tools across law lookup, source policy, procedure routing, document handling, HITL, scenario checks, and acceptance gates. The canonical tool surface is in tw_law_mcp/server.py; the complete scenario index is in docs/tw-scenario-feature-matrix.md.
Trust and security
Read the Secure Web runbook before handling real documents.
Boundary | Rule |
Input | Prefer masked text, metadata, and de-identified fixtures. Raw drawings and raw PDFs do not belong in an assistant prompt. |
Quarantine | Browser uploads go directly to private quarantine and must pass scan, validation, and masking before downstream access. |
Model | Only the minimum sanitized fields cross the model boundary. Local Codex execution is read-only, ephemeral, and isolated from the repository. |
Domain | Taiwan procedure and source logic stays in Python |
Uncertainty | Missing evidence, low confidence, professional judgment, and unsupported claims fail closed and produce human-review work. |
Production | Cloud mode rejects local auth, local storage, local DB, in-process jobs, and the local Codex provider until approved adapters and credentials exist. |
This prototype does not:
decide whether a case is legal, illegal, or an unauthorized construction;
provide legal opinions, compliance guarantees, or professional certification;
guarantee that an authority will approve a submission;
decide fire-design conclusions or verify material authenticity;
enable PDF/image parsing in the authenticated worker; only UTF-8 TXT intake is supported in the pilot.
Install
MCP server
Requirements: Python >=3.10.
git clone https://github.com/trionnemesis/cc-crossbeam-tw.git
cd cc-crossbeam-tw
python3 -m unittest discover -s tests
python3 scripts/run_phase_acceptance.py
python3 scripts/tw_law_mcp_stdio.pyThe repository already includes host configuration:
Codex App:
.codex/config.tomlClaude Code:
.mcp.json
Secure Web pilot
Requirements: Node.js 22.x and Python 3.14 for the current CI path.
cd web
npm ci
npm run test:run
npm run typecheck
npm run lint
npm run build
npm startIn a second terminal, start the local worker:
python3 -m worker.secure_worker.serverUse web/.env.example and docs/runbook-secure-web.md for runtime modes, callback configuration, private storage, and external-credential gates. Production deployment is not implied by a green local build.
Example prompts
The safe pattern is to ask for a workflow artifact and its evidence boundary, not an unqualified legal conclusion.
Please run run_phase_acceptance with tw-law-mcp first.
Using only the masked document text and file metadata I provide, route this case
among drawing review, completion inspection, change-of-use plus completion inspection,
and simple interior renovation.
Return the procedure-stage confidence, human-confirmation questions, corpus packs,
artifacts, and reasons for anything you cannot determine.
Do not provide a legal opinion, compliance guarantee, fire-design conclusion,
material-authenticity conclusion, or approval promise.Other useful requests:
“Build a New Taipei completion-inspection submission packet and list missing evidence.”
“Parse this masked correction notice into atomic items and produce a human-confirmation packet.”
“Show the source IDs, as-of dates, failed gates, and unsupported claims behind this artifact.”
Current status
This is a public prototype, not a production compliance product.
Area | Current state |
Domain core |
|
MCP packaging | Standalone stdio JSON-RPC subset first; Codex and Claude Code remain thin wrappers. |
Workflow coverage | Groups 1–6 plus Phase 2.1–2.6 / Step 6: source policy, procedure/HITL, data layout, adapters, scenario tools, fixture pipeline, and two-stage flow skeleton. |
Fixture evidence | 12 synthetic de-identified cases and 84 atomic correction items validate schema, gates, and HITL contract. They do not support real-case claims. |
Secure Web | Local and single-user pilot paths cover identity, case authorization, direct quarantine upload, masking, Codex-auth worker analysis, HITL, audit, and verified deletion. |
Still required | Approved real de-identified cases, live official-source ingestion/refresh, public Google/LINE acceptance, and a separately sandboxed PDF/image parser. |
The latest local and CI evidence is recorded in ACCEPTANCE.md. Missing external credentials are intentionally reported as pending; they are not replaced with synthetic “production accepted” claims.
Repository map
Path | Purpose |
Deterministic law/source repository and MCP server. | |
Secure upload, masking, domain-processing, and local model-provider boundary. | |
Next.js Secure Web pilot and browser-facing workflow. | |
stdio entrypoint, snapshots, and targeted acceptance runners. | |
Python MCP/domain/worker tests. | |
Web, auth, upload, HITL, and security-boundary tests. | |
Pages site, ADRs, runbook, and feature matrices. | |
Current verification evidence and remaining gates. | |
Secure Web implementation state and external blockers. |
Research and design
ARCHITECTURE.md— runtime topology, trust boundaries, state machines, and data classes.docs/ADR-0001-packaging-strategy.md— why standalone MCP comes before host-specific plugins.docs/ADR-0002-secure-web.md— single-user Secure Web decisions and production flip conditions.docs/cc-crossbeam-feature-matrix.md— relationship to the originalcc-crossbeamworkflow.docs/tw-scenario-feature-matrix.md— Taiwan scenario coverage and acceptance mapping.docs/runbook-secure-web.md— operational setup, backup, deletion, and incident response.
FAQ
Is this a legal-advice tool?
No. It organizes procedures, documents, sources, uncertainty, and questions for professionals. It does not issue legal opinions, compliance guarantees, or sign-off.
Can I upload a client PDF or drawing?
Not to the current authenticated worker. The pilot accepts UTF-8 TXT and metadata only. Raw files, title blocks, and unmasked personal information require an approved quarantine and parser policy first.
Why is the MCP server separate from the web app?
The domain and source-of-truth boundary should remain host-neutral. Codex, Claude Code, the Secure Web, and future consumers should call the same deterministic tools instead of copying legal logic into each surface.
Is the Secure Web production-ready?
No. Local acceptance is documented, while live Google/LINE credentials, public HTTPS acceptance, approved production storage/model adapters, official-source refresh, and real de-identified cases remain explicit gates.
Where did the workflow idea come from?
The product workflow is informed by cc-crossbeam's document-review and correction-response flow (see Related projects for its current status). The Taiwan corpus, jurisdiction rules, source policy, and safety boundaries are implemented independently for this repository.
Related projects
cc-crossbeam — the original document-review and correction-response workflow that this repository's product design is informed by. It is not currently published as a public repository under this account, so no working link is available; the relationship is described in the FAQ above.
AIhouskeeperagent — a related project from the same author, covering AI-assisted operations/housekeeping agent work.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/trionnemesis/cc-crossbeam-tw'
If you have feedback or need assistance with the MCP directory API, please join our Discord server