illustrator-mcp-server 1.0.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 (133) hide show
  1. package/LICENSE +21 -0
  2. package/README.ja.md +270 -0
  3. package/README.md +253 -0
  4. package/dist/executor/file-transport.d.ts +19 -0
  5. package/dist/executor/file-transport.d.ts.map +1 -0
  6. package/dist/executor/file-transport.js +55 -0
  7. package/dist/executor/file-transport.js.map +1 -0
  8. package/dist/executor/jsx-runner.d.ts +18 -0
  9. package/dist/executor/jsx-runner.d.ts.map +1 -0
  10. package/dist/executor/jsx-runner.js +95 -0
  11. package/dist/executor/jsx-runner.js.map +1 -0
  12. package/dist/index.d.ts +3 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +22 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/jsx/helpers/common.jsx +320 -0
  17. package/dist/server.d.ts +3 -0
  18. package/dist/server.d.ts.map +1 -0
  19. package/dist/server.js +11 -0
  20. package/dist/server.js.map +1 -0
  21. package/dist/tools/export/export-pdf.d.ts +3 -0
  22. package/dist/tools/export/export-pdf.d.ts.map +1 -0
  23. package/dist/tools/export/export-pdf.js +153 -0
  24. package/dist/tools/export/export-pdf.js.map +1 -0
  25. package/dist/tools/export/export.d.ts +3 -0
  26. package/dist/tools/export/export.d.ts.map +1 -0
  27. package/dist/tools/export/export.js +230 -0
  28. package/dist/tools/export/export.js.map +1 -0
  29. package/dist/tools/modify/apply-color-profile.d.ts +3 -0
  30. package/dist/tools/modify/apply-color-profile.d.ts.map +1 -0
  31. package/dist/tools/modify/apply-color-profile.js +86 -0
  32. package/dist/tools/modify/apply-color-profile.js.map +1 -0
  33. package/dist/tools/modify/convert-to-outlines.d.ts +3 -0
  34. package/dist/tools/modify/convert-to-outlines.d.ts.map +1 -0
  35. package/dist/tools/modify/convert-to-outlines.js +127 -0
  36. package/dist/tools/modify/convert-to-outlines.js.map +1 -0
  37. package/dist/tools/modify/create-ellipse.d.ts +3 -0
  38. package/dist/tools/modify/create-ellipse.d.ts.map +1 -0
  39. package/dist/tools/modify/create-ellipse.js +135 -0
  40. package/dist/tools/modify/create-ellipse.js.map +1 -0
  41. package/dist/tools/modify/create-line.d.ts +3 -0
  42. package/dist/tools/modify/create-line.d.ts.map +1 -0
  43. package/dist/tools/modify/create-line.js +150 -0
  44. package/dist/tools/modify/create-line.js.map +1 -0
  45. package/dist/tools/modify/create-path.d.ts +3 -0
  46. package/dist/tools/modify/create-path.d.ts.map +1 -0
  47. package/dist/tools/modify/create-path.js +192 -0
  48. package/dist/tools/modify/create-path.js.map +1 -0
  49. package/dist/tools/modify/create-rectangle.d.ts +3 -0
  50. package/dist/tools/modify/create-rectangle.d.ts.map +1 -0
  51. package/dist/tools/modify/create-rectangle.js +142 -0
  52. package/dist/tools/modify/create-rectangle.js.map +1 -0
  53. package/dist/tools/modify/create-text-frame.d.ts +3 -0
  54. package/dist/tools/modify/create-text-frame.d.ts.map +1 -0
  55. package/dist/tools/modify/create-text-frame.js +154 -0
  56. package/dist/tools/modify/create-text-frame.js.map +1 -0
  57. package/dist/tools/modify/modify-object.d.ts +3 -0
  58. package/dist/tools/modify/modify-object.d.ts.map +1 -0
  59. package/dist/tools/modify/modify-object.js +224 -0
  60. package/dist/tools/modify/modify-object.js.map +1 -0
  61. package/dist/tools/read/find-objects.d.ts +3 -0
  62. package/dist/tools/read/find-objects.d.ts.map +1 -0
  63. package/dist/tools/read/find-objects.js +220 -0
  64. package/dist/tools/read/find-objects.js.map +1 -0
  65. package/dist/tools/read/get-artboards.d.ts +3 -0
  66. package/dist/tools/read/get-artboards.d.ts.map +1 -0
  67. package/dist/tools/read/get-artboards.js +85 -0
  68. package/dist/tools/read/get-artboards.js.map +1 -0
  69. package/dist/tools/read/get-colors.d.ts +3 -0
  70. package/dist/tools/read/get-colors.d.ts.map +1 -0
  71. package/dist/tools/read/get-colors.js +184 -0
  72. package/dist/tools/read/get-colors.js.map +1 -0
  73. package/dist/tools/read/get-document-info.d.ts +3 -0
  74. package/dist/tools/read/get-document-info.d.ts.map +1 -0
  75. package/dist/tools/read/get-document-info.js +134 -0
  76. package/dist/tools/read/get-document-info.js.map +1 -0
  77. package/dist/tools/read/get-document-structure.d.ts +3 -0
  78. package/dist/tools/read/get-document-structure.d.ts.map +1 -0
  79. package/dist/tools/read/get-document-structure.js +125 -0
  80. package/dist/tools/read/get-document-structure.js.map +1 -0
  81. package/dist/tools/read/get-effects.d.ts +3 -0
  82. package/dist/tools/read/get-effects.d.ts.map +1 -0
  83. package/dist/tools/read/get-effects.js +187 -0
  84. package/dist/tools/read/get-effects.js.map +1 -0
  85. package/dist/tools/read/get-groups.d.ts +3 -0
  86. package/dist/tools/read/get-groups.d.ts.map +1 -0
  87. package/dist/tools/read/get-groups.js +174 -0
  88. package/dist/tools/read/get-groups.js.map +1 -0
  89. package/dist/tools/read/get-guidelines.d.ts +3 -0
  90. package/dist/tools/read/get-guidelines.d.ts.map +1 -0
  91. package/dist/tools/read/get-guidelines.js +100 -0
  92. package/dist/tools/read/get-guidelines.js.map +1 -0
  93. package/dist/tools/read/get-images.d.ts +3 -0
  94. package/dist/tools/read/get-images.d.ts.map +1 -0
  95. package/dist/tools/read/get-images.js +160 -0
  96. package/dist/tools/read/get-images.js.map +1 -0
  97. package/dist/tools/read/get-layers.d.ts +3 -0
  98. package/dist/tools/read/get-layers.d.ts.map +1 -0
  99. package/dist/tools/read/get-layers.js +112 -0
  100. package/dist/tools/read/get-layers.js.map +1 -0
  101. package/dist/tools/read/get-overprint-info.d.ts +3 -0
  102. package/dist/tools/read/get-overprint-info.d.ts.map +1 -0
  103. package/dist/tools/read/get-overprint-info.js +109 -0
  104. package/dist/tools/read/get-overprint-info.js.map +1 -0
  105. package/dist/tools/read/get-path-items.d.ts +3 -0
  106. package/dist/tools/read/get-path-items.d.ts.map +1 -0
  107. package/dist/tools/read/get-path-items.js +252 -0
  108. package/dist/tools/read/get-path-items.js.map +1 -0
  109. package/dist/tools/read/get-selection.d.ts +3 -0
  110. package/dist/tools/read/get-selection.d.ts.map +1 -0
  111. package/dist/tools/read/get-selection.js +177 -0
  112. package/dist/tools/read/get-selection.js.map +1 -0
  113. package/dist/tools/read/get-symbols.d.ts +3 -0
  114. package/dist/tools/read/get-symbols.d.ts.map +1 -0
  115. package/dist/tools/read/get-symbols.js +101 -0
  116. package/dist/tools/read/get-symbols.js.map +1 -0
  117. package/dist/tools/read/get-text-frame-detail.d.ts +3 -0
  118. package/dist/tools/read/get-text-frame-detail.d.ts.map +1 -0
  119. package/dist/tools/read/get-text-frame-detail.js +184 -0
  120. package/dist/tools/read/get-text-frame-detail.js.map +1 -0
  121. package/dist/tools/read/list-text-frames.d.ts +3 -0
  122. package/dist/tools/read/list-text-frames.d.ts.map +1 -0
  123. package/dist/tools/read/list-text-frames.js +177 -0
  124. package/dist/tools/read/list-text-frames.js.map +1 -0
  125. package/dist/tools/registry.d.ts +3 -0
  126. package/dist/tools/registry.d.ts.map +1 -0
  127. package/dist/tools/registry.js +65 -0
  128. package/dist/tools/registry.js.map +1 -0
  129. package/dist/tools/utility/preflight-check.d.ts +3 -0
  130. package/dist/tools/utility/preflight-check.d.ts.map +1 -0
  131. package/dist/tools/utility/preflight-check.js +337 -0
  132. package/dist/tools/utility/preflight-check.js.map +1 -0
  133. package/package.json +54 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 cyocun (IE3)
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.ja.md ADDED
@@ -0,0 +1,270 @@
1
+ **[English version](README.md)**
2
+
3
+ # Illustrator MCP Server
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
+ [![Node.js](https://img.shields.io/badge/Node.js-20%2B-green.svg)](https://nodejs.org/)
7
+ [![Platform](https://img.shields.io/badge/Platform-macOS-lightgrey.svg)]()
8
+ [![Illustrator](https://img.shields.io/badge/Illustrator-CC%202024%2B-orange.svg)](https://www.adobe.com/products/illustrator.html)
9
+ [![MCP](https://img.shields.io/badge/MCP-Compatible-purple.svg)](https://modelcontextprotocol.io/)
10
+
11
+ Adobe Illustrator のデザインデータを読み取り・操作・書き出しする [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) サーバー。
12
+
13
+ Claude などの AI アシスタントから Illustrator を直接操作し、Web 実装に必要なデザイン情報の取得や、印刷用データの確認・書き出しを行えます。
14
+
15
+ ---
16
+
17
+ ## 使用例
18
+
19
+ **デザインデータの取得:**
20
+ ```
21
+ あなた: このドキュメントのテキスト情報を全部教えて
22
+ Claude: → list_text_frames → get_text_frame_detail を実行
23
+ ドキュメント内に 12 個のテキストフレームがあります。
24
+ 見出し「My Design」はフォント Noto Sans JP Bold 48px、色 #333333 ...
25
+ ```
26
+
27
+ **SVG 書き出し:**
28
+ ```
29
+ あなた: アートボード「pc」をSVGで書き出して。テキストはアウトライン化して
30
+ Claude: → get_artboards → export を実行
31
+ /path/to/output.svg に書き出しました(テキストアウトライン化済み)
32
+ ```
33
+
34
+ **入稿前チェック:**
35
+ ```
36
+ あなた: 印刷入稿前のチェックをして
37
+ Claude: → preflight_check を実行
38
+ ⚠ 2件の警告:
39
+ - 低解像度画像: image_01.jpg (150dpi) — 300dpi 以上を推奨
40
+ - 非アウトラインフォント: 3 個のテキストフレーム
41
+ ```
42
+
43
+ **オブジェクト操作:**
44
+ ```
45
+ あなた: 赤い矩形を作って、左上に配置して
46
+ Claude: → create_rectangle を実行
47
+ 200×100 の赤い矩形を (0, 0) に作成しました (uuid: abc-123...)
48
+ ```
49
+
50
+ ---
51
+
52
+ ## 特徴
53
+
54
+ - **26 ツール** — 読み取り 15 / 操作 8 / 書き出し 2 / ユーティリティ 1
55
+ - **Web 座標系** — デフォルトでアートボード相対・Y 軸下向き正(CSS/SVG と同じ座標系)
56
+ - **UUID トラッキング** — 全オブジェクトを `pageItem.note` の UUID で一意に識別
57
+ - **排他制御** — `p-limit(1)` による JSX 実行の直列化(Illustrator はシングルスレッド)
58
+ - **安全なファイル経由通信** — 入出力とも JSON ファイル経由で統一(JSX インジェクション防止)
59
+ - **日本語対応** — BOM 付き UTF-8 で JSX を保存(文字化け防止)
60
+
61
+ ---
62
+
63
+ ## 前提条件
64
+
65
+ | 要件 | バージョン |
66
+ |---|---|
67
+ | macOS | osascript 依存 |
68
+ | Adobe Illustrator | CC 2024 以降 |
69
+ | Node.js | 20 以降 |
70
+
71
+ > **Note:** 初回実行時に macOS のオートメーション権限ダイアログが表示されます。
72
+ > システム設定 > プライバシーとセキュリティ > オートメーション で許可してください。
73
+
74
+ ---
75
+
76
+ ## セットアップ
77
+
78
+ ### インストール
79
+
80
+ ```bash
81
+ git clone https://github.com/ie3jp/illustrator-mcp-server.git
82
+ cd illustrator-mcp-server
83
+ npm install
84
+ npm run build
85
+ ```
86
+
87
+ ### Claude Code に登録
88
+
89
+ ```bash
90
+ claude mcp add illustrator-mcp -- node /path/to/illustrator-mcp-server/dist/index.js
91
+ ```
92
+
93
+ ### Claude Desktop に登録
94
+
95
+ `claude_desktop_config.json` に追加:
96
+
97
+ ```json
98
+ {
99
+ "mcpServers": {
100
+ "illustrator": {
101
+ "command": "node",
102
+ "args": ["/path/to/illustrator-mcp-server/dist/index.js"]
103
+ }
104
+ }
105
+ }
106
+ ```
107
+
108
+ ### 動作確認
109
+
110
+ ```bash
111
+ # MCP Inspector で個別ツールをテスト
112
+ npx @modelcontextprotocol/inspector node dist/index.js
113
+ ```
114
+
115
+ ---
116
+
117
+ ## ツール一覧
118
+
119
+ ### 読み取り系 (15)
120
+
121
+ <details>
122
+ <summary>クリックして展開</summary>
123
+
124
+ | ツール | 概要 |
125
+ |---|---|
126
+ | `get_document_info` | ドキュメントのメタデータ(サイズ、カラーモード、プロファイル等) |
127
+ | `get_artboards` | アートボード情報(位置、サイズ、向き) |
128
+ | `get_layers` | レイヤー構造のツリー取得 |
129
+ | `get_document_structure` | レイヤー→グループ→オブジェクトのツリー一括取得 |
130
+ | `list_text_frames` | テキストフレーム一覧(フォント、サイズ、スタイル名) |
131
+ | `get_text_frame_detail` | 特定テキストの全属性(カーニング、段落設定等) |
132
+ | `get_colors` | 使用カラー情報(スウォッチ、グラデーション、スポットカラー等) |
133
+ | `get_path_items` | パス・シェイプデータ(塗り、線、アンカーポイント) |
134
+ | `get_groups` | グループ・クリッピングマスク・複合パスの構造 |
135
+ | `get_effects` | エフェクト・アピアランス情報(不透明度、描画モード) |
136
+ | `get_images` | 埋め込み/リンク画像の情報(解像度、リンク切れ検出) |
137
+ | `get_symbols` | シンボル定義とインスタンス |
138
+ | `get_guidelines` | ガイドライン情報 |
139
+ | `get_selection` | 選択中オブジェクトの詳細 |
140
+ | `find_objects` | 条件検索(名前、タイプ、色、フォント等) |
141
+
142
+ </details>
143
+
144
+ ### 操作系 (8)
145
+
146
+ <details>
147
+ <summary>クリックして展開</summary>
148
+
149
+ | ツール | 概要 |
150
+ |---|---|
151
+ | `create_rectangle` | 長方形の作成(角丸対応) |
152
+ | `create_ellipse` | 楕円の作成 |
153
+ | `create_line` | 直線の作成 |
154
+ | `create_text_frame` | テキストフレームの作成(ポイント/エリア) |
155
+ | `create_path` | 任意パスの作成(ベジェハンドル対応) |
156
+ | `modify_object` | 既存オブジェクトのプロパティ変更 |
157
+ | `convert_to_outlines` | テキストのアウトライン化 |
158
+ | `apply_color_profile` | カラープロファイルの適用 |
159
+
160
+ </details>
161
+
162
+ ### 書き出し系 (2)
163
+
164
+ | ツール | 概要 |
165
+ |---|---|
166
+ | `export` | SVG / PNG / JPG 書き出し(アートボード、選択範囲、UUID 指定) |
167
+ | `export_pdf` | 印刷用 PDF 書き出し(トンボ、裁ち落とし、ダウンサンプリング) |
168
+
169
+ ### ユーティリティ (1)
170
+
171
+ | ツール | 概要 |
172
+ |---|---|
173
+ | `preflight_check` | 入稿前チェック(RGB 混在、リンク切れ、低解像度、白オーバープリント等) |
174
+
175
+ ---
176
+
177
+ ## アーキテクチャ
178
+
179
+ ```mermaid
180
+ flowchart LR
181
+ Claude <-->|MCP Protocol| Server["MCP Server\n(TypeScript/Node.js)"]
182
+ Server <-->|execFile| osascript
183
+ osascript <-->|do javascript| AI["Adobe Illustrator\n(ExtendScript/JSX)"]
184
+
185
+ Server -.->|write| PF["params-{uuid}.json"]
186
+ PF -.->|read| AI
187
+ AI -.->|write| RF["result-{uuid}.json"]
188
+ RF -.->|read| Server
189
+ Server -.->|generate| JSX["script-{uuid}.jsx\n(BOM UTF-8)"]
190
+ Server -.->|generate| AS["run-{uuid}.scpt"]
191
+ ```
192
+
193
+ ### 通信フロー
194
+
195
+ 1. Claude が MCP Server のツールを呼び出す
196
+ 2. MCP Server がパラメータを JSON ファイルに書き出す
197
+ 3. 共通ヘルパー + ツール固有コードを結合して BOM 付き UTF-8 の JSX ファイルを生成
198
+ 4. AppleScript ファイルを生成し、`osascript` で非同期実行
199
+ 5. JSX が結果を JSON ファイルに書き出す
200
+ 6. MCP Server が結果を読み取り、Claude に返す
201
+ 7. 一時ファイルを `try/finally` でクリーンアップ
202
+
203
+ ### 座標系
204
+
205
+ 全ツールに `coordinate_system` パラメータがあります。
206
+
207
+ | 値 | 原点 | Y 軸 | 用途 |
208
+ |---|---|---|---|
209
+ | `artboard-web`(デフォルト) | アートボード左上 | 下向き正 | Web/CSS 実装 |
210
+ | `document` | ペーストボード | 上向き正(Illustrator ネイティブ) | 印刷・DTP |
211
+
212
+ ---
213
+
214
+ ## テスト
215
+
216
+ ```bash
217
+ # ユニットテスト
218
+ npm test
219
+
220
+ # E2E スモークテスト(Illustrator 起動 + ファイルオープン状態で実行)
221
+ npx tsx test/e2e/smoke-test.ts
222
+ ```
223
+
224
+ E2E テストは全 30 ケース(読み取り 16 + 書き出し 4 + ユーティリティ 2 + 操作 8)を自動実行します。
225
+
226
+ ---
227
+
228
+ ## 既知の制約
229
+
230
+ | 制約 | 詳細 |
231
+ |---|---|
232
+ | macOS 専用 | osascript 依存。Windows 対応は将来検討 |
233
+ | ライブエフェクト | ExtendScript DOM の制約により、ドロップシャドウ等のパラメータ取得不可 |
234
+ | カラープロファイル変換 | プロファイル割り当てのみ。完全な ICC 変換は非対応 |
235
+ | 裁ち落とし設定 | ExtendScript API で非公開のため取得不可 |
236
+ | WebP 書き出し | ExtendScript の ExportType に存在しないため非対応 |
237
+ | 日本式トンボ | `PageMarksTypes.Japanese` が PDF 書き出しで反映されない場合あり |
238
+
239
+ ---
240
+
241
+ ## プロジェクト構成
242
+
243
+ ```
244
+ illustrator-mcp-server/
245
+ ├── src/
246
+ │ ├── index.ts # エントリポイント
247
+ │ ├── server.ts # MCP サーバー
248
+ │ ├── executor/
249
+ │ │ ├── jsx-runner.ts # osascript 実行 + 排他制御
250
+ │ │ └── file-transport.ts # 一時ファイル管理
251
+ │ ├── tools/
252
+ │ │ ├── registry.ts # ツール登録
253
+ │ │ ├── read/ # 読み取り系 15 ツール
254
+ │ │ ├── modify/ # 操作系 8 ツール
255
+ │ │ ├── export/ # 書き出し系 2 ツール
256
+ │ │ └── utility/ # ユーティリティ 1 ツール
257
+ │ └── jsx/
258
+ │ └── helpers/
259
+ │ └── common.jsx # ExtendScript 共通ヘルパー
260
+ ├── test/
261
+ │ └── e2e/
262
+ │ └── smoke-test.ts # E2E スモークテスト
263
+ └── docs/ # 設計ドキュメント
264
+ ```
265
+
266
+ ---
267
+
268
+ ## ライセンス
269
+
270
+ [MIT](LICENSE)
package/README.md ADDED
@@ -0,0 +1,253 @@
1
+ **[日本語版はこちら / Japanese version](README.ja.md)**
2
+
3
+ # Illustrator MCP Server
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
+ [![Node.js](https://img.shields.io/badge/Node.js-20%2B-green.svg)](https://nodejs.org/)
7
+ [![Platform](https://img.shields.io/badge/Platform-macOS-lightgrey.svg)]()
8
+ [![Illustrator](https://img.shields.io/badge/Illustrator-CC%202024%2B-orange.svg)](https://www.adobe.com/products/illustrator.html)
9
+ [![MCP](https://img.shields.io/badge/MCP-Compatible-purple.svg)](https://modelcontextprotocol.io/)
10
+
11
+ An [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) server for reading, manipulating, and exporting Adobe Illustrator design data.
12
+
13
+ Control Illustrator directly from AI assistants like Claude — extract design information for web implementation, verify print-ready data, and export assets.
14
+
15
+ ---
16
+
17
+ ## Usage Examples
18
+
19
+ **Extracting design data:**
20
+ ```
21
+ You: Show me all the text information in this document
22
+ Claude: → list_text_frames → get_text_frame_detail
23
+ There are 12 text frames in the document.
24
+ The heading "My Design" uses Noto Sans JP Bold 48px, color #333333 ...
25
+ ```
26
+
27
+ **SVG export:**
28
+ ```
29
+ You: Export the "pc" artboard as SVG with outlined text
30
+ Claude: → get_artboards → export
31
+ Exported to /path/to/output.svg (text converted to outlines)
32
+ ```
33
+
34
+ **Pre-press preflight:**
35
+ ```
36
+ You: Run a pre-press preflight check
37
+ Claude: → preflight_check
38
+ ⚠ 2 warnings:
39
+ - Low resolution image: image_01.jpg (150dpi) — 300dpi or higher recommended
40
+ - Non-outlined fonts: 3 text frames
41
+ ```
42
+
43
+ **Object manipulation:**
44
+ ```
45
+ You: Create a red rectangle and place it in the top-left corner
46
+ Claude: → create_rectangle
47
+ Created a 200×100 red rectangle at (0, 0) (uuid: abc-123...)
48
+ ```
49
+
50
+ ---
51
+
52
+ ## Features
53
+
54
+ - **26 tools** — 15 read / 8 modify / 2 export / 1 utility
55
+ - **Web coordinate system** — Y-axis down, artboard-relative (same as CSS/SVG)
56
+ - **UUID tracking** — Stable object identification across tool calls
57
+
58
+ ---
59
+
60
+ ## Prerequisites
61
+
62
+ - **macOS** (osascript)
63
+ - **Adobe Illustrator CC 2024+**
64
+
65
+ > On first run, allow automation access in System Settings > Privacy & Security > Automation.
66
+
67
+ ---
68
+
69
+ ## Setup
70
+
71
+ ### Installation
72
+
73
+ ```bash
74
+ git clone https://github.com/ie3jp/illustrator-mcp-server.git
75
+ cd illustrator-mcp-server
76
+ npm install
77
+ npm run build
78
+ ```
79
+
80
+ ### Register with Claude Code
81
+
82
+ ```bash
83
+ claude mcp add illustrator-mcp -- node /path/to/illustrator-mcp-server/dist/index.js
84
+ ```
85
+
86
+ ### Register with Claude Desktop
87
+
88
+ Add to `claude_desktop_config.json`:
89
+
90
+ ```json
91
+ {
92
+ "mcpServers": {
93
+ "illustrator": {
94
+ "command": "node",
95
+ "args": ["/path/to/illustrator-mcp-server/dist/index.js"]
96
+ }
97
+ }
98
+ }
99
+ ```
100
+
101
+ ### Verify Installation
102
+
103
+ ```bash
104
+ # Test individual tools with MCP Inspector
105
+ npx @modelcontextprotocol/inspector node dist/index.js
106
+ ```
107
+
108
+ ---
109
+
110
+ ## Tool Reference
111
+
112
+ ### Read Tools (15)
113
+
114
+ <details>
115
+ <summary>Click to expand</summary>
116
+
117
+ | Tool | Description |
118
+ |---|---|
119
+ | `get_document_info` | Document metadata (dimensions, color mode, profile, etc.) |
120
+ | `get_artboards` | Artboard information (position, size, orientation) |
121
+ | `get_layers` | Layer structure as a tree |
122
+ | `get_document_structure` | Full tree: layers → groups → objects in one call |
123
+ | `list_text_frames` | List of text frames (font, size, style name) |
124
+ | `get_text_frame_detail` | All attributes of a specific text frame (kerning, paragraph settings, etc.) |
125
+ | `get_colors` | Color information in use (swatches, gradients, spot colors, etc.) |
126
+ | `get_path_items` | Path/shape data (fill, stroke, anchor points) |
127
+ | `get_groups` | Groups, clipping masks, and compound path structure |
128
+ | `get_effects` | Effects and appearance info (opacity, blend mode) |
129
+ | `get_images` | Embedded/linked image info (resolution, broken link detection) |
130
+ | `get_symbols` | Symbol definitions and instances |
131
+ | `get_guidelines` | Guide information |
132
+ | `get_selection` | Details of currently selected objects |
133
+ | `find_objects` | Search by criteria (name, type, color, font, etc.) |
134
+
135
+ </details>
136
+
137
+ ### Modify Tools (8)
138
+
139
+ <details>
140
+ <summary>Click to expand</summary>
141
+
142
+ | Tool | Description |
143
+ |---|---|
144
+ | `create_rectangle` | Create a rectangle (supports rounded corners) |
145
+ | `create_ellipse` | Create an ellipse |
146
+ | `create_line` | Create a line |
147
+ | `create_text_frame` | Create a text frame (point or area type) |
148
+ | `create_path` | Create a custom path (with Bezier handles) |
149
+ | `modify_object` | Modify properties of an existing object |
150
+ | `convert_to_outlines` | Convert text to outlines |
151
+ | `apply_color_profile` | Apply a color profile |
152
+
153
+ </details>
154
+
155
+ ### Export Tools (2)
156
+
157
+ | Tool | Description |
158
+ |---|---|
159
+ | `export` | SVG / PNG / JPG export (by artboard, selection, or UUID) |
160
+ | `export_pdf` | Print-ready PDF export (crop marks, bleed, downsampling) |
161
+
162
+ ### Utility (1)
163
+
164
+ | Tool | Description |
165
+ |---|---|
166
+ | `preflight_check` | Pre-press check (RGB mixing, broken links, low resolution, white overprint, etc.) |
167
+
168
+ ---
169
+
170
+ ## Architecture
171
+
172
+ ```mermaid
173
+ flowchart LR
174
+ Claude <-->|MCP Protocol| Server["MCP Server\n(TypeScript/Node.js)"]
175
+ Server <-->|execFile| osascript
176
+ osascript <-->|do javascript| AI["Adobe Illustrator\n(ExtendScript/JSX)"]
177
+
178
+ Server -.->|write| PF["params-{uuid}.json"]
179
+ PF -.->|read| AI
180
+ AI -.->|write| RF["result-{uuid}.json"]
181
+ RF -.->|read| Server
182
+ Server -.->|generate| JSX["script-{uuid}.jsx\n(BOM UTF-8)"]
183
+ Server -.->|generate| AS["run-{uuid}.scpt"]
184
+ ```
185
+
186
+ ### Coordinate System
187
+
188
+ All tools accept a `coordinate_system` parameter.
189
+
190
+ | Value | Origin | Y-axis | Use case |
191
+ |---|---|---|---|
192
+ | `artboard-web` (default) | Artboard top-left | Positive downward | Web / CSS implementation |
193
+ | `document` | Pasteboard | Positive upward (Illustrator native) | Print / DTP |
194
+
195
+ ---
196
+
197
+ ## Testing
198
+
199
+ ```bash
200
+ # Unit tests
201
+ npm test
202
+
203
+ # E2E smoke test (requires Illustrator running with a file open)
204
+ npx tsx test/e2e/smoke-test.ts
205
+ ```
206
+
207
+ The E2E test suite runs all 30 cases automatically (16 read + 4 export + 2 utility + 8 modify).
208
+
209
+ ---
210
+
211
+ ## Known Limitations
212
+
213
+ | Limitation | Details |
214
+ |---|---|
215
+ | macOS only | Depends on osascript. Windows support may be considered in the future |
216
+ | Live effects | ExtendScript DOM limitations prevent reading parameters for drop shadows, etc. |
217
+ | Color profile conversion | Only profile assignment is supported; full ICC conversion is not available |
218
+ | Bleed settings | Not accessible via the ExtendScript API (undocumented) |
219
+ | WebP export | Not supported — ExportType does not include WebP in ExtendScript |
220
+ | Japanese crop marks | `PageMarksTypes.Japanese` may not be applied correctly in PDF export |
221
+
222
+ ---
223
+
224
+ ## Project Structure
225
+
226
+ ```
227
+ illustrator-mcp-server/
228
+ ├── src/
229
+ │ ├── index.ts # Entry point
230
+ │ ├── server.ts # MCP server
231
+ │ ├── executor/
232
+ │ │ ├── jsx-runner.ts # osascript execution + concurrency control
233
+ │ │ └── file-transport.ts # Temp file management
234
+ │ ├── tools/
235
+ │ │ ├── registry.ts # Tool registration
236
+ │ │ ├── read/ # 15 read tools
237
+ │ │ ├── modify/ # 8 modify tools
238
+ │ │ ├── export/ # 2 export tools
239
+ │ │ └── utility/ # 1 utility tool
240
+ │ └── jsx/
241
+ │ └── helpers/
242
+ │ └── common.jsx # ExtendScript common helpers
243
+ ├── test/
244
+ │ └── e2e/
245
+ │ └── smoke-test.ts # E2E smoke test
246
+ └── docs/ # Design documents
247
+ ```
248
+
249
+ ---
250
+
251
+ ## License
252
+
253
+ [MIT](LICENSE)
@@ -0,0 +1,19 @@
1
+ export declare const TMP_DIR = "/tmp/illustrator-mcp";
2
+ export interface TempFiles {
3
+ id: string;
4
+ paramsPath: string;
5
+ scriptPath: string;
6
+ scptPath: string;
7
+ resultPath: string;
8
+ }
9
+ export declare function ensureTmpDir(): Promise<void>;
10
+ export declare function createTempFiles(): TempFiles;
11
+ export declare function writeParams(paramsPath: string, params: unknown): Promise<void>;
12
+ export declare function writeJsx(scriptPath: string, jsxCode: string): Promise<void>;
13
+ export declare function writeAppleScript(scptPath: string, scriptPath: string, options?: {
14
+ activate?: boolean;
15
+ }): Promise<void>;
16
+ export declare function readResult(resultPath: string): Promise<unknown>;
17
+ export declare function cleanupTempFiles(files: TempFiles): Promise<void>;
18
+ export declare function cleanupTmpDirSync(): void;
19
+ //# sourceMappingURL=file-transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-transport.d.ts","sourceRoot":"","sources":["../../src/executor/file-transport.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,yBAAyB,CAAC;AAG9C,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAElD;AAED,wBAAgB,eAAe,IAAI,SAAS,CAS3C;AAED,wBAAsB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAEpF;AAED,wBAAsB,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjF;AAED,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAC/B,OAAO,CAAC,IAAI,CAAC,CAQf;AAED,wBAAsB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGrE;AAED,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAOtE;AAED,wBAAgB,iBAAiB,IAAI,IAAI,CAMxC"}
@@ -0,0 +1,55 @@
1
+ import { randomUUID } from 'crypto';
2
+ import * as fs from 'fs/promises';
3
+ import { rmSync } from 'fs';
4
+ import * as path from 'path';
5
+ export const TMP_DIR = '/tmp/illustrator-mcp';
6
+ const BOM = '\uFEFF';
7
+ export async function ensureTmpDir() {
8
+ await fs.mkdir(TMP_DIR, { recursive: true });
9
+ }
10
+ export function createTempFiles() {
11
+ const id = randomUUID();
12
+ return {
13
+ id,
14
+ paramsPath: path.join(TMP_DIR, `params-${id}.json`),
15
+ scriptPath: path.join(TMP_DIR, `script-${id}.jsx`),
16
+ scptPath: path.join(TMP_DIR, `run-${id}.scpt`),
17
+ resultPath: path.join(TMP_DIR, `result-${id}.json`),
18
+ };
19
+ }
20
+ export async function writeParams(paramsPath, params) {
21
+ await fs.writeFile(paramsPath, JSON.stringify(params ?? {}), 'utf-8');
22
+ }
23
+ export async function writeJsx(scriptPath, jsxCode) {
24
+ await fs.writeFile(scriptPath, BOM + jsxCode, 'utf-8');
25
+ }
26
+ export async function writeAppleScript(scptPath, scriptPath, options) {
27
+ const lines = ['tell application "Adobe Illustrator"'];
28
+ if (options?.activate) {
29
+ lines.push(' activate');
30
+ }
31
+ lines.push(` do javascript of file "${scriptPath}"`);
32
+ lines.push('end tell');
33
+ await fs.writeFile(scptPath, lines.join('\n'), 'utf-8');
34
+ }
35
+ export async function readResult(resultPath) {
36
+ const raw = await fs.readFile(resultPath, 'utf-8');
37
+ return JSON.parse(raw.replace(/^\uFEFF/, ''));
38
+ }
39
+ export async function cleanupTempFiles(files) {
40
+ await Promise.allSettled([
41
+ fs.unlink(files.paramsPath),
42
+ fs.unlink(files.scriptPath),
43
+ fs.unlink(files.scptPath),
44
+ fs.unlink(files.resultPath),
45
+ ]);
46
+ }
47
+ export function cleanupTmpDirSync() {
48
+ try {
49
+ rmSync(TMP_DIR, { recursive: true, force: true });
50
+ }
51
+ catch {
52
+ // 終了時のクリーンアップ失敗は無視
53
+ }
54
+ }
55
+ //# sourceMappingURL=file-transport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-transport.js","sourceRoot":"","sources":["../../src/executor/file-transport.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,18 @@
1
+ export interface JsxResult {
2
+ error?: boolean;
3
+ message?: string;
4
+ line?: number;
5
+ [key: string]: unknown;
6
+ }
7
+ /**
8
+ * JSX を実行する(排他制御付き — 公開 API)
9
+ */
10
+ export declare function executeJsx(jsxCode: string, params?: unknown, options?: {
11
+ timeout?: number;
12
+ activate?: boolean;
13
+ }): Promise<JsxResult>;
14
+ /**
15
+ * 重い処理用の JSX 実行(タイムアウト延長 + Illustrator をフォアグラウンドに)
16
+ */
17
+ export declare function executeJsxHeavy(jsxCode: string, params?: unknown): Promise<JsxResult>;
18
+ //# sourceMappingURL=jsx-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-runner.d.ts","sourceRoot":"","sources":["../../src/executor/jsx-runner.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AA0FD;;GAEG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GACjD,OAAO,CAAC,SAAS,CAAC,CAOpB;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,SAAS,CAAC,CAEpB"}