@pipeworx/mcp-edge-case-museum 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +339 -2
  3. package/bin/cli.js +17 -0
  4. package/package.json +30 -4
  5. package/server.json +18 -0
  6. package/src/bake.mjs +112 -0
  7. package/src/ecm-index-data.ts +15 -0
  8. package/src/exhibits/datetime/add-24-hours-vs-add-1-day-across-dst.json +51 -0
  9. package/src/exhibits/datetime/add-365-days-to-feb-29-not-next-feb-29.json +49 -0
  10. package/src/exhibits/datetime/age-calculator-feb29-birthday-crash-vs-silent.json +52 -0
  11. package/src/exhibits/datetime/century-leap-year-1900-not-leap.json +68 -0
  12. package/src/exhibits/datetime/datetime-utcnow-naive-deprecated.json +39 -0
  13. package/src/exhibits/datetime/dst-fall-back-ambiguous-fold.json +51 -0
  14. package/src/exhibits/datetime/dst-spring-forward-nonexistent-time.json +57 -0
  15. package/src/exhibits/datetime/fractional-utc-offsets-kathmandu-kolkata.json +50 -0
  16. package/src/exhibits/datetime/iso-week-year-vs-calendar-year.json +48 -0
  17. package/src/exhibits/datetime/js-date-field-overflow-rollover.json +49 -0
  18. package/src/exhibits/datetime/leap-second-rejected-vs-silently-invalid.json +57 -0
  19. package/src/exhibits/datetime/lord-howe-30-minute-dst.json +47 -0
  20. package/src/exhibits/datetime/midnight-that-doesnt-exist-sao-paulo.json +53 -0
  21. package/src/exhibits/datetime/python-naive-aware-comparison-typeerror.json +46 -0
  22. package/src/exhibits/datetime/samoa-skipped-day-2011.json +50 -0
  23. package/src/exhibits/datetime/southern-hemisphere-dst-reversed.json +50 -0
  24. package/src/exhibits/datetime/two-digit-year-century-pivot-mismatch.json +49 -0
  25. package/src/exhibits/datetime/year-2038-int32-overflow.json +52 -0
  26. package/src/exhibits/filenames/absolute-second-argument-resets-join.json +62 -0
  27. package/src/exhibits/filenames/bidi-override-extension-spoof.json +58 -0
  28. package/src/exhibits/filenames/case-insensitive-filesystem-pure-path-mismatch.json +74 -0
  29. package/src/exhibits/filenames/dotfile-has-no-extension.json +61 -0
  30. package/src/exhibits/filenames/extension-trap-double-extension.json +62 -0
  31. package/src/exhibits/filenames/filename-length-limits-bytes-not-chars.json +66 -0
  32. package/src/exhibits/filenames/leading-dash-filename-parsed-as-flag.json +67 -0
  33. package/src/exhibits/filenames/nfc-nfd-filename-lookup-mismatch.json +68 -0
  34. package/src/exhibits/filenames/ntfs-alternate-data-stream-colon.json +59 -0
  35. package/src/exhibits/filenames/ntpath-splitdrive-unc-paths.json +58 -0
  36. package/src/exhibits/filenames/nul-byte-in-filename-raises-at-open.json +60 -0
  37. package/src/exhibits/filenames/path-join-escapes-the-base-directory.json +63 -0
  38. package/src/exhibits/filenames/windows-backslash-traversal-ntpath.json +62 -0
  39. package/src/exhibits/filenames/windows-reserved-device-names.json +73 -0
  40. package/src/exhibits/filenames/windows-trailing-dot-space-stripped.json +77 -0
  41. package/src/exhibits/float-money/decimal-from-float-vs-string.json +66 -0
  42. package/src/exhibits/float-money/float-anchor-0-1-plus-0-2.json +67 -0
  43. package/src/exhibits/float-money/intl-number-format-de-de-roundtrip-misparsed.json +62 -0
  44. package/src/exhibits/float-money/iso4217-minor-units-not-always-two.json +78 -0
  45. package/src/exhibits/float-money/math-abs-negative-zero.json +51 -0
  46. package/src/exhibits/float-money/max-safe-integer-plus-two.json +62 -0
  47. package/src/exhibits/float-money/naive-loop-sum-order-dependence.json +71 -0
  48. package/src/exhibits/float-money/nan-breaks-equality-and-max-min.json +70 -0
  49. package/src/exhibits/float-money/negative-zero-balance-formatting.json +74 -0
  50. package/src/exhibits/float-money/number-epsilon-false-positive-small-magnitude.json +52 -0
  51. package/src/exhibits/float-money/parsefloat-comma-thousands-separator.json +66 -0
  52. package/src/exhibits/float-money/python-banker-rounding-vs-js-round-half-up.json +65 -0
  53. package/src/exhibits/float-money/python-round-2-675-float-imprecision.json +64 -0
  54. package/src/exhibits/float-money/splitting-100-dollars-three-ways-leaves-a-cent.json +63 -0
  55. package/src/exhibits/float-money/sum-ten-dimes-not-a-dollar.json +77 -0
  56. package/src/exhibits/float-money/tofixed-1-005-rounds-down-not-up.json +63 -0
  57. package/src/exhibits/float-money/tofixed-2-345-inconsistent-rounding.json +64 -0
  58. package/src/exhibits/integers/array-index-above-2-32-2-not-an-index.json +42 -0
  59. package/src/exhibits/integers/bigint-number-mixing-typeerror.json +49 -0
  60. package/src/exhibits/integers/bitwise-32-bit-truncation.json +56 -0
  61. package/src/exhibits/integers/bool-is-int-subclass-dict-key-collision.json +58 -0
  62. package/src/exhibits/integers/floor-div-mod-sign-python-vs-js.json +48 -0
  63. package/src/exhibits/integers/json-parse-loses-id-precision.json +58 -0
  64. package/src/exhibits/integers/max-safe-integer-plus-one-equals-plus-two.json +58 -0
  65. package/src/exhibits/integers/number-empty-and-whitespace-string-equals-zero.json +55 -0
  66. package/src/exhibits/integers/parseint-null-radix36-digit-soup.json +57 -0
  67. package/src/exhibits/integers/parseint-number-argument-scientific-notation.json +48 -0
  68. package/src/exhibits/integers/parseint-stops-at-first-invalid-char-vs-number.json +58 -0
  69. package/src/exhibits/integers/python-int-accepts-fullwidth-unicode-digits.json +56 -0
  70. package/src/exhibits/integers/python-int-accepts-underscores-and-whitespace.json +48 -0
  71. package/src/exhibits/integers/python-unbounded-int-vs-fixed-width-wrap.json +49 -0
  72. package/src/exhibits/names-addresses/address-with-no-street-number.json +54 -0
  73. package/src/exhibits/names-addresses/ascii-regex-rejects-accented-and-hyphenated-names.json +55 -0
  74. package/src/exhibits/names-addresses/house-number-suffix-collapsed-by-digit-extraction.json +55 -0
  75. package/src/exhibits/names-addresses/mononym-fails-first-last-required.json +56 -0
  76. package/src/exhibits/names-addresses/naive-lowercase-breaks-greek-final-sigma.json +64 -0
  77. package/src/exhibits/names-addresses/null-surname-coerced-to-null-value.json +58 -0
  78. package/src/exhibits/names-addresses/single-letter-surname-fails-min-length.json +55 -0
  79. package/src/exhibits/names-addresses/sort-by-surname-particle-convention-mismatch.json +57 -0
  80. package/src/exhibits/names-addresses/spanish-double-surname-treated-as-single.json +55 -0
  81. package/src/exhibits/names-addresses/split-surname-on-last-space-loses-particle.json +59 -0
  82. package/src/exhibits/names-addresses/title-case-mangles-mixed-case-and-apostrophes.json +60 -0
  83. package/src/exhibits/names-addresses/uk-canada-postal-code-assumed-numeric.json +55 -0
  84. package/src/exhibits/names-addresses/us-zip-code-leading-zero-lost-as-integer.json +58 -0
  85. package/src/exhibits/names-addresses/varchar-truncation-splits-name-mid-grapheme.json +63 -0
  86. package/src/exhibits/parsing/csv-crlf-trailing-blank-line.json +87 -0
  87. package/src/exhibits/parsing/csv-doubled-quote-escaping.json +70 -0
  88. package/src/exhibits/parsing/csv-formula-injection-excel.json +71 -0
  89. package/src/exhibits/parsing/csv-quoted-field-with-comma.json +70 -0
  90. package/src/exhibits/parsing/csv-quoted-field-with-newline.json +70 -0
  91. package/src/exhibits/parsing/csv-semicolon-delimited-european-excel.json +70 -0
  92. package/src/exhibits/parsing/csv-utf8-bom-first-header.json +74 -0
  93. package/src/exhibits/parsing/email-regex-rejects-valid-apostrophe-address.json +68 -0
  94. package/src/exhibits/parsing/json-big-integer-precision-loss.json +65 -0
  95. package/src/exhibits/parsing/json-duplicate-keys-last-wins.json +64 -0
  96. package/src/exhibits/parsing/json-lone-surrogate-roundtrip.json +58 -0
  97. package/src/exhibits/parsing/json-nan-infinity-not-valid-json.json +54 -0
  98. package/src/exhibits/parsing/url-backslash-treated-as-slash-whatwg.json +60 -0
  99. package/src/exhibits/parsing/url-urlparse-never-raises-on-garbage.json +60 -0
  100. package/src/exhibits/parsing/url-userinfo-trusted-looking-host.json +60 -0
  101. package/src/exhibits/sorting/accented-letters-sort-after-z.json +63 -0
  102. package/src/exhibits/sorting/byte-order-caps-before-lowercase.json +66 -0
  103. package/src/exhibits/sorting/case-insensitive-sort-lower-vs-casefold.json +56 -0
  104. package/src/exhibits/sorting/comparator-returns-boolean-js.json +49 -0
  105. package/src/exhibits/sorting/js-array-sort-stringifies-numbers.json +68 -0
  106. package/src/exhibits/sorting/locale-collation-de-vs-sv.json +54 -0
  107. package/src/exhibits/sorting/localecompare-numeric-option.json +50 -0
  108. package/src/exhibits/sorting/nan-in-sort.json +59 -0
  109. package/src/exhibits/sorting/natural-sort-breaks-lexicographic.json +63 -0
  110. package/src/exhibits/sorting/postgres-collation-documented.json +61 -0
  111. package/src/exhibits/sorting/python-cannot-compare-str-int.json +70 -0
  112. package/src/exhibits/sorting/reverse-sort-vs-reverse-after-sort-ties.json +48 -0
  113. package/src/exhibits/sorting/sorting-mixed-none-null.json +56 -0
  114. package/src/exhibits/sorting/typed-array-sort-is-numeric-by-default.json +48 -0
  115. package/src/exhibits/unicode/arabic-indic-digit-parses.json +73 -0
  116. package/src/exhibits/unicode/bidi-override-filename-spoof.json +62 -0
  117. package/src/exhibits/unicode/cyrillic-homoglyph-paypal-spoof.json +67 -0
  118. package/src/exhibits/unicode/fullwidth-bypasses-keyword-filter.json +61 -0
  119. package/src/exhibits/unicode/german-eszett-case-fold.json +72 -0
  120. package/src/exhibits/unicode/grapheme-vs-codepoint-length.json +57 -0
  121. package/src/exhibits/unicode/greek-final-sigma-casefold.json +54 -0
  122. package/src/exhibits/unicode/js-word-regex-ascii-only.json +64 -0
  123. package/src/exhibits/unicode/nfc-nfd-same-name-two-accounts.json +70 -0
  124. package/src/exhibits/unicode/nfkc-compatibility-folding.json +63 -0
  125. package/src/exhibits/unicode/truncation-orphans-combining-mark.json +62 -0
  126. package/src/exhibits/unicode/truncation-splits-surrogate-pair.json +65 -0
  127. package/src/exhibits/unicode/turkish-dotless-i-case-mapping.json +72 -0
  128. package/src/exhibits/unicode/zalgo-combining-mark-stacking.json +57 -0
  129. package/src/exhibits/unicode/zero-width-space-username.json +62 -0
  130. package/src/harness.mjs +331 -0
  131. package/src/index.ts +686 -0
  132. package/src/server.ts +49 -0
  133. package/src/verified.json +977 -0
  134. package/tsconfig.json +18 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mojibake Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,340 @@
1
- # Temporary Holding Version
1
+ # edge-case-museum
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **Your code works. Except for these wonderfully terrible inputs.**
4
+
5
+ Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 1796+ live data sources. This is an independent, unofficial integration — not affiliated with, endorsed by, or published by the upstream provider.
6
+
7
+ By [Mojibake](https://pipeworx.io), creators of Pipeworx.
8
+
9
+ Tell it what you are building ("username uniqueness", "parse a CSV upload",
10
+ "store and add up money amounts", "schedule a reminder in the user's
11
+ timezone") and it hands back the inputs that quietly break that kind of code:
12
+ the assumption each one breaks, the exact bytes, what goes wrong, why, the
13
+ safer pattern, and a repro in Python and JavaScript whose output came from
14
+ actually running it. Then it writes you a test file of those inputs, pointed
15
+ at your own function.
16
+
17
+ ## Three exhibits
18
+
19
+ Every output below was printed by running the code, by the same harness that
20
+ checks the whole collection (Python 3.14.2, Node.js v22.22.2).
21
+
22
+ ### 1. One NaN can leave the rest of your list unsorted
23
+
24
+ `edge_case_get({ id: "nan-in-sort" })`
25
+
26
+ ```python
27
+ nan = float("nan")
28
+ print(sorted([3, nan, 1]))
29
+ ```
30
+
31
+ ```
32
+ [3, nan, 1]
33
+ ```
34
+
35
+ ```js
36
+ console.log([3, NaN, 1].sort((a, b) => a - b));
37
+ ```
38
+
39
+ ```
40
+ [ 3, NaN, 1 ]
41
+ ```
42
+
43
+ Not "NaN ends up somewhere odd". The 3 and the 1 are left out of order. Every
44
+ comparison with NaN is false, so the sort sees NaN as equal to everything.
45
+ That breaks transitivity (3 "equals" NaN, NaN "equals" 1, so 3 "equals" 1),
46
+ and the algorithm concludes the list is already sorted. Python promises
47
+ nothing for inconsistent comparisons. ECMAScript makes the order
48
+ implementation-defined.
49
+
50
+ ### 2. "01/01/68" is 2068 in Python and 1968 in Node.js
51
+
52
+ `edge_case_get({ id: "two-digit-year-century-pivot-mismatch" })`
53
+
54
+ ```python
55
+ for s in ("01/01/49", "01/01/50", "01/01/68", "01/01/69"):
56
+ print(s, "->", datetime.strptime(s, "%m/%d/%y").year)
57
+ ```
58
+
59
+ ```
60
+ 01/01/49 -> 2049
61
+ 01/01/50 -> 2050
62
+ 01/01/68 -> 2068
63
+ 01/01/69 -> 1969
64
+ ```
65
+
66
+ ```js
67
+ for (const s of ['01/01/49', '01/01/50', '01/01/68', '01/01/69'])
68
+ console.log(s, '->', new Date(s).getFullYear());
69
+ ```
70
+
71
+ ```
72
+ 01/01/49 -> 2049
73
+ 01/01/50 -> 1950
74
+ 01/01/68 -> 1968
75
+ 01/01/69 -> 1969
76
+ ```
77
+
78
+ Python follows the POSIX pivot at 69. V8 pivots at 50. The two agree on every
79
+ two-digit year except 50 through 68, where they are a century apart. Test a
80
+ handful of dates and you will probably never hit one.
81
+
82
+ ### 3. `Intl` says the Iraqi dinar has no decimals. ISO 4217 says it has three.
83
+
84
+ `edge_cases_find({ context: "store and add up money amounts", language: "javascript" })`
85
+
86
+ ```js
87
+ for (const c of ["USD", "JPY", "BHD", "KWD", "CLF", "IQD", "HUF"]) {
88
+ const digits = new Intl.NumberFormat("en-US", { style: "currency", currency: c })
89
+ .resolvedOptions().maximumFractionDigits;
90
+ console.log(c, digits);
91
+ }
92
+ ```
93
+
94
+ ```
95
+ USD 2
96
+ JPY 0
97
+ BHD 3
98
+ KWD 3
99
+ CLF 4
100
+ IQD 0
101
+ HUF 0
102
+ ```
103
+
104
+ The first lesson is that `amount * 100` is wrong for JPY (a 100x overcharge)
105
+ and for BHD (a 10x undercharge). The second is quieter: the obvious fix,
106
+ asking `Intl` how many decimals a currency has, returns CLDR display data, not
107
+ ISO 4217. IQD is 3 in ISO 4217 and HUF is 2, and `Intl` reports 0 for both.
108
+ Store the exponent your payment processor uses. Don't derive it from a
109
+ formatter.
110
+
111
+ ### And then it writes the test
112
+
113
+ `edge_cases_test_file({ context: "parse a CSV upload", language: "python" })`
114
+ returns a pytest file of eight cases from seven CSV exhibits. Pointed at the
115
+ parser most of us write first, `list(csv.reader(io.StringIO(text)))`:
116
+
117
+ ```
118
+ PASSED test_edge_case[csv-formula-injection-excel]
119
+ PASSED test_edge_case[csv-crlf-trailing-blank-line0]
120
+ PASSED test_edge_case[csv-crlf-trailing-blank-line1]
121
+ PASSED test_edge_case[csv-quoted-field-with-newline]
122
+ PASSED test_edge_case[csv-doubled-quote-escaping]
123
+ PASSED test_edge_case[csv-quoted-field-with-comma]
124
+ FAILED test_edge_case[csv-utf8-bom-first-header]
125
+ FAILED test_edge_case[csv-semicolon-delimited-european-excel]
126
+ 2 failed, 6 passed
127
+ ```
128
+
129
+ Two real bugs: the first header comes back as `"name"` from a file saved
130
+ as Excel's "CSV UTF-8", and a semicolon-delimited export from a decimal-comma
131
+ locale parses as one column. Each failure names the exhibit that explains it.
132
+
133
+ ## What is in it
134
+
135
+ 122 exhibits, every one with at least one repro that was executed:
136
+
137
+ | Category | Exhibits | For example |
138
+ |---|---|---|
139
+ | Unicode | 15 | NFC vs NFD usernames, Turkish dotted I, ß case folding, Cyrillic homoglyphs, zero-width characters, Zalgo text |
140
+ | Dates and time | 18 | DST gaps and overlaps, Nepal's +05:45, Samoa's missing day, leap seconds, 2038, ISO week years |
141
+ | Floating point and money | 17 | `round(2.675, 2)`, `(1.005).toFixed(2)`, banker's rounding, currency minor units, -0 balances |
142
+ | Sorting and comparison | 14 | collation vs code points, Swedish å after z, `[10, 9, 1].sort()`, boolean comparators |
143
+ | Filenames and paths | 15 | `CON.txt`, trailing dots, `os.path.join` with an absolute part, NTFS streams, 255-byte names |
144
+ | Parsing | 15 | CSV quoting and BOMs, JSON duplicate keys and 64-bit ids, WHATWG backslashes, valid emails rejected |
145
+ | Integers | 14 | `MAX_SAFE_INTEGER + 1 === MAX_SAFE_INTEGER + 2`, `parseInt(null, 36)`, `-7 % 2` |
146
+ | Names and addresses | 14 | particles in surnames, mononyms, `"Null"` as a surname, ZIP codes with leading zeros |
147
+
148
+ ## Tools
149
+
150
+ - `edge_cases_find({ context, language?, limit? })` — what you are
151
+ implementing, in plain words, to the exhibits that matter for it. Each comes
152
+ with the repro for your language and a `refine_tags` list to narrow down.
153
+ - `edge_case_get({ id })` — one exhibit in full: every repro with its captured
154
+ output and runtime version, the why, the fix, related exhibits, sources.
155
+ - `edge_cases_browse({ category?, tag? })` — the collection by category
156
+ (`unicode`, `datetime`, `float-money`, `sorting`, `filenames`, `parsing`,
157
+ `integers`, `names-addresses`) or by tag (`username`, `csv`, `money`,
158
+ `timezone`, ...).
159
+ - `edge_cases_test_file({ context, language })` — one runnable pytest or
160
+ `node:test` file bundling the relevant inputs as cases. It runs as generated
161
+ against a stub; replace the stub (marked TODO) with your function and the
162
+ failures tell you which exhibit to read.
163
+
164
+ ## Install
165
+
166
+ ### Remote (no setup)
167
+
168
+ ```json
169
+ {
170
+ "mcpServers": {
171
+ "edge-case-museum": {
172
+ "url": "https://gateway.pipeworx.io/edge-case-museum/mcp"
173
+ }
174
+ }
175
+ }
176
+ ```
177
+
178
+ This endpoint also carries the shared Pipeworx tools (`ask_pipeworx`,
179
+ `discover_tools`, and friends).
180
+
181
+ ### Local
182
+
183
+ ```json
184
+ {
185
+ "mcpServers": {
186
+ "edge-case-museum": {
187
+ "command": "npx",
188
+ "args": ["-y", "@pipeworx/mcp-edge-case-museum"]
189
+ }
190
+ }
191
+ }
192
+ ```
193
+
194
+ The whole collection ships inside the package. No network calls, no account.
195
+
196
+ ## Auth
197
+
198
+ Keyless.
199
+
200
+ ## Why trust it
201
+
202
+ - **No output is typed from memory.** Every Python and JavaScript repro is
203
+ executed by a committed harness, and its `expected_output` is what the run
204
+ printed. `verified_with` names the runtime (for example `Python 3.14.2`,
205
+ `Node.js v22.22.2`), because some of these behaviours change between
206
+ versions and you should know which one we saw.
207
+ - **The harness can fail, and has.** Change one character of an expected
208
+ output and the run goes red with the diff. A repro whose code or output was
209
+ edited without re-running it cannot be baked into the pack at all: the bake
210
+ checks a hash the harness recorded.
211
+ - **Stacks we did not run are labelled.** Postgres, Windows and macOS filesystem behaviour
212
+ appear as `documented`, with the source that says so, never as verified.
213
+ - **Every exhibit cites its spec or docs.** Unicode annexes, RFC sections, the
214
+ ECMAScript spec, IEEE 754 references, ISO 4217, IANA tz, the language docs.
215
+ Written in our own words.
216
+
217
+ ## Data sources
218
+
219
+ - Exhibits written for this collection by Mojibake, each citing the standard
220
+ or documentation it rests on.
221
+ - Some inputs come from the [Big List of Naughty Strings](https://github.com/minimaxir/big-list-of-naughty-strings)
222
+ by Max Woolf (MIT licence); exhibits that use one say so in their sources.
223
+ - No real person's name, address or contact detail appears anywhere. The
224
+ names-and-addresses exhibits use invented examples and state facts about
225
+ naming and addressing systems.
226
+
227
+ ## Contribute an exhibit
228
+
229
+ Add one file, `src/exhibits/CATEGORY/ID.json` (copy any existing exhibit
230
+ for the shape), with your repros' `code` but no `expected_output`. Run
231
+ `node src/harness.mjs --only ID --capture`: it executes
232
+ each repro, writes the real output into your file, and records it. Read what
233
+ it captured; if the output does not say what your explanation says, the
234
+ explanation is wrong. Then `node src/bake.mjs` and open a pull
235
+ request. An exhibit whose repro has not been run by the harness
236
+ will not bake.
237
+
238
+ ## Quick Start
239
+
240
+ Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
241
+
242
+ ```json
243
+ {
244
+ "mcpServers": {
245
+ "edge-case-museum": {
246
+ "url": "https://gateway.pipeworx.io/edge-case-museum/mcp"
247
+ }
248
+ }
249
+ }
250
+ ```
251
+
252
+ ### What this endpoint actually serves
253
+
254
+ `tools/list` at `https://gateway.pipeworx.io/edge-case-museum/mcp` returns the tools in the table
255
+ above **plus the shared Pipeworx meta-tools** — `ask_pipeworx`,
256
+ `discover_tools`, `search_within`, `remember`/`recall` and the rest of the
257
+ gateway-wide set. So the tool count you see is larger than this table: a
258
+ single-pack endpoint currently lists roughly 30 shared tools alongside the
259
+ pack's own. The connection's `initialize` response states its exact scope, and
260
+ is the authoritative answer for a given day.
261
+
262
+ This is deliberate, not multiplexing by accident. The meta-tools are what let a
263
+ scoped connection answer a question this pack does not cover — via
264
+ `ask_pipeworx`, which routes across the whole catalog — without you adding a
265
+ second MCP server. There is currently no way to mount a pack endpoint without
266
+ them; if the extra schemas cost you more context than the routing is worth,
267
+ connect to the full gateway once rather than to several pack endpoints.
268
+
269
+ Or connect to the full Pipeworx gateway to get every pack's tools listed
270
+ directly, instead of just this one's:
271
+
272
+ ```json
273
+ {
274
+ "mcpServers": {
275
+ "pipeworx": {
276
+ "url": "https://gateway.pipeworx.io/mcp"
277
+ }
278
+ }
279
+ }
280
+ ```
281
+
282
+ Both URLs reach the same gateway and the same 1796+ data sources. The
283
+ only difference is which pack's tools are listed **directly**; `ask_pipeworx`
284
+ reaches all of them from either one.
285
+
286
+ ## No MCP client? Call it over HTTP
287
+
288
+ ```bash
289
+ curl -X POST https://gateway.pipeworx.io/v1/tools/edge_cases_find \
290
+ -H 'Content-Type: application/json' \
291
+ -d '{"context":"username uniqueness","language":"python"}'
292
+ ```
293
+
294
+ No account needed for the first calls. Inspect any tool: `GET https://gateway.pipeworx.io/v1/tools/edge_cases_find`. Find one: `POST https://gateway.pipeworx.io/v1/tools/search_packs` with `{"query":"..."}`.
295
+
296
+ ## Standalone (no gateway account)
297
+
298
+ This package also runs as a local stdio MCP server — no Pipeworx account, no
299
+ gateway round-trip:
300
+
301
+ ```json
302
+ {
303
+ "mcpServers": {
304
+ "edge-case-museum": {
305
+ "command": "npx",
306
+ "args": ["-y", "@pipeworx/mcp-edge-case-museum"]
307
+ }
308
+ }
309
+ }
310
+ ```
311
+
312
+ Or run it directly to confirm it starts:
313
+
314
+ ```bash
315
+ npx -y @pipeworx/mcp-edge-case-museum
316
+ ```
317
+
318
+ It speaks MCP over stdin/stdout and answers `initialize`/`tools/list`/`tools/call`
319
+ for **only** this pack's tools — none of the shared meta-tools the gateway
320
+ connection above adds. Same source, same tools, no ask_pipeworx routing.
321
+
322
+ ## Using with ask_pipeworx
323
+
324
+ Instead of calling tools directly, you can ask questions in plain English —
325
+ this works on the pack endpoint above as well as on the full gateway:
326
+
327
+ ```
328
+ ask_pipeworx({ question: "your question about Edge Case Museum data" })
329
+ ```
330
+
331
+ The gateway picks the right tool and fills the arguments automatically.
332
+
333
+ ## More
334
+
335
+ - [Docs and guides](https://pipeworx.io/docs)
336
+ - [pipeworx.io](https://pipeworx.io)
337
+
338
+ ## License
339
+
340
+ MIT
package/bin/cli.js ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ //
3
+ // Entry point for `npx @pipeworx/mcp-<slug>`.
4
+ //
5
+ // Packs ship as raw TypeScript (no build step — see publish-pack.sh for why:
6
+ // tsx sidesteps every extensionless-import / bare-JSON-import edge case a
7
+ // per-pack tsc build would have to solve one pack at a time). This file
8
+ // registers tsx's ESM loader programmatically, then hands off to src/server.ts,
9
+ // which wraps the pack's {tools, callTool} export in a stdio MCP server.
10
+ //
11
+ // Copied verbatim into every published pack repo by scripts/publish-pack.sh —
12
+ // edit this file, not a per-pack copy.
13
+ import { register } from 'tsx/esm/api';
14
+
15
+ register();
16
+
17
+ await import('../src/server.ts');
package/package.json CHANGED
@@ -1,6 +1,32 @@
1
1
  {
2
2
  "name": "@pipeworx/mcp-edge-case-museum",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Edge Case Museum MCP — 'Your code works. Except for these wonderfully terrible inputs.'",
5
+ "type": "module",
6
+ "main": "src/index.ts",
7
+ "types": "src/index.ts",
8
+ "bin": {
9
+ "mcp-edge-case-museum": "bin/cli.js"
10
+ },
11
+ "keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "edge-case-museum"],
12
+ "license": "MIT",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/pipeworx-io/mcp-edge-case-museum.git"
16
+ },
17
+ "scripts": {
18
+ "typecheck": "tsc --noEmit"
19
+ },
20
+ "dependencies": {
21
+ "@modelcontextprotocol/sdk": "^1.30.0",
22
+ "tsx": "^4.19.0"
23
+ },
24
+ "devDependencies": {
25
+ "typescript": "^5.9.3",
26
+ "@cloudflare/workers-types": "^4.20260405.1"
27
+ },
28
+ "pipeworx": {
29
+ "sourceHash": "v1-3081b54dc5f3854258063da594df22057720b4c6b7031476727e233a9e85981d",
30
+ "sourceCommit": "1095bbbaeb7ef746539b45866b28b1fd6b1f8549"
31
+ }
32
+ }
package/server.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.pipeworx-io/edge-case-museum",
4
+ "title": "Edge Case Museum",
5
+ "description": "Edge Case Museum MCP — 'Your code works. Except for these wonderfully terrible inputs.'",
6
+ "version": "0.1.0",
7
+ "websiteUrl": "https://pipeworx.io/packs/edge-case-museum",
8
+ "repository": {
9
+ "url": "https://github.com/pipeworx-io/mcp-edge-case-museum",
10
+ "source": "github"
11
+ },
12
+ "remotes": [
13
+ {
14
+ "type": "streamable-http",
15
+ "url": "https://gateway.pipeworx.io/edge-case-museum/mcp"
16
+ }
17
+ ]
18
+ }
package/src/bake.mjs ADDED
@@ -0,0 +1,112 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Bake the Edge Case Museum index (fleet #3034).
4
+ *
5
+ * Reads every exhibit in src/exhibits/<category>/<id>.json
6
+ * and writes src/ecm-index-data.ts, which is registered in
7
+ * workers/gateway/src/pack-baked-indexes.json: it ships to KV and the gateway
8
+ * injects it as args._bakedIndex, so the pack never value-imports it.
9
+ *
10
+ * The bake is the second half of the "no unexecuted claim" rule. The harness
11
+ * (src/harness.mjs) runs every python / javascript repro
12
+ * and records sha256(code, expected_output) in src/verified.json. This script
13
+ * REFUSES to write the module if any executable repro is missing from that file
14
+ * or its hash differs, i.e. if anyone edited a repro or its output without
15
+ * re-running it. Documented (non-executed) repros are shipped labelled as such.
16
+ *
17
+ * Usage: node src/bake.mjs [--check]
18
+ * --check validate and compare with the committed module; exit 1 if stale.
19
+ */
20
+ import { readFileSync, writeFileSync, existsSync } from 'node:fs';
21
+ import path from 'node:path';
22
+ import { fileURLToPath } from 'node:url';
23
+ import { loadExhibits, validateExhibit, reproHash, normalizeOutput, RUNNABLE } from './harness.mjs';
24
+
25
+ const PACK = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
26
+ const ROOT = PACK;
27
+ const DIR = path.join(PACK, 'src/exhibits');
28
+ const OUT = path.join(PACK, 'src/ecm-index-data.ts');
29
+ const CHECK = process.argv.includes('--check');
30
+
31
+ const loaded = loadExhibits(DIR);
32
+ const errors = [];
33
+ for (const e of loaded) errors.push(...validateExhibit(e));
34
+ const verified = existsSync(path.join(PACK, 'src/verified.json')) ? JSON.parse(readFileSync(path.join(PACK, 'src/verified.json'), 'utf8')).repros ?? {} : {};
35
+ const exhibits = [];
36
+ const ids = new Set();
37
+ for (const { ex, file } of loaded) {
38
+ if (!ex) continue;
39
+ if (ids.has(ex.id)) errors.push(`duplicate id ${ex.id}`);
40
+ ids.add(ex.id);
41
+ for (const r of ex.repros ?? []) {
42
+ if (r.status === 'documented' || !RUNNABLE[r.language]) continue;
43
+ const key = `${ex.id}:${r.language}`;
44
+ const row = verified[key];
45
+ if (typeof r.expected_output !== 'string') errors.push(`${path.relative(ROOT, file)}: ${r.language} repro has no expected_output; run the harness with --capture`);
46
+ else if (!row) errors.push(`${key}: not in src/verified.json; run node src/harness.mjs`);
47
+ else if (row.sha256 !== reproHash(r.code, normalizeOutput(r.expected_output))) errors.push(`${key}: code or expected_output changed since the harness last ran it; re-run the harness`);
48
+ }
49
+ exhibits.push(ex);
50
+ }
51
+ for (const ex of exhibits) for (const rel of ex.related ?? []) if (!ids.has(rel)) errors.push(`${ex.id}: related id "${rel}" does not exist`);
52
+ if (exhibits.length < 1) errors.push('no exhibits found');
53
+ if (errors.length) {
54
+ console.error(`edge-case-museum bake REFUSED (${errors.length} problem(s)):\n ${errors.slice(0, 60).join('\n ')}`);
55
+ process.exit(1);
56
+ }
57
+
58
+ exhibits.sort((a, b) => a.category.localeCompare(b.category) || a.id.localeCompare(b.id));
59
+ const shipped = exhibits.map((ex) => ({
60
+ id: ex.id,
61
+ title: ex.title,
62
+ category: ex.category,
63
+ assumption: ex.assumption,
64
+ input: { display: ex.input.display, description: ex.input.description ?? '' },
65
+ what_goes_wrong: ex.what_goes_wrong,
66
+ why: ex.why,
67
+ affects: ex.affects,
68
+ repros: ex.repros.map((r) =>
69
+ r.status === 'documented'
70
+ ? { language: r.language, status: 'documented', note: r.note, source: r.source }
71
+ : { language: r.language, status: 'verified', code: r.code, expected_output: normalizeOutput(r.expected_output), verified_with: verified[`${ex.id}:${r.language}`].verified_with },
72
+ ),
73
+ fix: ex.fix,
74
+ related: ex.related ?? [],
75
+ sources: ex.sources,
76
+ tags: ex.tags,
77
+ test_cases: ex.test_cases ?? [],
78
+ }));
79
+ const byCat = {};
80
+ for (const ex of shipped) byCat[ex.category] = (byCat[ex.category] ?? 0) + 1;
81
+ const runtimes = JSON.parse(readFileSync(path.join(PACK, 'src/verified.json'), 'utf8')).runtimes ?? {};
82
+ // data_as_of is the content's date, not the bake's: the newest exhibit file's last commit would be ideal,
83
+ // but a deterministic module matters more for --check, so it is passed in or taken from verified.json's runtimes stamp.
84
+ const DATA_AS_OF = process.env.ECM_DATA_AS_OF ?? (existsSync(OUT) ? (readFileSync(OUT, 'utf8').match(/DATA_AS_OF = "([^"]+)"/)?.[1] ?? new Date().toISOString().slice(0, 10)) : new Date().toISOString().slice(0, 10));
85
+
86
+ const body = `// GENERATED by src/bake.mjs from src/exhibits/ — do not hand-edit; re-run the script.
87
+ // ${shipped.length} exhibits (${Object.entries(byCat).map(([k, v]) => `${k} ${v}`).join(', ')}) · repros verified with ${Object.values(runtimes).join(' and ')}
88
+ // Registered in workers/gateway/src/pack-baked-indexes.json; the pack reads it as args._bakedIndex and never value-imports this module.
89
+
90
+ export interface Repro { language: string; status: 'verified' | 'documented'; code?: string; expected_output?: string; verified_with?: string; note?: string; source?: string }
91
+ export interface TestCase { inputs: unknown[]; relation: 'equal' | 'not_equal' | 'returns' | 'no_crash' | 'raises'; expected?: unknown; note?: string }
92
+ export interface Exhibit {
93
+ id: string; title: string; category: string; assumption: string; input: { display: string; description: string };
94
+ what_goes_wrong: string; why: string; affects: string[]; repros: Repro[]; fix: string; related: string[];
95
+ sources: { title: string; url: string }[]; tags: string[]; test_cases: TestCase[];
96
+ }
97
+
98
+ export const DATA_AS_OF = ${JSON.stringify(DATA_AS_OF)};
99
+ export const RUNTIMES: Record<string, string> = ${JSON.stringify(runtimes)};
100
+ export const EXHIBITS: Exhibit[] = ${JSON.stringify(shipped)};
101
+ `;
102
+ if (CHECK) {
103
+ const cur = existsSync(OUT) ? readFileSync(OUT, 'utf8') : '';
104
+ if (cur !== body) {
105
+ console.error('edge-case-museum: src/ecm-index-data.ts is stale; run node src/bake.mjs');
106
+ process.exit(1);
107
+ }
108
+ console.log(`edge-case-museum index up to date: ${shipped.length} exhibits`);
109
+ } else {
110
+ writeFileSync(OUT, body);
111
+ console.log(`wrote ${path.relative(ROOT, OUT)}: ${shipped.length} exhibits (${Object.entries(byCat).map(([k, v]) => `${k} ${v}`).join(', ')}), ${(body.length / 1024).toFixed(0)} KB`);
112
+ }