{"id":"1d6b5cba-f987-46e0-878e-2e1d2a609a90","slug":"mcp-south-dakota-code","kind":"mcp","name":"mcp-south-dakota-code","summary":"South Dakota Codified Laws — state statutes by citation and by topic.","owner":"pipeworx-io","repoUrl":"https://github.com/pipeworx-io/mcp-south-dakota-code","license":"MIT","licenseTier":"permissive","trust":"community","stars":0,"match":null,"fewStars":true,"format":"mcp","createdAt":"2026-10-08T05:13:47.000Z","addedAt":"2026-10-14T05:55:13.459Z","logoUrl":"https://avatars.githubusercontent.com/u/270792911?v=4","linkOnly":false,"collection":null,"skillPath":null,"categories":["developer-tools","cloud-infra","memory-knowledge"],"tags":["pipeworx","south-dakota-code"],"runtime":"remote","local":false,"cloudCapable":false,"cloudCapability":"unknown","cloudReadyOnPlatform":false,"needsApiKey":false,"reviewed":false,"syncedAt":"2026-10-26T06:25:15.924Z","sample":false,"url":"https://conduits.dev/tools/mcp-south-dakota-code","language":"TypeScript","transports":["http"],"install":{"remoteUrl":"https://gateway.pipeworx.io/south-dakota-code/mcp"},"requirements":{"env":[],"upstreamMayCharge":false},"tools":null,"readme":"# @pipeworx/south-dakota-code\n\nSouth Dakota Codified Laws (South Dakota state statutes) — full section text by\ncitation, and topic/keyword search over official catchlines.\n\nPart of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 1784+ live data sources. This is an independent, unofficial integration — not affiliated with, endorsed by, or published by the upstream provider.\n\n## Tools\n\n- `sd_statute(citation)` — full current text of one SDCL section (e.g.\n  `\"22-16-4\"`, murder in the first degree), with the official catchline,\n  chapter/title context, and — when the section carries one — the \"Source:\"\n  line listing every session law that enacted or amended it, split out into\n  `history`.\n- `sd_search(query, limit?)` — topic/keyword search over the Legislature's\n  own official section and chapter catchlines across all 71 titles (e.g.\n  `\"landlord\"`, `\"concealed pistol permit\"`). Not full-text search — South\n  Dakota does not publish one.\n\n## Auth\n\nKeyless.\n\n## Data sources\n\n- `https://sdlegislature.gov/api/Statutes/Statute/{citation}` — one section's\n  (or chapter's, or title's) current text, as JSON with an `Html` field.\n  `sd_statute` calls this live, per request, for a section-shaped citation.\n- `https://sdlegislature.gov/api/Statutes/Title` — the list of all 71 titles.\n  Used only by `scripts/bake-index.mjs` to drive the per-title fetch below.\n\n## Capabilities — three available, one is not\n\nSouth Dakota's own publication covers:\n\n- **Citation lookup** — `sd_statute`.\n- **Topic/keyword search** — `sd_search`, over catchlines only (see below).\n- **Amendments/enactment history** — PARTIALLY AVAILABLE. An in-force\n  section's text ends with a \"Source: SDC 1939, § 13.2007 (1); SL 1979, ch\n  160, § 2; ...\" line listing every session law that created or amended it\n  (verified live on `22-16-4`). `sd_statute` splits this into `history`\n  rather than leaving it only embedded in `text`. A repealed/transferred\n  section's one-line disposition (e.g. \"22-16-9. Repealed by SL 2005, ch 120,\n  § 158, eff. July 1, 2006.\") comes back as `disposition_text`, with\n  `repealed: true` read from the API's own flag.\n- **Historical version** (the text as it read before an amendment) — NOT\n  AVAILABLE. sdlegislature.gov publishes only the CURRENT online edition: no\n  per-year archive, no \"view as of\" date picker, and no endpoint returning a\n  prior version's text (checked the site's own JS bundle for one — none\n  exists). The Source: line says WHEN and by WHICH session law a section was\n  amended; it does not return what the text read before that.\n\n## Source and shape — read this before touching the parser\n\nsdlegislature.gov is a Vue single-page app. The August state-law survey\n(`docs/state-law-probe.md`) correctly flagged the HTML shell as carrying no\nstatute — it just stopped one layer too early. The SPA itself is fed by a\n**keyless, public JSON API** under `/api/Statutes/` (found by grepping the\nsite's own JS bundle for `/api/Statutes` — no documentation page exists for\nit): `GET /api/Statutes/Statute/{citation}` accepts a section citation\n(`\"22-16-4\"`), a chapter citation (`\"22-16\"`) or a title number (`\"22\"`), and\nreturns one JSON envelope whose `Html` field is that level's content —\nfull section text for a section, or a plain table-of-contents listing\n(chapter header + every section's citation and catchline, with NO body text)\nfor a chapter or title. No auth, no key, no rate limit observed.\n\n`sd_statute` only ever calls the section-shaped form, live, per request —\nnever baked.\n\n`sd_search` needs a structural index (every citation + its official\ncatchline) to search over, and there is no search endpoint and no single\n\"whole code\" listing page the way North Dakota publishes one. The only way to\nassemble one is to call the TITLE-level form for each of the 71 titles and\nparse its table-of-contents `Html` blob. `scripts/bake-index.mjs` does this\nonce, offline, into `src/sd-index-data.ts` — never at request time.\n\n**Why the parser works off flattened TEXT, not HTML anchors.** Each title's\nHtml blob is a concatenation of chapters that were authored and HTML-exported\nindependently over decades, so anchor markup is NOT uniform: some chapters\nlink a citation as a modern anchor (`sdlegislature.gov/Statutes?Statute=X`),\nothers use a legacy `DisplayStatute.aspx?Type=Statute&Statute=X` anchor form,\nand repealed-section entries repeat their own citation as a text label\nimmediately before the real catchline. Rather than chase every anchor shape,\nthe bake script strips ALL tags (dropping style/script element CONTENTS too —\nthe first cut of this script leaked raw CSS text into a catchline because\nthat content sits between tags, not inside one) and then scans the flattened\ntext for citation-SHAPED TOKENS beginning with the known title number. This\nis markup-agnostic: it only depends on the citation strings the site already\nprints as plain text, uniform across every era of document. See the script's\nown header comment for the full detail, including how duplicate-token\nartifacts and the rare genuinely-duplicated citation (observed on <5% of\nsections) are handled — never silently, always resolved toward the longer\ncatchline, since this index drives search RANKING only and `sd_statute`\nalways re-fetches the real text live.\n\n**Refresh path:** `node scripts/bake-index.mjs > src/sd-index-data.ts`\nwhenever South Dakota recodifies (new session laws are folded in after each\nlegislative session). Nothing else in the pack needs to change.\n\n## Known gaps\n\n- `sd_search` matches official catchlines (section and chapter names), not\n  full statutory prose — South Dakota does not publish full-text search, and\n  this pack does not claim to either. It says so in both the tool\n  description and every \"no match\" response.\n- A citation present in the baked index that the LIVE API 404s on (e.g. a\n  section renumbered or repealed since the index was last baked) returns a\n  loud `reason: \"index_live_mismatch\"`, never a plain `found: false` with no\n  explanation.\n\n## Quick Start\n\nAdd to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):\n\n```json\n{\n  \"mcpServers\": {\n    \"south-dakota-code\": {\n      \"url\": \"https://gateway.pipeworx.io/south-dakota-code/mcp\"\n    }\n  }\n}\n```\n\n### What this endpoint actually serves\n\n`tools/list` at `https://gateway.pipeworx.io/south-dakota-code/mcp` returns the tools in the table\nabove **plus the shared Pipeworx meta-tools** — `ask_pipeworx`,\n`discover_tools`, `search_within`, `remember`/`recall` and the rest of the\ngateway-wide set. So the tool count you see is larger than this table: a\nsingle-pack endpoint currently lists roughly 30 shared tools alongside the\npack's own. The connection's `initialize` response states its exact scope, and\nis the authoritative answer for a given day.\n\nThis is deliberate, not multiplexing by accident. The meta-tools are what let a\nscoped connection answer a question this pack does not cover — via\n`ask_pipeworx`, which routes across the whole catalog — without you adding a\nsecond MCP server. There is currently no way to mount a pack endpoint without\nthem; if the extra schemas cost you more context than the routing is worth,\nconnect to the full gateway once rather than to several pack endpoints.\n\nOr connect to the full Pipeworx gateway to get every pack's tools listed\ndirectly, instead of just this one's:\n\n```json\n{\n  \"mcpServers\": {\n    \"pipeworx\": {\n      \"url\": \"https://gateway.pipeworx.io/mcp\"\n    }\n  }\n}\n```\n\nBoth URLs reach the same gateway and the same 1784+ data sources. The\nonly difference is which pack's tools are listed **directly**; `ask_pipeworx`\nreaches all of them from either one.\n\n## No MCP client? Call it over HTTP\n\n```bash\ncurl -X POST https://gateway.pipeworx.io/v1/tools/sd_statute \\\n  -H 'Content-Type: application/json' \\\n  -d '{\"citation\":\"22-16-4\"}'\n```\n\nNo account needed for the first calls. Inspect any tool: `GET https://gateway.pipeworx.io/v1/tools/sd_statute`. Find one: `POST https://gateway.pipeworx.io/v1/tools/search_packs` with `{\"query\":\"...\"}`.\n\n## Standalone (no gateway account)\n\nThis package also runs as a local stdio MCP server — no Pipeworx account, no\ngateway round-trip:\n\n```json\n{\n  \"mcpServers\": {\n    \"south-dakota-code\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@pipeworx/mcp-south-dakota-code\"]\n    }\n  }\n}\n```\n\nOr run it directly to confirm it starts:\n\n```bash\nnpx -y @pipeworx/mcp-south-dakota-code\n```\n\nIt speaks MCP over stdin/stdout and answers `initialize`/`tools/list`/`tools/call`\nfor **only** this pack's tools — none of the shared meta-tools the gateway\nconnection above adds. Same source, same tools, no ask_pipeworx routing.\n\n## Using with ask_pipeworx\n\nInstead of calling tools directly, you can ask questions in plain English —\nthis works on the pack endpoint above as well as on the full gateway:\n\n```\nask_pipeworx({ question: \"your question about South Dakota Code data\" })\n```\n\nThe gateway picks the right tool and fills the arguments automatically.\n\n## More\n\n- [Docs and guides](https://pipeworx.io/docs)\n- [pipeworx.io](https://pipeworx.io)\n\n## License\n\nMIT\n"}