@pipeworx/michigan-code
Connect: https://pipeworx.io/mcp — every tool in the catalog, including @pipeworx/michigan-code’s. Install: one-click buttons
Connect to just the @pipeworx/michigan-code pack
https://gateway.pipeworx.io/michigan-code/mcp — only @pipeworx/michigan-code’s own tools, nothing else in the catalog.
No MCP client? Skip the connection: POST https://gateway.pipeworx.io/v1/tools/search_packs {"query":"..."} to find a tool below, GET /v1/tools/<name> for its schema, POST the same URL with arguments for the data — see For AI agents.
Tools: 3
Michigan Compiled Laws (statutes, mi_compiled_law) by citation, and — since fleet
#3957 — the Michigan Administrative Code (agency rules, mi_admin_rule and
mi_admin_rule_search). Keyless. 750.316 is first degree murder; R 400.4142 is
the Child Caring Institutions rule on medication storage and dispensing.
See docs/state-law-probe.md for how this source was verified: every state pack
confirms a MISS is distinguishable from a HIT before shipping, because several
state sites answer HTTP 200 for statutes that do not exist.
What text contains (fleet #3598)
text is the statute: the section’s catchline and its body, as the Michigan Legislature
publishes the Compiled Laws. It does not include the History line (the public acts that
enacted or amended the section, with their effective dates), editor’s notes or commentary.
Those used to arrive in text when every call was a live read, so a caller that parsed the
History line now gets less than it did; nothing was lost from the law itself. Every answer
carries a text_scope field saying which it is: the stored copy (served_from: "stored-copy")
is statute text only, while the live fallback returns the page text from the section number
onward and can still include History and editor’s notes. A repealed section is stored with its
repeal note as its text.
Stored copy and data_as_of (fleet #3546)
The Legislature’s site answers US data centres but refuses or stalls from Singapore: over 7 days external callers saw 3 successes against 98 “down” and 23 “forbidden” from there. A cache cannot help a first touch, so the Michigan Compiled Laws is stored, one JSON
object per MCL chapter number (the part of a citation before the dot), in the shared statute store (R2, statutes/mi/) that the Illinois,
Indiana, North Carolina, Wisconsin and Wyoming packs also use. The gateway hands the
pack its R2 binding and the pack reads only the object a call names (a very large
chapter is a small head plus parts, and a call reads the head and one part). A section
found there is answered with no upstream request; the response says
served_from: "stored-copy" and carries data_as_of (when that chapter was last read
from the source). A section the copy cannot answer (chapter missing, object unreadable,
or listed with no stored text) falls back to the live read. Absence is never remembered:
a chapter published later is served as soon as it exists.
Nothing is loaded at module scope: the data never enters the gateway bundle.
Refresh
node mcps/michigan-code/scripts/bake-chapters.mjs # all chapters -> mcps/michigan-code/.bake/
node mcps/michigan-code/scripts/bake-chapters.mjs --only X # one chapter
node mcps/michigan-code/scripts/bake-chapters.mjs --resume # keep source pages already fetched
node mcps/michigan-code/scripts/upload-chapters.mjs # publish to R2 (statutes/mi/), changed files only
The source is the Legislature’s published text of the Compiled Laws, one file per chapter, read under its own policy for automated collection (one request per second at most; this refresh makes one request per chapter file, two seconds apart). Repealed sections are stored with their repeal note. Sequential, with a delay between requests, an honest user agent, bounded
retries, and a stop on the first 429/403/451. Exit 0 only if every chapter was fetched
and parsed and the totals clear the floors (default 200 chapters, 15,000 sections with text); anything less exits 1 with the
counts. A chapter whose text is unchanged keeps its previous data_as_of. The baked
files are a working copy, not committed (.bake/ is gitignored); upload-chapters.mjs
writes only the files whose content hash differs from the one recorded in
statutes/mi/_manifest.json, so a refresh that finds nothing new writes nothing. It
uses wrangler r2 object put --remote under the operator login; no API token.
Data source
Michigan Legislature, Michigan Compiled Laws. Michigan statutes are public record.
Freshness of the live fallback
On the live path a section is read once a day at most. When the legislature site cannot be reached, an earlier copy of the same section answers and the response says so (served_from: "stale-cache", stale: true, data_as_of). A section with no earlier copy fails with an error that names a firewall block as one.
Administrative Code (fleet #3957)
mi_admin_rule({citation}) and mi_admin_rule_search({query}) cover the Michigan
Administrative Code — agency rules, not statutes (demand: a question about medication
administration/storage in a licensed child caring institution routed to
mi_compiled_law, which is statutes-only, and returned no_match).
Why a stored copy, not a live proxy (unlike WAC’s shape for Washington): the
official portal for the whole Code — the Administrative Rules System (ARS), run by
the Michigan Office of Administrative Hearings and Rules (MOAHR) — is an Angular
single-page app behind a Cloudflare rule that
answered a GEOFENCED 403 (“Accessing the site from a restricted location”) to every
non-US vector tried on 2026-11-02 (a plain fetch, a wrangler dev --remote probe
Worker, and a real Chrome browser — all three reported Country: JP). It also has
no citation-addressable URL to call per request even from a US origin: a
client-rendered search form, not a REST surface. So this follows the Compiled Laws’
own shape: one JSON object per indexed department rule set in the shared statute
store (R2, admincode/mi/ch-<ruleset-slug>.json — same bucket as statutes/mi/, a
different prefix because a rule-set slug is a different kind of key than an MCL
chapter number).
Source, per rule set. Each department publishes its own rule set as a standalone
PDF booklet on its own department website — the same text MOAHR files with the Secretary of State,
distributed per-department rather than through the ARS search UI. The whole registry
of what this pack indexes is RULE_SETS in scripts/bake-admin-rules.mjs; today
that is one entry:
| Rule set | Publication | Citations |
|---|---|---|
| Licensing Rules for Child Caring Institutions | BCAL-Pub-452, eff. 6/8/15 | R 400.4101 – R 400.4666 (non-contiguous; rescinded numbers are real gaps) |
A citation outside every indexed rule set is reported reason: "not_indexed", naming
what IS covered — never silently empty, and never claimed as “this rule does not
exist” for a rule this pack simply hasn’t been pointed at yet. Adding a rule set is:
find its PDF booklet on the department’s own website, add one entry to RULE_SETS, re-run the bake.
No live-fetch fallback. The shared PDF extractor (extractPdfText) was verified
2026-11-02 to drop word spacing and “fi”/“fl” ligatures on this specific
Adobe-InDesign-produced PDF ("defined" extracted as "defned"), which is not
acceptable for verbatim rule text — using it to answer a cold cache would risk
serving quietly wrong law. A citation with no stored copy available answers
reason: "unavailable" (a temporary condition) rather than a degraded live parse.
mi_admin_rule_search is a literal keyword search over the same stored rule
sets’ headings and body text, ranked by how many distinct query words a rule matches
(a rule is never disqualified for missing one word — an English phrase like
“medication administration” often describes a rule using the regulatory synonym
“dispensing medication”, which plain substring search cannot bridge, so a missing
word drops rank rather than hiding the rule entirely). Like WAC’s own search, this
is literal vocabulary matching, not semantic — “Try fewer or different words; agency
rules use regulatory vocabulary” applies here too.
Refresh (admin rules)
node mcps/michigan-code/scripts/bake-admin-rules.mjs # every rule set -> mcps/michigan-code/.bake-admin/
node mcps/michigan-code/scripts/bake-admin-rules.mjs --only ccis # one rule set
node mcps/michigan-code/scripts/bake-admin-rules.mjs --resume # keep PDFs already downloaded
node mcps/michigan-code/scripts/upload-admin-rules.mjs # publish to R2 (admincode/mi/), changed files only
PDF text extraction is pdftotext -layout (poppler) — a build-time-only dependency
of this bake script (brew install poppler / apt install poppler-utils), not the
Worker, same shape as curl in bake-chapters.mjs. Typos in the SOURCE document
(“R Rule 554.” instead of “Rule 554.” at R 400.4554, “Room 613.” instead of
“Rule 613.” at R 400.4613) are preserved verbatim, not corrected. .bake-admin/ is
gitignored; upload-admin-rules.mjs writes only changed files and uses
wrangler r2 object put --remote under the operator login, no API token.
Data source (admin rules)
Michigan Office of Administrative Hearings and Rules, Michigan Administrative Code. Michigan administrative rules are public record.
Tools
- mi_compiled_law — Get the FULL TEXT of a section of the Michigan Compiled Laws — Michigan state statutes — by citation. “MCL 750.316” is first degree murder. Returns the statutory text only: the catchline and body of t
- mi_admin_rule — Get the FULL TEXT of a rule from the Michigan Administrative Code — agency rules that implement Michigan statutes (licensing, health, safety, and other department regulations), by citation like “R 400
- mi_admin_rule_search — Full-text search over the Michigan Administrative Code rule sets this pack has indexed (see mi_admin_rule). Use for “what Michigan rule covers X” when the exact citation is unknown, e.g. {query: “medi
Tools
mi_admin_rule— Get the FULL TEXT of a rule from the Michigan Administrative Code — agency rules that implement Michigan statutes (licensing, health, safety, and other department regulations), by citation like R 400.mi_admin_rule_search— Full-text search over the Michigan Administrative Code rule sets this pack has indexed (see mi_admin_rule). Use for what Michigan rule covers X when the exact citation is unknown, e.g. {query: medicatmi_compiled_law— Get the FULL TEXT of a section of the Michigan Compiled Laws — Michigan state statutes — by citation. MCL 750.316 is first degree murder. Returns the statutory text only: the catchline and body of the