@first-ch/tools-mcp 0.27.0 → 0.29.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.
- package/README.md +5 -1
- package/cidr.mjs +826 -0
- package/package.json +21 -3
- package/server.mjs +91 -0
- package/zenkaku.mjs +462 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @first-ch/tools-mcp
|
|
2
2
|
|
|
3
|
-
MCP server exposing [First CH Tools](https://tools.first-ch.com)' free web-tool logic — WCAG contrast, JP character/X-weight counting, WebP conversion, JSON-LD generation, llms.txt generation, encoding/line-ending conversion, Marp Markdown→slide rendering, Japanese/English test-data generation, text/code diffing, cron-expression explanation, Base64/data-URI encoding, URL query-parameter editing, HTML entity escaping/unescaping, JSON⇄YAML conversion, px ⇄ rem/em unit conversion, colour-code conversion with alpha compositing, MD5/SHA-1/SHA-256/SHA-384/SHA-512 hashing, JWT decoding with expiry and signature checks, User-Agent parsing with device/bot detection, bulk UUID v4 / ULID generation, aspect-ratio calculation with responsive sizing, case conversion between camelCase, snake_case and kebab-case,
|
|
3
|
+
MCP server exposing [First CH Tools](https://tools.first-ch.com)' free web-tool logic — WCAG contrast, JP character/X-weight counting, WebP conversion, JSON-LD generation, llms.txt generation, encoding/line-ending conversion, Marp Markdown→slide rendering, Japanese/English test-data generation, text/code diffing, cron-expression explanation, Base64/data-URI encoding, URL query-parameter editing, HTML entity escaping/unescaping, JSON⇄YAML conversion, px ⇄ rem/em unit conversion, colour-code conversion with alpha compositing, MD5/SHA-1/SHA-256/SHA-384/SHA-512 hashing, JWT decoding with expiry and signature checks, User-Agent parsing with device/bot detection, bulk UUID v4 / ULID generation, aspect-ratio calculation with responsive sizing, case conversion between camelCase, snake_case and kebab-case, CSV/TSV ⇄ JSON conversion, and IP/CIDR calculation with subnet splitting and IP-range reduction — to AI agents such as Claude Code.
|
|
4
4
|
|
|
5
5
|
日本語版は [後半セクション](#日本語) を参照してください。
|
|
6
6
|
|
|
@@ -73,6 +73,8 @@ This server is also registered in the [MCP Registry](https://registry.modelconte
|
|
|
73
73
|
| `robotstxt_generate` | Assembles a robots.txt from crawl rules, sitemap declarations and a preset for AI crawlers — the same logic as the browser tool at tools.first-ch.com/robots-txt/. `ai.preset` decides how 24 known AI crawlers are treated in one move: `training` (the default: refuse the ones that collect training data — GPTBot, ClaudeBot, Google-Extended, Bytespider, CCBot and the rest — while allowing AI search and on-demand fetchers such as OAI-SearchBot, Claude-SearchBot, PerplexityBot and ChatGPT-User), `allow`, `block`, `none` (leave AI crawlers out) or `custom` with `ai.overrides` naming them one by one. **A crawler obeys exactly one matching group**, so writing a group for GPTBot stops the `User-agent: *` rules from ever reaching it; by default the shared disallow paths are copied into the AI groups to close that gap (`ai.inherit: false` turns it off). Paths get a leading slash added and full URLs reduced to their path, and `warnings` reports spaces inside a path, non-ASCII paths that need percent-encoding, wildcards that not every crawler supports, a `Crawl-delay` Googlebot will ignore, a missing sitemap, a User-agent listed twice and a site blocked in full. `listCrawlers: true` returns just the crawler list (name, vendor, purpose) without generating anything | `siteUrl?`, `disallow?`, `allow?`, `userAgents?` (default `*`), `crawlDelay?`, `blockCrawlers?`, `sitemaps?`, `ai?` (`preset?`, `overrides?`, `inherit?`), `groups?`, `comments?` (default true), `allowStyle?` (`disallow-empty` default / `allow-slash`), `listCrawlers?`, `lang?` (`ja` default / `en`), `outputPath?` |
|
|
74
74
|
| `case_convert` | Converts identifiers between eleven cases — camelCase, PascalCase, snake_case, CONSTANT_CASE, kebab-case, Train-Case, dot.case, Title Case, Sentence case, lower case and UPPER CASE — the same logic as the browser tool at tools.first-ch.com/case/. Built for the mechanical jobs at the boundary between layers: renaming variables in bulk, moving between `snake_case` database columns and `camelCase` JSON keys, tidying CSV headers. `scope` sets the unit of work: `lines` (the default, one item per line), `items` (every comma or tab separated field of a line, for CSV header rows) or `whole`. **Leading and trailing spaces, indentation, line endings (LF/CRLF) and the separators are preserved**, so only the names change. A run of capitals is broken only before a capital followed by a lower-case letter (`XMLHttpRequest` → `XML` / `Http` / `Request`), and digits stay attached to the word before them (`sha256Hash` → `sha256` / `Hash`; `splitDigits` splits them). Acronyms fold to `parseXmlData` by default and stay capitalised with `keepAcronyms`, except the first word of a camelCase name, which is always lower-cased (`URLParser` → `urlParser`). Characters with no letter case (Japanese, for example) pass through rather than being transliterated. `notes` reports **names that collide after conversion** (`first name` and `first_name` both become `first_name`, which is how a column silently disappears on import), results starting with a digit that cannot be identifiers, and items containing acronyms; `items[].detected` names the case each input was written in. `allFormats` expands every item into all eleven cases, `listFormats` returns just the list of cases with what each is used for | `text?` or `path?`, `outputPath?`, `format?` (`camel` default), `scope?` (`lines` default / `items` / `whole`), `splitDigits?`, `keepAcronyms?`, `allFormats?`, `listFormats?`, `lang?` (`ja` default / `en`) |
|
|
75
75
|
| `csv_convert` | Converts CSV/TSV into a JSON array and back — the same logic as the browser tool at tools.first-ch.com/csv-json/. For moving data you already have between a spreadsheet and an API: turning an exported table into JSON a request body can carry, or an API response into something Excel opens. With `direction` omitted it guesses `json2csv` when the input starts with `[` or `{` and `csv2json` otherwise. The delimiter is detected by looking at the first 20 lines for the character that appears the same number of times on every line, and can be pinned with `delimiter`. **Column names such as `stock.qty` are read and written as nested objects, and `tags.0` / `tags.1` (`tags[0]` means the same) become an array** — the reverse direction flattens by the same rule, so a round trip through CSV restores the original structure (`nest: false` writes nested values into a single cell as JSON text). **Type inference is decided by round trip — a value becomes a number only when converting it back to text is character-for-character identical** — so `0123`, `+1`, `1.50` and integers beyond 2^53 (`12345678901234567890`) stay strings and postcodes, phone numbers, invoice numbers and version strings survive. Reading follows RFC 4180: quoted cells, `""` escapes, line breaks inside cells, CRLF and a BOM are all handled, and the output side offers `bom` and `newline` for Excel. On the JSON side it accepts an array, a single object, an object wrapping an array such as `{"data":[…]}`, and JSON Lines. **A JSON syntax error comes back as an `ok: false` result with a line, a column and an excerpt rather than an exception**, so the reply itself says where to fix it. `notes` also reports rows whose column count does not match the header, duplicate header names (kept as `name_2`), empty headers (named `column4`), values that would lose digits, cells starting with `=`, `+`, `-` or `@` that a spreadsheet may execute as a formula (CSV injection), and objects with a different set of keys | `text?` or `path?`, `outputPath?`, `direction?` (`auto` default / `csv2json` / `json2csv`), `delimiter?` (`auto` default / `comma` / `tab` / `semicolon` / `pipe`), `header?`, `nest?`, `types?`, `trim?`, `emptyNull?`, `indent?` (`2` default / 0–8 / `tab`), `newline?` (`lf` default / `crlf`), `quoteAll?`, `bom?`, `lang?` (`ja` default / `en`) |
|
|
76
|
+
| `zenkaku_convert` | Converts letters and digits, katakana, symbols and spaces between their full-width and half-width forms **with a direction chosen per kind**, and cleans up the whitespace in the same pass — the same logic as the browser tool at tools.first-ch.com/zenkaku/. For normalising Japanese copy supplied by a client, cleaning a file before an import, and tidying form input. Each of `alnum` / `kana` / `symbol` / `space` takes `keep`, `han` (half-width) or `zen` (full-width); the defaults are the form most Japanese copy is set in — letters, digits, symbols and spaces half-width, katakana full-width (the same as `preset: 'ja'`). `preset` offers `ja`, `csv` (`ja` plus the whitespace and invisible-character cleanup), `han` and `zen`, and any per-kind option overrides it. **Half-width katakana is not one character per glyph**, so converting to full-width composes a following voiced mark (`ガ` → `ガ`, `パ` → `パ`, `ヴ` → `ヴ`) and converting the other way splits it into two. Japanese punctuation, brackets, the middle dot and the prolonged sound mark (`。 、 「 」 ・ ー`) live inside the half-width katakana block (U+FF61–U+FF9F) and are **treated as katakana** (`kana: 'han'` turns `「テスト」。` into `「テスト」。`; use `keep` to leave the punctuation full-width). Spaces cover U+3000 ⇄ U+0020 and fold NBSP and the Latin space family to the half-width side. The cleanup is `collapseSpaces` (a run of spaces becomes its first character), `trimLines`, `blankLines` (`keep` / `collapse` / `remove`), `removeInvisible` (zero-width, BOM, control codes) and `composeMarks` (NFC, for copy that writes `ガ` as `カ` plus a combining U+3099). **Line endings (LF/CRLF), tabs, hiragana and kanji are never rewritten.** `notes` reports what is left — half-width katakana, ideographic spaces, invisible characters, combining marks — plus the wave dash `〜` (U+301C) versus the fullwidth tilde `~` (U+FF5E) and platform-dependent characters (`① ㈱ Ⅲ`), which are **reported and never rewritten** because which way they should go depends on the destination. **This is deliberately not NFKC**: `①` never becomes `1`, and only the kinds you selected are touched. `inspect: true` converts nothing and returns just the audit | `text?` or `path?`, `outputPath?`, `preset?` (`ja` / `csv` / `han` / `zen`), `alnum?`, `kana?`, `symbol?`, `space?` (each `keep` / `han` / `zen`), `collapseSpaces?`, `trimLines?`, `blankLines?` (`keep` default / `collapse` / `remove`), `removeInvisible?`, `composeMarks?`, `inspect?`, `lang?` (`ja` default / `en`) |
|
|
77
|
+
| `cidr_calc` | Turns CIDR notation, a subnet mask, an ACL wildcard mask or a bare address into the network address, broadcast address, usable host range, address and host counts, reverse DNS zone and a binary breakdown — the same logic as the browser tool at tools.first-ch.com/cidr/. For subnet maths while writing server configs, firewall rules and Basic-auth allow lists. **IPv4 and IPv6 both work**: `::` compression, a trailing IPv4 form (`::ffff:192.168.0.1`), `[...]` brackets and a `%zone` suffix are parsed, and output follows RFC 5952. `192.168.1.5 255.255.255.0` and `192.168.1.5/0.0.0.255` (the ACL convention) are accepted in the same field. **The exceptions in host counting are built in**: a `/31` has two usable addresses for point-to-point links (RFC 3021), a `/32` is one host, and IPv6 has no broadcast address. When host bits are set in the address you pass, `notes` returns the block it actually belongs to — the form that belongs in a config file. **Octets with a leading zero (`192.168.001.1`) are refused**, because some libraries read them as octal and the same text then means a different address. The address type is matched against the main IANA special-purpose blocks (private, CGNAT, loopback, link-local, documentation, multicast, ULA and more) and a network that extends beyond its reserved range is flagged. `split` lists the equal subnets of a new prefix length, `contains` tests addresses for membership, and `range` reduces ranges such as `10.0.0.5 - 10.0.0.200` (mixed with CIDR blocks and single addresses, one per line or `;`-separated) to **the fewest blocks that cover them exactly**, merging overlaps and adjacencies first. All arithmetic is BigInt | `cidr?` and/or `range?`, `split?` (prefix length), `contains?` (string[]), `limit?` (1-4096, default 256), `lang?` (`ja` default / `en`) |
|
|
76
78
|
|
|
77
79
|
See [`server.mjs`](./server.mjs) for the exact Zod input schemas.
|
|
78
80
|
|
|
@@ -188,6 +190,8 @@ claude mcp add firstch-tools -- npx -y @first-ch/tools-mcp
|
|
|
188
190
|
| `robotstxt_generate` | クロールの許可/禁止ルール・サイトマップ宣言・AIクローラーの許可プリセットから robots.txt を組み立てる。tools.first-ch.com/robots-txt/ と同一の仕様。`ai.preset` で24種のAIクローラーの扱いをまとめて決められる: `training`(既定=GPTBot・ClaudeBot・Google-Extended・Bytespider・CCBot など**学習用データを集めるクローラーだけを拒否**し、OAI-SearchBot・Claude-SearchBot・PerplexityBot・ChatGPT-User などAI検索と都度取得は許可)/ `allow` / `block` / `none`(AIクローラーを書かない)/ `custom`(`ai.overrides` で1件ずつ指定)。**クローラーは自分に一致するグループを1つだけ読む**ため、GPTBot 用のグループを作った時点で `User-agent: *` の禁止ルールはそのクローラーへ届かなくなる。既定では共通の禁止パスをAI側のグループへ書き写してこの取りこぼしを防ぐ(`ai.inherit: false` で止められる)。パスは先頭の `/` を補い、絶対URLからはパス部分だけを取り出す。`warnings` では空白を含むパス・パーセントエンコードしていない日本語のパス・対応していないクローラーのあるワイルドカード・Googlebotが読まない `Crawl-delay`・サイトマップの宣言漏れ・同じUser-agentの重複・サイト全体の拒否を指摘する。`listCrawlers: true` を渡すと生成せずAIクローラーの一覧(名前・提供元・目的)だけを返す | `siteUrl?`、`disallow?`、`allow?`、`userAgents?`(既定 `*`)、`crawlDelay?`、`blockCrawlers?`、`sitemaps?`、`ai?`(`preset?` / `overrides?` / `inherit?`)、`groups?`、`comments?`(既定 true)、`allowStyle?`(既定 `disallow-empty` / `allow-slash`)、`listCrawlers?`、`lang?`(既定 `ja` / `en`)、`outputPath?` |
|
|
189
191
|
| `case_convert` | 識別子を camelCase / PascalCase / snake_case / CONSTANT_CASE / kebab-case・Train-Case・dot.case・Title Case・Sentence case・lower case・UPPER CASE の11形式へ相互変換する。tools.first-ch.com/case/ と同一ロジック。変数名の一括リネーム、`snake_case` のDB列名と `camelCase` のJSONキーの読み替え、CSVヘッダーの整形といった、層の境目で発生する定型処理のための道具。`scope` で処理の単位を選ぶ: `lines`(既定=1行1件)/ `items`(行内のカンマ・タブ区切りで1件ずつ=CSVヘッダー)/ `whole`(全体で1件)。**前後の空白・インデント・改行コード(LF/CRLF)・区切り記号はそのまま残す**ので、名前だけが置き換わる。大文字の連なりは直後に「大文字+小文字」が続くときだけ手前で切り(`XMLHttpRequest` → `XML` / `Http` / `Request`)、数字は既定で直前の語へ付く(`sha256Hash` → `sha256` / `Hash`。`splitDigits` で分けられる)。頭字語は既定で `parseXmlData` へ畳み、`keepAcronyms` で `parseXMLData` のまま残す(camelCase の先頭語はどちらでも小文字=`URLParser` → `urlParser`)。大文字小文字を持たない文字(日本語など)はそのまま出力し、ローマ字化はしない。`notes` では**変換後に同じ名前へ衝突する項目**(`first name` と `first_name` はどちらも `first_name`=インポート時に片方が黙って消える事故の元)・数字で始まって識別子にできない結果・頭字語を含む項目を指摘し、`items[].detected` では各入力がどの形式で書かれていたかを返す。`allFormats` で各項目を11形式すべてへ展開、`listFormats` で形式の一覧と使いどころだけを返す | `text?` または `path?`、`outputPath?`、`format?`(既定 `camel`)、`scope?`(既定 `lines` / `items` / `whole`)、`splitDigits?`、`keepAcronyms?`、`allFormats?`、`listFormats?`、`lang?`(既定 `ja` / `en`) |
|
|
190
192
|
| `csv_convert` | CSV/TSVとJSON配列を相互変換する。tools.first-ch.com/csv-json/ と同一ロジック。表計算ソフトから書き出した表をAPIに渡せるJSONにする、逆にAPIの応答をExcelで開ける表にする、という**手持ちのデータを形式だけ移し替える**ための道具。`direction` を省くと、入力の先頭が `[` か `{` なら `json2csv`、そうでなければ `csv2json` と推定する。区切り文字は先頭20行で「どの記号が各行に同じ個数だけ現れるか」を見て自動判定し、`delimiter` で固定もできる。**`stock.qty` のような列名は入れ子のオブジェクトとして読み書きし、`tags.0` / `tags.1`(`tags[0]` も同義)は配列になる**。逆向きも同じ規則で平らにするので、CSVへ出してJSONへ戻すと元の構造に復元される(`nest: false` なら入れ子はJSONの文字列としてセル1つに入る)。**型の読み替えは「一度数値にして文字列へ戻したとき元の表記と1文字も違わないか」で決める**ため、`0123`・`+1`・`1.50`・2の53乗を超えるID(`12345678901234567890`)は文字列のまま残り、郵便番号・電話番号・伝票番号・バージョン番号が壊れない。読み取りは RFC 4180 準拠で、引用符・`""` エスケープ・セル内改行・CRLF・BOM に対応する(書き出し側は Excel 向けに `bom` と `newline` を選べる)。JSONは配列・単体のオブジェクト・`{"data":[…]}` のように配列を包んだもの・1行1件のJSON Lines を受け取れる。**JSONの構文エラーは例外にせず、行・桁と前後の抜粋を持つ `ok: false` の結果として返す**ので、応答そのものが直しどころになる。`notes` では、列数が見出しと合わない行・重複した列名(`name_2` として残す)・空の見出し(`column4` を割り当てる)・桁落ちする数値・`=` `+` `-` `@` で始まり表計算ソフトが数式として実行しうるセル(CSVインジェクション)・キーの並びが揃わないオブジェクトを指摘する | `text?` または `path?`、`outputPath?`、`direction?`(既定 `auto` / `csv2json` / `json2csv`)、`delimiter?`(既定 `auto` / `comma` / `tab` / `semicolon` / `pipe`)、`header?`、`nest?`、`types?`、`trim?`、`emptyNull?`、`indent?`(既定 `2` / 0〜8 / `tab`)、`newline?`(既定 `lf` / `crlf`)、`quoteAll?`、`bom?`、`lang?`(既定 `ja` / `en`) |
|
|
193
|
+
| `zenkaku_convert` | 英数字・カタカナ・記号・スペースを**文字種ごとに向きを選んで**全角⇄半角へ変換し、あわせて空白まわりを掃除する。tools.first-ch.com/zenkaku/ と同一ロジック。顧客支給原稿の表記統一、CSV取り込み前の正規化、フォーム入力値の掃除のための道具。`alnum` / `kana` / `symbol` / `space` にそれぞれ `keep`(そのまま)/ `han`(半角へ)/ `zen`(全角へ)を渡す。既定は日本語の原稿で最も多い「英数字・記号・スペースは半角、カタカナは全角」(`preset: 'ja'` と同じ)。`preset` は `ja` / `csv`(`ja` に空白の掃除と見えない文字の除去を足したもの)/ `han` / `zen` で、個別指定が優先される。**半角カタカナは1文字ではない**ため、半角→全角では次が濁点なら1文字へ合成し(`ガ`→`ガ`・`パ`→`パ`・`ヴ`→`ヴ`)、全角→半角では2文字へ分解する。句読点・カギ括弧・中黒・長音(`。 、 「 」 ・ ー`)は半角カタカナのブロック(U+FF61〜U+FF9F)に同居しているので**カタカナと同じ文字種**として扱う(`kana: 'han'` は `「テスト」。` を `「テスト」。` にする。句読点を全角で残すなら `keep`)。スペースは U+3000 ⇄ U+0020 に加え、NBSP や欧文の各種スペースも半角側へ寄せる。掃除は `collapseSpaces`(連続する空白を先頭の1文字へ)・`trimLines`・`blankLines`(`keep` / `collapse` / `remove`)・`removeInvisible`(ゼロ幅・BOM・制御文字)・`composeMarks`(NFC。`ガ` が `カ`+結合文字 U+3099 で書かれた原稿向け)。**改行コード(LF/CRLF)とタブ、ひらがな・漢字は書き換えない。** `notes` では出力に残った半角カナ・全角スペース・見えない文字・結合文字の濁点に加え、波ダッシュ `〜`(U+301C)/全角チルダ `~`(U+FF5E)と環境依存文字(`① ㈱ Ⅲ`)を指摘する(後の2つはどちらへ寄せるべきかが届け先で変わるため**指摘のみで自動変換しない**)。**NFKC正規化とは別物**で、`①` が `1` になることはなく、選んだ文字種しか触らない。`inspect: true` なら変換せず点検結果だけを返す | `text?` または `path?`、`outputPath?`、`preset?`(`ja` / `csv` / `han` / `zen`)、`alnum?`、`kana?`、`symbol?`、`space?`(いずれも `keep` / `han` / `zen`)、`collapseSpaces?`、`trimLines?`、`blankLines?`(既定 `keep` / `collapse` / `remove`)、`removeInvisible?`、`composeMarks?`、`inspect?`、`lang?`(既定 `ja` / `en`) |
|
|
194
|
+
| `cidr_calc` | CIDR表記・サブネットマスク・ACLのワイルドカードマスク・単体のIPから、ネットワークアドレス・ブロードキャスト・使えるホストの範囲・アドレス数とホスト数・逆引きゾーン・2進表記を返す。tools.first-ch.com/cidr/ と同一ロジック。サーバー設定・ファイアウォール・Basic認証の許可リストを書くときのサブネット計算のための道具。**IPv4とIPv6の両対応**で、`::` の省略・末尾のIPv4表記(`::ffff:192.168.0.1`)・`[...]` 囲み・`%zone` を読み、出力は RFC 5952 に従う。`192.168.1.5 255.255.255.0` や `192.168.1.5/0.0.0.255`(ACLの書き方)も同じ入力欄で受け取る。**ホスト数の例外も織り込む**: `/31` は点対点リンクとして2アドレスとも使え(RFC 3021)、`/32` は1台、IPv6にブロードキャストは無い。渡したアドレスのホスト部にビットが立っていれば、`notes` で**設定ファイルに書くべき本来のCIDR**を返す。**先頭に0の付いたオクテット(`192.168.001.1`)は受け取らない**(8進数として読む実装があり、同じ表記が別のアドレスになるため)。アドレス帯は IANA の主要な予約ブロック(プライベート・CGNAT・ループバック・リンクローカル・文書用・マルチキャスト・ULA ほか)と照合して種別を返し、ネットワークがその帯からはみ出す場合も指摘する。`split` はそのプレフィックス長で均等に割った一覧、`contains` は各アドレスがそのネットワークに入るかの判定、`range` は `10.0.0.5 - 10.0.0.200` のような範囲(CIDR・単体IPと混ぜて1行1件か `;` 区切り)を**重なりと隣接をまとめたうえで過不足なく覆う最小個数のCIDR**へ逆算する。計算はすべてBigInt | `cidr?` と/または `range?`、`split?`(プレフィックス長)、`contains?`(文字列の配列)、`limit?`(1〜4096・既定 256)、`lang?`(既定 `ja` / `en`) |
|
|
191
195
|
|
|
192
196
|
正確な入力スキーマ(Zod定義)は [`server.mjs`](./server.mjs) を参照してください。
|
|
193
197
|
|