@alisaitteke/photoshop-mcp 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 (115) hide show
  1. package/.prettierrc +9 -0
  2. package/README.md +1300 -0
  3. package/dist/api/batch-play.d.ts +62 -0
  4. package/dist/api/batch-play.d.ts.map +1 -0
  5. package/dist/api/batch-play.js +131 -0
  6. package/dist/api/batch-play.js.map +1 -0
  7. package/dist/api/extendscript.d.ts +258 -0
  8. package/dist/api/extendscript.d.ts.map +1 -0
  9. package/dist/api/extendscript.js +1437 -0
  10. package/dist/api/extendscript.js.map +1 -0
  11. package/dist/api/photoshop-api.d.ts +20 -0
  12. package/dist/api/photoshop-api.d.ts.map +1 -0
  13. package/dist/api/photoshop-api.js +88 -0
  14. package/dist/api/photoshop-api.js.map +1 -0
  15. package/dist/core/server.d.ts +14 -0
  16. package/dist/core/server.d.ts.map +1 -0
  17. package/dist/core/server.js +191 -0
  18. package/dist/core/server.js.map +1 -0
  19. package/dist/core/session.d.ts +24 -0
  20. package/dist/core/session.d.ts.map +1 -0
  21. package/dist/core/session.js +83 -0
  22. package/dist/core/session.js.map +1 -0
  23. package/dist/core/tool-registry.d.ts +23 -0
  24. package/dist/core/tool-registry.d.ts.map +1 -0
  25. package/dist/core/tool-registry.js +55 -0
  26. package/dist/core/tool-registry.js.map +1 -0
  27. package/dist/index.d.ts +3 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +18 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/platform/connection.d.ts +20 -0
  32. package/dist/platform/connection.d.ts.map +1 -0
  33. package/dist/platform/connection.js +94 -0
  34. package/dist/platform/connection.js.map +1 -0
  35. package/dist/platform/detector.d.ts +19 -0
  36. package/dist/platform/detector.d.ts.map +1 -0
  37. package/dist/platform/detector.js +63 -0
  38. package/dist/platform/detector.js.map +1 -0
  39. package/dist/platform/macos-detector.d.ts +13 -0
  40. package/dist/platform/macos-detector.d.ts.map +1 -0
  41. package/dist/platform/macos-detector.js +145 -0
  42. package/dist/platform/macos-detector.js.map +1 -0
  43. package/dist/platform/macos-executor.d.ts +22 -0
  44. package/dist/platform/macos-executor.d.ts.map +1 -0
  45. package/dist/platform/macos-executor.js +161 -0
  46. package/dist/platform/macos-executor.js.map +1 -0
  47. package/dist/platform/script-executor.d.ts +23 -0
  48. package/dist/platform/script-executor.d.ts.map +1 -0
  49. package/dist/platform/script-executor.js +2 -0
  50. package/dist/platform/script-executor.js.map +1 -0
  51. package/dist/platform/windows-detector.d.ts +14 -0
  52. package/dist/platform/windows-detector.d.ts.map +1 -0
  53. package/dist/platform/windows-detector.js +173 -0
  54. package/dist/platform/windows-detector.js.map +1 -0
  55. package/dist/platform/windows-executor.d.ts +15 -0
  56. package/dist/platform/windows-executor.d.ts.map +1 -0
  57. package/dist/platform/windows-executor.js +148 -0
  58. package/dist/platform/windows-executor.js.map +1 -0
  59. package/dist/tools/action-tools.d.ts +4 -0
  60. package/dist/tools/action-tools.d.ts.map +1 -0
  61. package/dist/tools/action-tools.js +102 -0
  62. package/dist/tools/action-tools.js.map +1 -0
  63. package/dist/tools/adjustment-tools.d.ts +4 -0
  64. package/dist/tools/adjustment-tools.d.ts.map +1 -0
  65. package/dist/tools/adjustment-tools.js +274 -0
  66. package/dist/tools/adjustment-tools.js.map +1 -0
  67. package/dist/tools/document-tools.d.ts +4 -0
  68. package/dist/tools/document-tools.d.ts.map +1 -0
  69. package/dist/tools/document-tools.js +230 -0
  70. package/dist/tools/document-tools.js.map +1 -0
  71. package/dist/tools/filter-tools.d.ts +4 -0
  72. package/dist/tools/filter-tools.d.ts.map +1 -0
  73. package/dist/tools/filter-tools.js +230 -0
  74. package/dist/tools/filter-tools.js.map +1 -0
  75. package/dist/tools/history-tools.d.ts +4 -0
  76. package/dist/tools/history-tools.d.ts.map +1 -0
  77. package/dist/tools/history-tools.js +137 -0
  78. package/dist/tools/history-tools.js.map +1 -0
  79. package/dist/tools/image-placement-tools.d.ts +4 -0
  80. package/dist/tools/image-placement-tools.d.ts.map +1 -0
  81. package/dist/tools/image-placement-tools.js +109 -0
  82. package/dist/tools/image-placement-tools.js.map +1 -0
  83. package/dist/tools/image-tools.d.ts +4 -0
  84. package/dist/tools/image-tools.d.ts.map +1 -0
  85. package/dist/tools/image-tools.js +123 -0
  86. package/dist/tools/image-tools.js.map +1 -0
  87. package/dist/tools/layer-ordering-tools.d.ts +4 -0
  88. package/dist/tools/layer-ordering-tools.d.ts.map +1 -0
  89. package/dist/tools/layer-ordering-tools.js +210 -0
  90. package/dist/tools/layer-ordering-tools.js.map +1 -0
  91. package/dist/tools/layer-properties-tools.d.ts +4 -0
  92. package/dist/tools/layer-properties-tools.d.ts.map +1 -0
  93. package/dist/tools/layer-properties-tools.js +421 -0
  94. package/dist/tools/layer-properties-tools.js.map +1 -0
  95. package/dist/tools/layer-tools.d.ts +4 -0
  96. package/dist/tools/layer-tools.d.ts.map +1 -0
  97. package/dist/tools/layer-tools.js +251 -0
  98. package/dist/tools/layer-tools.js.map +1 -0
  99. package/dist/tools/layer-transform-tools.d.ts +4 -0
  100. package/dist/tools/layer-transform-tools.d.ts.map +1 -0
  101. package/dist/tools/layer-transform-tools.js +199 -0
  102. package/dist/tools/layer-transform-tools.js.map +1 -0
  103. package/dist/tools/selection-tools.d.ts +4 -0
  104. package/dist/tools/selection-tools.d.ts.map +1 -0
  105. package/dist/tools/selection-tools.js +295 -0
  106. package/dist/tools/selection-tools.js.map +1 -0
  107. package/dist/tools/text-tools.d.ts +4 -0
  108. package/dist/tools/text-tools.d.ts.map +1 -0
  109. package/dist/tools/text-tools.js +210 -0
  110. package/dist/tools/text-tools.js.map +1 -0
  111. package/dist/utils/logger.d.ts +17 -0
  112. package/dist/utils/logger.d.ts.map +1 -0
  113. package/dist/utils/logger.js +43 -0
  114. package/dist/utils/logger.js.map +1 -0
  115. package/package.json +47 -0
@@ -0,0 +1,295 @@
1
+ import { PhotoshopAPIFactory } from '../api/photoshop-api.js';
2
+ import { ExtendScriptSnippets } from '../api/extendscript.js';
3
+ export function createSelectionTools(connection) {
4
+ return [
5
+ {
6
+ tool: {
7
+ name: 'photoshop_select_rectangle',
8
+ description: 'Create a rectangular selection',
9
+ inputSchema: {
10
+ type: 'object',
11
+ properties: {
12
+ left: {
13
+ type: 'number',
14
+ description: 'Left edge in pixels',
15
+ },
16
+ top: {
17
+ type: 'number',
18
+ description: 'Top edge in pixels',
19
+ },
20
+ right: {
21
+ type: 'number',
22
+ description: 'Right edge in pixels',
23
+ },
24
+ bottom: {
25
+ type: 'number',
26
+ description: 'Bottom edge in pixels',
27
+ },
28
+ },
29
+ required: ['left', 'top', 'right', 'bottom'],
30
+ },
31
+ },
32
+ handler: async (args) => selectRectangle(connection, args),
33
+ },
34
+ {
35
+ tool: {
36
+ name: 'photoshop_select_all',
37
+ description: 'Select the entire document',
38
+ inputSchema: {
39
+ type: 'object',
40
+ properties: {},
41
+ },
42
+ },
43
+ handler: async () => selectAll(connection),
44
+ },
45
+ {
46
+ tool: {
47
+ name: 'photoshop_deselect',
48
+ description: 'Deselect all selections',
49
+ inputSchema: {
50
+ type: 'object',
51
+ properties: {},
52
+ },
53
+ },
54
+ handler: async () => deselect(connection),
55
+ },
56
+ {
57
+ tool: {
58
+ name: 'photoshop_invert_selection',
59
+ description: 'Invert the current selection',
60
+ inputSchema: {
61
+ type: 'object',
62
+ properties: {},
63
+ },
64
+ },
65
+ handler: async () => invertSelection(connection),
66
+ },
67
+ {
68
+ tool: {
69
+ name: 'photoshop_create_layer_mask',
70
+ description: 'Create a layer mask from the current selection',
71
+ inputSchema: {
72
+ type: 'object',
73
+ properties: {},
74
+ },
75
+ },
76
+ handler: async () => createLayerMask(connection),
77
+ },
78
+ {
79
+ tool: {
80
+ name: 'photoshop_delete_layer_mask',
81
+ description: 'Delete the layer mask from active layer',
82
+ inputSchema: {
83
+ type: 'object',
84
+ properties: {},
85
+ },
86
+ },
87
+ handler: async () => deleteLayerMask(connection),
88
+ },
89
+ {
90
+ tool: {
91
+ name: 'photoshop_apply_layer_mask',
92
+ description: 'Apply (merge) the layer mask to the layer',
93
+ inputSchema: {
94
+ type: 'object',
95
+ properties: {},
96
+ },
97
+ },
98
+ handler: async () => applyLayerMask(connection),
99
+ },
100
+ ];
101
+ }
102
+ async function selectRectangle(connection, args) {
103
+ const left = args.left;
104
+ const top = args.top;
105
+ const right = args.right;
106
+ const bottom = args.bottom;
107
+ try {
108
+ const apiFactory = new PhotoshopAPIFactory(connection);
109
+ const api = await apiFactory.createAPI();
110
+ const script = ExtendScriptSnippets.selectRectangle(left, top, right, bottom);
111
+ await api.executeScript(script);
112
+ return {
113
+ content: [
114
+ {
115
+ type: 'text',
116
+ text: `Rectangular selection created: (${left}, ${top}) to (${right}, ${bottom})`,
117
+ },
118
+ ],
119
+ };
120
+ }
121
+ catch (error) {
122
+ return {
123
+ content: [
124
+ {
125
+ type: 'text',
126
+ text: `Error creating selection: ${error instanceof Error ? error.message : String(error)}`,
127
+ },
128
+ ],
129
+ isError: true,
130
+ };
131
+ }
132
+ }
133
+ async function selectAll(connection) {
134
+ try {
135
+ const apiFactory = new PhotoshopAPIFactory(connection);
136
+ const api = await apiFactory.createAPI();
137
+ const script = ExtendScriptSnippets.selectAll();
138
+ await api.executeScript(script);
139
+ return {
140
+ content: [
141
+ {
142
+ type: 'text',
143
+ text: 'All selected',
144
+ },
145
+ ],
146
+ };
147
+ }
148
+ catch (error) {
149
+ return {
150
+ content: [
151
+ {
152
+ type: 'text',
153
+ text: `Error selecting all: ${error instanceof Error ? error.message : String(error)}`,
154
+ },
155
+ ],
156
+ isError: true,
157
+ };
158
+ }
159
+ }
160
+ async function deselect(connection) {
161
+ try {
162
+ const apiFactory = new PhotoshopAPIFactory(connection);
163
+ const api = await apiFactory.createAPI();
164
+ const script = ExtendScriptSnippets.deselect();
165
+ await api.executeScript(script);
166
+ return {
167
+ content: [
168
+ {
169
+ type: 'text',
170
+ text: 'Selection cleared',
171
+ },
172
+ ],
173
+ };
174
+ }
175
+ catch (error) {
176
+ return {
177
+ content: [
178
+ {
179
+ type: 'text',
180
+ text: `Error deselecting: ${error instanceof Error ? error.message : String(error)}`,
181
+ },
182
+ ],
183
+ isError: true,
184
+ };
185
+ }
186
+ }
187
+ async function invertSelection(connection) {
188
+ try {
189
+ const apiFactory = new PhotoshopAPIFactory(connection);
190
+ const api = await apiFactory.createAPI();
191
+ const script = ExtendScriptSnippets.invertSelection();
192
+ await api.executeScript(script);
193
+ return {
194
+ content: [
195
+ {
196
+ type: 'text',
197
+ text: 'Selection inverted',
198
+ },
199
+ ],
200
+ };
201
+ }
202
+ catch (error) {
203
+ return {
204
+ content: [
205
+ {
206
+ type: 'text',
207
+ text: `Error inverting selection: ${error instanceof Error ? error.message : String(error)}`,
208
+ },
209
+ ],
210
+ isError: true,
211
+ };
212
+ }
213
+ }
214
+ async function createLayerMask(connection) {
215
+ try {
216
+ const apiFactory = new PhotoshopAPIFactory(connection);
217
+ const api = await apiFactory.createAPI();
218
+ const script = ExtendScriptSnippets.createLayerMask();
219
+ await api.executeScript(script);
220
+ return {
221
+ content: [
222
+ {
223
+ type: 'text',
224
+ text: 'Layer mask created from selection',
225
+ },
226
+ ],
227
+ };
228
+ }
229
+ catch (error) {
230
+ return {
231
+ content: [
232
+ {
233
+ type: 'text',
234
+ text: `Error creating layer mask: ${error instanceof Error ? error.message : String(error)}`,
235
+ },
236
+ ],
237
+ isError: true,
238
+ };
239
+ }
240
+ }
241
+ async function deleteLayerMask(connection) {
242
+ try {
243
+ const apiFactory = new PhotoshopAPIFactory(connection);
244
+ const api = await apiFactory.createAPI();
245
+ const script = ExtendScriptSnippets.deleteLayerMask();
246
+ await api.executeScript(script);
247
+ return {
248
+ content: [
249
+ {
250
+ type: 'text',
251
+ text: 'Layer mask deleted',
252
+ },
253
+ ],
254
+ };
255
+ }
256
+ catch (error) {
257
+ return {
258
+ content: [
259
+ {
260
+ type: 'text',
261
+ text: `Error deleting layer mask: ${error instanceof Error ? error.message : String(error)}`,
262
+ },
263
+ ],
264
+ isError: true,
265
+ };
266
+ }
267
+ }
268
+ async function applyLayerMask(connection) {
269
+ try {
270
+ const apiFactory = new PhotoshopAPIFactory(connection);
271
+ const api = await apiFactory.createAPI();
272
+ const script = ExtendScriptSnippets.applyLayerMask();
273
+ await api.executeScript(script);
274
+ return {
275
+ content: [
276
+ {
277
+ type: 'text',
278
+ text: 'Layer mask applied (merged to layer)',
279
+ },
280
+ ],
281
+ };
282
+ }
283
+ catch (error) {
284
+ return {
285
+ content: [
286
+ {
287
+ type: 'text',
288
+ text: `Error applying layer mask: ${error instanceof Error ? error.message : String(error)}`,
289
+ },
290
+ ],
291
+ isError: true,
292
+ };
293
+ }
294
+ }
295
+ //# sourceMappingURL=selection-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selection-tools.js","sourceRoot":"","sources":["../../src/tools/selection-tools.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,UAAU,oBAAoB,CAAC,UAA+B;IAClE,OAAO;QACL;YACE,IAAI,EAAE;gBACJ,IAAI,EAAE,4BAA4B;gBAClC,WAAW,EAAE,gCAAgC;gBAC7C,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,IAAI,EAAE;4BACJ,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,qBAAqB;yBACnC;wBACD,GAAG,EAAE;4BACH,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,oBAAoB;yBAClC;wBACD,KAAK,EAAE;4BACL,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,sBAAsB;yBACpC;wBACD,MAAM,EAAE;4BACN,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,uBAAuB;yBACrC;qBACF;oBACD,QAAQ,EAAE,CAAC,MAAM,EAAE,KAAK,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D,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,SAAS,EAAE,CAAC;QAEzC,MAAM,MAAM,GAAG,oBAAoB,CAAC,cAAc,EAAE,CAAC;QACrD,MAAM,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAEhC,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,sCAAsC;iBAC7C;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,8BAA8B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;iBAC7F;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ToolDefinition } from '../core/tool-registry.js';
2
+ import { PhotoshopConnection } from '../platform/connection.js';
3
+ export declare function createTextTools(connection: PhotoshopConnection): ToolDefinition[];
4
+ //# sourceMappingURL=text-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-tools.d.ts","sourceRoot":"","sources":["../../src/tools/text-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAc,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAIhE,wBAAgB,eAAe,CAAC,UAAU,EAAE,mBAAmB,GAAG,cAAc,EAAE,CA2FjF"}
@@ -0,0 +1,210 @@
1
+ import { PhotoshopAPIFactory } from '../api/photoshop-api.js';
2
+ import { ExtendScriptSnippets } from '../api/extendscript.js';
3
+ export function createTextTools(connection) {
4
+ return [
5
+ {
6
+ tool: {
7
+ name: 'photoshop_set_text_font',
8
+ description: 'Set font family and size for active text layer',
9
+ inputSchema: {
10
+ type: 'object',
11
+ properties: {
12
+ fontName: {
13
+ type: 'string',
14
+ description: 'Font family name (e.g., "Arial", "Helvetica")',
15
+ },
16
+ fontSize: {
17
+ type: 'number',
18
+ description: 'Font size in points (optional)',
19
+ minimum: 1,
20
+ },
21
+ },
22
+ required: ['fontName'],
23
+ },
24
+ },
25
+ handler: async (args) => setTextFont(connection, args),
26
+ },
27
+ {
28
+ tool: {
29
+ name: 'photoshop_set_text_color',
30
+ description: 'Set color for active text layer',
31
+ inputSchema: {
32
+ type: 'object',
33
+ properties: {
34
+ red: {
35
+ type: 'number',
36
+ description: 'Red component (0-255)',
37
+ minimum: 0,
38
+ maximum: 255,
39
+ },
40
+ green: {
41
+ type: 'number',
42
+ description: 'Green component (0-255)',
43
+ minimum: 0,
44
+ maximum: 255,
45
+ },
46
+ blue: {
47
+ type: 'number',
48
+ description: 'Blue component (0-255)',
49
+ minimum: 0,
50
+ maximum: 255,
51
+ },
52
+ },
53
+ required: ['red', 'green', 'blue'],
54
+ },
55
+ },
56
+ handler: async (args) => setTextColor(connection, args),
57
+ },
58
+ {
59
+ tool: {
60
+ name: 'photoshop_set_text_alignment',
61
+ description: 'Set text alignment for active text layer',
62
+ inputSchema: {
63
+ type: 'object',
64
+ properties: {
65
+ alignment: {
66
+ type: 'string',
67
+ description: 'Text alignment',
68
+ enum: ['LEFT', 'CENTER', 'RIGHT', 'LEFTJUSTIFIED', 'CENTERJUSTIFIED', 'RIGHTJUSTIFIED', 'FULLYJUSTIFIED'],
69
+ },
70
+ },
71
+ required: ['alignment'],
72
+ },
73
+ },
74
+ handler: async (args) => setTextAlignment(connection, args),
75
+ },
76
+ {
77
+ tool: {
78
+ name: 'photoshop_update_text_content',
79
+ description: 'Update the text content of active text layer',
80
+ inputSchema: {
81
+ type: 'object',
82
+ properties: {
83
+ text: {
84
+ type: 'string',
85
+ description: 'New text content',
86
+ },
87
+ },
88
+ required: ['text'],
89
+ },
90
+ },
91
+ handler: async (args) => updateTextContent(connection, args),
92
+ },
93
+ ];
94
+ }
95
+ async function setTextFont(connection, args) {
96
+ const fontName = args.fontName;
97
+ const fontSize = args.fontSize;
98
+ try {
99
+ const apiFactory = new PhotoshopAPIFactory(connection);
100
+ const api = await apiFactory.createAPI();
101
+ const script = ExtendScriptSnippets.setTextFont(fontName, fontSize);
102
+ const result = await api.executeScript(script);
103
+ return {
104
+ content: [
105
+ {
106
+ type: 'text',
107
+ text: `Text font set to ${fontName}${fontSize ? `, size ${fontSize}pt` : ''}\nResult: ${JSON.stringify(result)}`,
108
+ },
109
+ ],
110
+ };
111
+ }
112
+ catch (error) {
113
+ return {
114
+ content: [
115
+ {
116
+ type: 'text',
117
+ text: `Error setting text font: ${error instanceof Error ? error.message : String(error)}`,
118
+ },
119
+ ],
120
+ isError: true,
121
+ };
122
+ }
123
+ }
124
+ async function setTextColor(connection, args) {
125
+ const red = args.red;
126
+ const green = args.green;
127
+ const blue = args.blue;
128
+ try {
129
+ const apiFactory = new PhotoshopAPIFactory(connection);
130
+ const api = await apiFactory.createAPI();
131
+ const script = ExtendScriptSnippets.setTextColor(red, green, blue);
132
+ await api.executeScript(script);
133
+ return {
134
+ content: [
135
+ {
136
+ type: 'text',
137
+ text: `Text color set to RGB(${red}, ${green}, ${blue})`,
138
+ },
139
+ ],
140
+ };
141
+ }
142
+ catch (error) {
143
+ return {
144
+ content: [
145
+ {
146
+ type: 'text',
147
+ text: `Error setting text color: ${error instanceof Error ? error.message : String(error)}`,
148
+ },
149
+ ],
150
+ isError: true,
151
+ };
152
+ }
153
+ }
154
+ async function setTextAlignment(connection, args) {
155
+ const alignment = args.alignment;
156
+ try {
157
+ const apiFactory = new PhotoshopAPIFactory(connection);
158
+ const api = await apiFactory.createAPI();
159
+ const script = ExtendScriptSnippets.setTextAlignment(alignment);
160
+ await api.executeScript(script);
161
+ return {
162
+ content: [
163
+ {
164
+ type: 'text',
165
+ text: `Text alignment set to ${alignment}`,
166
+ },
167
+ ],
168
+ };
169
+ }
170
+ catch (error) {
171
+ return {
172
+ content: [
173
+ {
174
+ type: 'text',
175
+ text: `Error setting text alignment: ${error instanceof Error ? error.message : String(error)}`,
176
+ },
177
+ ],
178
+ isError: true,
179
+ };
180
+ }
181
+ }
182
+ async function updateTextContent(connection, args) {
183
+ const text = args.text;
184
+ try {
185
+ const apiFactory = new PhotoshopAPIFactory(connection);
186
+ const api = await apiFactory.createAPI();
187
+ const script = ExtendScriptSnippets.updateTextContent(text);
188
+ await api.executeScript(script);
189
+ return {
190
+ content: [
191
+ {
192
+ type: 'text',
193
+ text: `Text content updated to: "${text}"`,
194
+ },
195
+ ],
196
+ };
197
+ }
198
+ catch (error) {
199
+ return {
200
+ content: [
201
+ {
202
+ type: 'text',
203
+ text: `Error updating text content: ${error instanceof Error ? error.message : String(error)}`,
204
+ },
205
+ ],
206
+ isError: true,
207
+ };
208
+ }
209
+ }
210
+ //# sourceMappingURL=text-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-tools.js","sourceRoot":"","sources":["../../src/tools/text-tools.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,UAAU,eAAe,CAAC,UAA+B;IAC7D,OAAO;QACL;YACE,IAAI,EAAE;gBACJ,IAAI,EAAE,yBAAyB;gBAC/B,WAAW,EAAE,gDAAgD;gBAC7D,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,QAAQ,EAAE;4BACR,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,+CAA+C;yBAC7D;wBACD,QAAQ,EAAE;4BACR,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,gCAAgC;4BAC7C,OAAO,EAAE,CAAC;yBACX;qBACF;oBACD,QAAQ,EAAE,CAAC,UAAU,CAAC;iBACvB;aACF;YACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,E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I,EAAE,MAAe;oBACrB,IAAI,EAAE,gCAAgC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;iBAC/F;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,17 @@
1
+ export declare enum LogLevel {
2
+ DEBUG = 0,
3
+ INFO = 1,
4
+ WARN = 2,
5
+ ERROR = 3
6
+ }
7
+ export declare class Logger {
8
+ private context;
9
+ private logLevel;
10
+ constructor(context: string, logLevel?: LogLevel);
11
+ private log;
12
+ debug(message: string, ...args: unknown[]): void;
13
+ info(message: string, ...args: unknown[]): void;
14
+ warn(message: string, ...args: unknown[]): void;
15
+ error(message: string, ...args: unknown[]): void;
16
+ }
17
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ;IAClB,KAAK,IAAI;IACT,IAAI,IAAI;IACR,IAAI,IAAI;IACR,KAAK,IAAI;CACV;AAED,qBAAa,MAAM;IACjB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAW;gBAEf,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,QAAwB;IAO/D,OAAO,CAAC,GAAG;IAmBX,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IAIzC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IAIxC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IAIxC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;CAG1C"}
@@ -0,0 +1,43 @@
1
+ export var LogLevel;
2
+ (function (LogLevel) {
3
+ LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
4
+ LogLevel[LogLevel["INFO"] = 1] = "INFO";
5
+ LogLevel[LogLevel["WARN"] = 2] = "WARN";
6
+ LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
7
+ })(LogLevel || (LogLevel = {}));
8
+ export class Logger {
9
+ context;
10
+ logLevel;
11
+ constructor(context, logLevel = LogLevel.INFO) {
12
+ this.context = context;
13
+ this.logLevel = process.env.LOG_LEVEL
14
+ ? parseInt(process.env.LOG_LEVEL, 10)
15
+ : logLevel;
16
+ }
17
+ log(level, message, ...args) {
18
+ if (level < this.logLevel)
19
+ return;
20
+ const timestamp = new Date().toISOString();
21
+ const levelStr = LogLevel[level];
22
+ const prefix = `[${timestamp}] [${levelStr}] [${this.context}]`;
23
+ // IMPORTANT: MCP uses stdout for protocol communication
24
+ // All logs must go to stderr to avoid corrupting the JSON-RPC protocol
25
+ const formattedArgs = args.map(arg => typeof arg === 'object' ? JSON.stringify(arg) : String(arg)).join(' ');
26
+ const logMessage = `${prefix} ${message} ${formattedArgs}`.trim();
27
+ // Always write to stderr, never stdout
28
+ process.stderr.write(logMessage + '\n');
29
+ }
30
+ debug(message, ...args) {
31
+ this.log(LogLevel.DEBUG, message, ...args);
32
+ }
33
+ info(message, ...args) {
34
+ this.log(LogLevel.INFO, message, ...args);
35
+ }
36
+ warn(message, ...args) {
37
+ this.log(LogLevel.WARN, message, ...args);
38
+ }
39
+ error(message, ...args) {
40
+ this.log(LogLevel.ERROR, message, ...args);
41
+ }
42
+ }
43
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,yCAAS,CAAA;IACT,uCAAQ,CAAA;IACR,uCAAQ,CAAA;IACR,yCAAS,CAAA;AACX,CAAC,EALW,QAAQ,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OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,GAAG,IAAe;QACtC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,GAAG,IAAe;QACtC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,GAAG,IAAe;QACvC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAC7C,CAAC;CACF"}
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@alisaitteke/photoshop-mcp",
3
+ "version": "0.1.0",
4
+ "description": "MCP server for Adobe Photoshop automation - control Photoshop from AI assistants",
5
+ "main": "dist/index.js",
6
+ "type": "module",
7
+ "bin": {
8
+ "photoshop-mcp": "dist/index.js"
9
+ },
10
+ "scripts": {
11
+ "dev": "tsc --watch",
12
+ "build": "tsc",
13
+ "start": "node dist/index.js",
14
+ "lint": "eslint src --ext .ts",
15
+ "format": "prettier --write \"src/**/*.ts\"",
16
+ "format:check": "prettier --check \"src/**/*.ts\"",
17
+ "prepare": "npm run build"
18
+ },
19
+ "keywords": [
20
+ "mcp",
21
+ "photoshop",
22
+ "adobe",
23
+ "automation",
24
+ "ai",
25
+ "model-context-protocol",
26
+ "image-editing"
27
+ ],
28
+ "author": "",
29
+ "license": "MIT",
30
+ "engines": {
31
+ "node": ">=18.0.0"
32
+ },
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "dependencies": {
37
+ "@modelcontextprotocol/sdk": "^1.0.4"
38
+ },
39
+ "devDependencies": {
40
+ "@types/node": "^22.10.5",
41
+ "@typescript-eslint/eslint-plugin": "^8.20.0",
42
+ "@typescript-eslint/parser": "^8.20.0",
43
+ "eslint": "^9.18.0",
44
+ "prettier": "^3.4.2",
45
+ "typescript": "^5.7.3"
46
+ }
47
+ }