@translateimage/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 (82) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +533 -0
  3. package/dist/bin/http.d.ts +3 -0
  4. package/dist/bin/http.d.ts.map +1 -0
  5. package/dist/bin/http.js +51 -0
  6. package/dist/bin/stdio.d.ts +3 -0
  7. package/dist/bin/stdio.d.ts.map +1 -0
  8. package/dist/bin/stdio.js +14 -0
  9. package/dist/src/index.d.ts +5 -0
  10. package/dist/src/index.d.ts.map +1 -0
  11. package/dist/src/index.js +3 -0
  12. package/dist/src/schemas/common.d.ts +40 -0
  13. package/dist/src/schemas/common.d.ts.map +1 -0
  14. package/dist/src/schemas/common.js +31 -0
  15. package/dist/src/schemas/image-to-text.d.ts +69 -0
  16. package/dist/src/schemas/image-to-text.d.ts.map +1 -0
  17. package/dist/src/schemas/image-to-text.js +26 -0
  18. package/dist/src/schemas/index.d.ts +7 -0
  19. package/dist/src/schemas/index.d.ts.map +1 -0
  20. package/dist/src/schemas/index.js +6 -0
  21. package/dist/src/schemas/ocr.d.ts +333 -0
  22. package/dist/src/schemas/ocr.d.ts.map +1 -0
  23. package/dist/src/schemas/ocr.js +46 -0
  24. package/dist/src/schemas/shopify.d.ts +860 -0
  25. package/dist/src/schemas/shopify.d.ts.map +1 -0
  26. package/dist/src/schemas/shopify.js +183 -0
  27. package/dist/src/schemas/text-removal.d.ts +60 -0
  28. package/dist/src/schemas/text-removal.d.ts.map +1 -0
  29. package/dist/src/schemas/text-removal.js +16 -0
  30. package/dist/src/schemas/translate.d.ts +197 -0
  31. package/dist/src/schemas/translate.d.ts.map +1 -0
  32. package/dist/src/schemas/translate.js +70 -0
  33. package/dist/src/server.d.ts +4 -0
  34. package/dist/src/server.d.ts.map +1 -0
  35. package/dist/src/server.js +7 -0
  36. package/dist/src/tools/image-to-text.d.ts +4 -0
  37. package/dist/src/tools/image-to-text.d.ts.map +1 -0
  38. package/dist/src/tools/image-to-text.js +12 -0
  39. package/dist/src/tools/index.d.ts +8 -0
  40. package/dist/src/tools/index.d.ts.map +1 -0
  41. package/dist/src/tools/index.js +202 -0
  42. package/dist/src/tools/ocr.d.ts +4 -0
  43. package/dist/src/tools/ocr.d.ts.map +1 -0
  44. package/dist/src/tools/ocr.js +28 -0
  45. package/dist/src/tools/shopify/batch-translate.d.ts +26 -0
  46. package/dist/src/tools/shopify/batch-translate.d.ts.map +1 -0
  47. package/dist/src/tools/shopify/batch-translate.js +143 -0
  48. package/dist/src/tools/shopify/index.d.ts +19 -0
  49. package/dist/src/tools/shopify/index.d.ts.map +1 -0
  50. package/dist/src/tools/shopify/index.js +28 -0
  51. package/dist/src/tools/shopify/scan-products.d.ts +38 -0
  52. package/dist/src/tools/shopify/scan-products.d.ts.map +1 -0
  53. package/dist/src/tools/shopify/scan-products.js +178 -0
  54. package/dist/src/tools/shopify/shop-stats.d.ts +12 -0
  55. package/dist/src/tools/shopify/shop-stats.d.ts.map +1 -0
  56. package/dist/src/tools/shopify/shop-stats.js +89 -0
  57. package/dist/src/tools/shopify/translate-product.d.ts +19 -0
  58. package/dist/src/tools/shopify/translate-product.d.ts.map +1 -0
  59. package/dist/src/tools/shopify/translate-product.js +121 -0
  60. package/dist/src/tools/text-removal.d.ts +4 -0
  61. package/dist/src/tools/text-removal.d.ts.map +1 -0
  62. package/dist/src/tools/text-removal.js +10 -0
  63. package/dist/src/tools/translate.d.ts +4 -0
  64. package/dist/src/tools/translate.d.ts.map +1 -0
  65. package/dist/src/tools/translate.js +16 -0
  66. package/dist/src/utils/api-client.d.ts +46 -0
  67. package/dist/src/utils/api-client.d.ts.map +1 -0
  68. package/dist/src/utils/api-client.js +124 -0
  69. package/dist/src/utils/config.d.ts +7 -0
  70. package/dist/src/utils/config.d.ts.map +1 -0
  71. package/dist/src/utils/config.js +11 -0
  72. package/dist/src/utils/errors.d.ts +17 -0
  73. package/dist/src/utils/errors.d.ts.map +1 -0
  74. package/dist/src/utils/errors.js +35 -0
  75. package/dist/src/utils/image.d.ts +34 -0
  76. package/dist/src/utils/image.d.ts.map +1 -0
  77. package/dist/src/utils/image.js +105 -0
  78. package/dist/src/utils/index.d.ts +5 -0
  79. package/dist/src/utils/index.d.ts.map +1 -0
  80. package/dist/src/utils/index.js +4 -0
  81. package/dist/tsconfig.build.tsbuildinfo +1 -0
  82. package/package.json +63 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shopify.d.ts","sourceRoot":"","sources":["../../../src/schemas/shopify.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,183 @@
1
+ import { z } from "zod";
2
+ import { LanguageCodeSchema } from "./common.js";
3
+ /**
4
+ * Shopify credentials schema
5
+ */
6
+ export const ShopifyCredentialsSchema = z.object({
7
+ shopDomain: z
8
+ .string()
9
+ .describe("Shopify shop domain (e.g., 'myshop.myshopify.com')"),
10
+ accessToken: z.string().describe("Shopify API access token"),
11
+ });
12
+ /**
13
+ * Translate product input schema
14
+ */
15
+ export const TranslateProductInputSchema = z.object({
16
+ shopifyCredentials: ShopifyCredentialsSchema.describe("Shopify shop credentials"),
17
+ productId: z.string().describe("Shopify product ID"),
18
+ targetLanguage: LanguageCodeSchema.describe("Target language for translation"),
19
+ translator: z.string().describe("Translator model to use"),
20
+ });
21
+ /**
22
+ * Individual image translation result schema
23
+ */
24
+ export const ImageTranslationResultSchema = z.object({
25
+ mediaId: z.string().describe("Shopify media ID"),
26
+ originalUrl: z.string().optional().describe("Original image URL"),
27
+ translatedImage: z.string().describe("Base64-encoded translated image"),
28
+ status: z
29
+ .enum(["success", "error"])
30
+ .describe("Whether this image was translated successfully"),
31
+ error: z.string().optional().describe("Error message if translation failed"),
32
+ });
33
+ /**
34
+ * Translate product output schema
35
+ */
36
+ export const TranslateProductOutputSchema = z.object({
37
+ productId: z.string().describe("Shopify product ID"),
38
+ productTitle: z.string().describe("Product title"),
39
+ status: z
40
+ .enum(["completed", "failed", "no_images"])
41
+ .describe("Overall translation status"),
42
+ imagesTranslated: z
43
+ .number()
44
+ .describe("Number of images successfully translated"),
45
+ targetLanguage: z.string().describe("Target language used for translation"),
46
+ results: z
47
+ .array(ImageTranslationResultSchema)
48
+ .describe("Individual image translation results"),
49
+ error: z.string().optional().describe("Error message if translation failed"),
50
+ });
51
+ /**
52
+ * Batch translate input schema
53
+ */
54
+ export const BatchTranslateInputSchema = z.object({
55
+ shopifyCredentials: ShopifyCredentialsSchema.describe("Shopify shop credentials"),
56
+ productIds: z
57
+ .array(z.string())
58
+ .describe("Array of Shopify product IDs to translate"),
59
+ targetLanguage: LanguageCodeSchema.describe("Target language for translation"),
60
+ translator: z.string().describe("Translator model to use"),
61
+ });
62
+ /**
63
+ * Product translation result for batch operations (uses different status enum)
64
+ */
65
+ export const ProductTranslationResultSchema = z.object({
66
+ productId: z.string().describe("Shopify product ID"),
67
+ productTitle: z.string().describe("Product title"),
68
+ status: z
69
+ .enum(["success", "failed", "no_images"])
70
+ .describe("Product translation status"),
71
+ imagesTranslated: z.number().describe("Number of images translated"),
72
+ imagesFailed: z.number().describe("Number of images that failed translation"),
73
+ results: z
74
+ .array(z.object({
75
+ mediaId: z.string().describe("Shopify media ID"),
76
+ translatedImage: z.string().describe("Base64-encoded translated image"),
77
+ status: z
78
+ .enum(["success", "error"])
79
+ .describe("Image translation status"),
80
+ error: z.string().optional().describe("Error message if failed"),
81
+ }))
82
+ .describe("Individual image results"),
83
+ error: z.string().optional().describe("Error message if product failed"),
84
+ });
85
+ /**
86
+ * Batch translate output schema
87
+ */
88
+ export const BatchTranslateOutputSchema = z.object({
89
+ totalProducts: z.number().describe("Total number of products processed"),
90
+ successCount: z
91
+ .number()
92
+ .describe("Number of successfully translated products"),
93
+ failureCount: z.number().describe("Number of failed translations"),
94
+ targetLanguage: z.string().describe("Target language used for translation"),
95
+ products: z
96
+ .array(ProductTranslationResultSchema)
97
+ .describe("Array of product translation results"),
98
+ });
99
+ /**
100
+ * Shop stats input schema
101
+ */
102
+ export const ShopStatsInputSchema = z.object({
103
+ shopifyCredentials: ShopifyCredentialsSchema.describe("Shopify shop credentials"),
104
+ });
105
+ /**
106
+ * Shop stats output schema
107
+ */
108
+ export const ShopStatsOutputSchema = z.object({
109
+ shopName: z.string().describe("Shop name"),
110
+ shopDomain: z.string().describe("Shop myshopify domain"),
111
+ totalProducts: z.number().describe("Total number of products in shop"),
112
+ productsWithImages: z
113
+ .number()
114
+ .describe("Number of products with at least one image"),
115
+ totalImages: z
116
+ .number()
117
+ .describe("Total number of images across all products"),
118
+ isPartial: z
119
+ .boolean()
120
+ .optional()
121
+ .describe("Whether the scan was partial due to pagination limits"),
122
+ });
123
+ /**
124
+ * Text region detected in image scan
125
+ */
126
+ export const ScanTextRegionSchema = z.object({
127
+ bounds: z.object({
128
+ x: z.number(),
129
+ y: z.number(),
130
+ width: z.number(),
131
+ height: z.number(),
132
+ }),
133
+ text: z.string(),
134
+ language: z.string(),
135
+ confidence: z.number(),
136
+ });
137
+ /**
138
+ * Individual image scan result
139
+ */
140
+ export const ImageScanResultSchema = z.object({
141
+ mediaId: z.string().describe("Shopify media ID"),
142
+ imageUrl: z.string().describe("Image URL"),
143
+ hasText: z.boolean().describe("Whether text was detected in the image"),
144
+ confidence: z.number().describe("Average confidence of text detection"),
145
+ textRegions: z.array(ScanTextRegionSchema).describe("Detected text regions"),
146
+ });
147
+ /**
148
+ * Product scan result
149
+ */
150
+ export const ProductScanResultSchema = z.object({
151
+ productId: z.string().describe("Shopify product ID"),
152
+ productTitle: z.string().describe("Product title"),
153
+ imagesScanned: z.number().describe("Number of images scanned"),
154
+ imagesWithText: z.number().describe("Number of images with detected text"),
155
+ results: z.array(ImageScanResultSchema).describe("Individual image results"),
156
+ });
157
+ /**
158
+ * Product scan input schema
159
+ */
160
+ export const ProductScanInputSchema = z.object({
161
+ shopifyCredentials: ShopifyCredentialsSchema.describe("Shopify shop credentials"),
162
+ productId: z
163
+ .string()
164
+ .optional()
165
+ .describe("Specific product ID to scan (if not provided, scans multiple)"),
166
+ maxProducts: z
167
+ .number()
168
+ .optional()
169
+ .describe("Maximum number of products to scan (default: 10, max: 50)"),
170
+ });
171
+ /**
172
+ * Product scan output schema
173
+ */
174
+ export const ProductScanOutputSchema = z.object({
175
+ productsScanned: z.number().describe("Number of products scanned"),
176
+ imagesScanned: z.number().describe("Total number of images scanned"),
177
+ imagesWithText: z.number().describe("Number of images with detected text"),
178
+ results: z
179
+ .array(ProductScanResultSchema)
180
+ .describe("Per-product scan results"),
181
+ isPartial: z.boolean().optional().describe("Whether scan was stopped early"),
182
+ stoppedReason: z.string().optional().describe("Reason if scan was stopped"),
183
+ });
@@ -0,0 +1,60 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Text removal input schema
4
+ */
5
+ export declare const TextRemovalInputSchema: z.ZodObject<{
6
+ image: z.ZodEffects<z.ZodEffects<z.ZodObject<{
7
+ url: z.ZodOptional<z.ZodString>;
8
+ base64: z.ZodOptional<z.ZodString>;
9
+ mimeType: z.ZodOptional<z.ZodEnum<["image/jpeg", "image/png", "image/webp", "image/gif"]>>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ url?: string | undefined;
12
+ base64?: string | undefined;
13
+ mimeType?: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | undefined;
14
+ }, {
15
+ url?: string | undefined;
16
+ base64?: string | undefined;
17
+ mimeType?: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | undefined;
18
+ }>, {
19
+ url?: string | undefined;
20
+ base64?: string | undefined;
21
+ mimeType?: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | undefined;
22
+ }, {
23
+ url?: string | undefined;
24
+ base64?: string | undefined;
25
+ mimeType?: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | undefined;
26
+ }>, {
27
+ url?: string | undefined;
28
+ base64?: string | undefined;
29
+ mimeType?: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | undefined;
30
+ }, {
31
+ url?: string | undefined;
32
+ base64?: string | undefined;
33
+ mimeType?: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | undefined;
34
+ }>;
35
+ }, "strip", z.ZodTypeAny, {
36
+ image: {
37
+ url?: string | undefined;
38
+ base64?: string | undefined;
39
+ mimeType?: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | undefined;
40
+ };
41
+ }, {
42
+ image: {
43
+ url?: string | undefined;
44
+ base64?: string | undefined;
45
+ mimeType?: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | undefined;
46
+ };
47
+ }>;
48
+ export type TextRemovalInput = z.infer<typeof TextRemovalInputSchema>;
49
+ /**
50
+ * Text removal output schema
51
+ */
52
+ export declare const TextRemovalOutputSchema: z.ZodObject<{
53
+ cleanedImage: z.ZodString;
54
+ }, "strip", z.ZodTypeAny, {
55
+ cleanedImage: string;
56
+ }, {
57
+ cleanedImage: string;
58
+ }>;
59
+ export type TextRemovalOutput = z.infer<typeof TextRemovalOutputSchema>;
60
+ //# sourceMappingURL=text-removal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-removal.d.ts","sourceRoot":"","sources":["../../../src/schemas/text-removal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;EAIlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ import { ImageInputSchema } from "./common.js";
3
+ /**
4
+ * Text removal input schema
5
+ */
6
+ export const TextRemovalInputSchema = z.object({
7
+ image: ImageInputSchema.describe("Image to remove text from (URL or base64)"),
8
+ });
9
+ /**
10
+ * Text removal output schema
11
+ */
12
+ export const TextRemovalOutputSchema = z.object({
13
+ cleanedImage: z
14
+ .string()
15
+ .describe("Base64-encoded image with text removed/inpainted"),
16
+ });
@@ -0,0 +1,197 @@
1
+ import { z } from "zod";
2
+ export declare const TextRegionSchema: z.ZodObject<{
3
+ x: z.ZodNumber;
4
+ y: z.ZodNumber;
5
+ width: z.ZodNumber;
6
+ height: z.ZodNumber;
7
+ text: z.ZodString;
8
+ originalText: z.ZodString;
9
+ textAlign: z.ZodEnum<["auto", "left", "center", "right"]>;
10
+ strokeColor: z.ZodString;
11
+ lineWidth: z.ZodNumber;
12
+ fillColor: z.ZodString;
13
+ font: z.ZodString;
14
+ addFontBackground: z.ZodBoolean;
15
+ addFontBorder: z.ZodBoolean;
16
+ addBackgroundColor: z.ZodString;
17
+ }, "strip", z.ZodTypeAny, {
18
+ x: number;
19
+ y: number;
20
+ width: number;
21
+ height: number;
22
+ text: string;
23
+ originalText: string;
24
+ textAlign: "auto" | "left" | "center" | "right";
25
+ strokeColor: string;
26
+ lineWidth: number;
27
+ fillColor: string;
28
+ font: string;
29
+ addFontBackground: boolean;
30
+ addFontBorder: boolean;
31
+ addBackgroundColor: string;
32
+ }, {
33
+ x: number;
34
+ y: number;
35
+ width: number;
36
+ height: number;
37
+ text: string;
38
+ originalText: string;
39
+ textAlign: "auto" | "left" | "center" | "right";
40
+ strokeColor: string;
41
+ lineWidth: number;
42
+ fillColor: string;
43
+ font: string;
44
+ addFontBackground: boolean;
45
+ addFontBorder: boolean;
46
+ addBackgroundColor: string;
47
+ }>;
48
+ export type TextRegion = z.infer<typeof TextRegionSchema>;
49
+ /**
50
+ * Translate image input schema
51
+ */
52
+ export declare const TranslateImageInputSchema: z.ZodObject<{
53
+ image: z.ZodEffects<z.ZodEffects<z.ZodObject<{
54
+ url: z.ZodOptional<z.ZodString>;
55
+ base64: z.ZodOptional<z.ZodString>;
56
+ mimeType: z.ZodOptional<z.ZodEnum<["image/jpeg", "image/png", "image/webp", "image/gif"]>>;
57
+ }, "strip", z.ZodTypeAny, {
58
+ url?: string | undefined;
59
+ base64?: string | undefined;
60
+ mimeType?: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | undefined;
61
+ }, {
62
+ url?: string | undefined;
63
+ base64?: string | undefined;
64
+ mimeType?: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | undefined;
65
+ }>, {
66
+ url?: string | undefined;
67
+ base64?: string | undefined;
68
+ mimeType?: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | undefined;
69
+ }, {
70
+ url?: string | undefined;
71
+ base64?: string | undefined;
72
+ mimeType?: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | undefined;
73
+ }>, {
74
+ url?: string | undefined;
75
+ base64?: string | undefined;
76
+ mimeType?: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | undefined;
77
+ }, {
78
+ url?: string | undefined;
79
+ base64?: string | undefined;
80
+ mimeType?: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | undefined;
81
+ }>;
82
+ target_lang: z.ZodString;
83
+ translator: z.ZodEnum<["gemini-2.5-flash", "deepseek", "grok-4-fast", "kimi-k2", "gemini-3-flash", "gpt-5.1"]>;
84
+ font: z.ZodOptional<z.ZodEnum<["NotoSans", "WildWords", "BadComic", "MaShanZheng", "KomikaJam", "Bangers", "Edo", "RIDIBatang", "Bushidoo", "Hayah", "Itim", "Mogul Irina"]>>;
85
+ }, "strip", z.ZodTypeAny, {
86
+ image: {
87
+ url?: string | undefined;
88
+ base64?: string | undefined;
89
+ mimeType?: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | undefined;
90
+ };
91
+ target_lang: string;
92
+ translator: "gemini-2.5-flash" | "deepseek" | "grok-4-fast" | "kimi-k2" | "gemini-3-flash" | "gpt-5.1";
93
+ font?: "NotoSans" | "WildWords" | "BadComic" | "MaShanZheng" | "KomikaJam" | "Bangers" | "Edo" | "RIDIBatang" | "Bushidoo" | "Hayah" | "Itim" | "Mogul Irina" | undefined;
94
+ }, {
95
+ image: {
96
+ url?: string | undefined;
97
+ base64?: string | undefined;
98
+ mimeType?: "image/jpeg" | "image/png" | "image/webp" | "image/gif" | undefined;
99
+ };
100
+ target_lang: string;
101
+ translator: "gemini-2.5-flash" | "deepseek" | "grok-4-fast" | "kimi-k2" | "gemini-3-flash" | "gpt-5.1";
102
+ font?: "NotoSans" | "WildWords" | "BadComic" | "MaShanZheng" | "KomikaJam" | "Bangers" | "Edo" | "RIDIBatang" | "Bushidoo" | "Hayah" | "Itim" | "Mogul Irina" | undefined;
103
+ }>;
104
+ export type TranslateImageInput = z.infer<typeof TranslateImageInputSchema>;
105
+ /**
106
+ * Translate image output schema
107
+ */
108
+ export declare const TranslateImageOutputSchema: z.ZodObject<{
109
+ translatedImage: z.ZodString;
110
+ inpaintedImage: z.ZodString;
111
+ textRegions: z.ZodArray<z.ZodObject<{
112
+ x: z.ZodNumber;
113
+ y: z.ZodNumber;
114
+ width: z.ZodNumber;
115
+ height: z.ZodNumber;
116
+ text: z.ZodString;
117
+ originalText: z.ZodString;
118
+ textAlign: z.ZodEnum<["auto", "left", "center", "right"]>;
119
+ strokeColor: z.ZodString;
120
+ lineWidth: z.ZodNumber;
121
+ fillColor: z.ZodString;
122
+ font: z.ZodString;
123
+ addFontBackground: z.ZodBoolean;
124
+ addFontBorder: z.ZodBoolean;
125
+ addBackgroundColor: z.ZodString;
126
+ }, "strip", z.ZodTypeAny, {
127
+ x: number;
128
+ y: number;
129
+ width: number;
130
+ height: number;
131
+ text: string;
132
+ originalText: string;
133
+ textAlign: "auto" | "left" | "center" | "right";
134
+ strokeColor: string;
135
+ lineWidth: number;
136
+ fillColor: string;
137
+ font: string;
138
+ addFontBackground: boolean;
139
+ addFontBorder: boolean;
140
+ addBackgroundColor: string;
141
+ }, {
142
+ x: number;
143
+ y: number;
144
+ width: number;
145
+ height: number;
146
+ text: string;
147
+ originalText: string;
148
+ textAlign: "auto" | "left" | "center" | "right";
149
+ strokeColor: string;
150
+ lineWidth: number;
151
+ fillColor: string;
152
+ font: string;
153
+ addFontBackground: boolean;
154
+ addFontBorder: boolean;
155
+ addBackgroundColor: string;
156
+ }>, "many">;
157
+ }, "strip", z.ZodTypeAny, {
158
+ translatedImage: string;
159
+ inpaintedImage: string;
160
+ textRegions: {
161
+ x: number;
162
+ y: number;
163
+ width: number;
164
+ height: number;
165
+ text: string;
166
+ originalText: string;
167
+ textAlign: "auto" | "left" | "center" | "right";
168
+ strokeColor: string;
169
+ lineWidth: number;
170
+ fillColor: string;
171
+ font: string;
172
+ addFontBackground: boolean;
173
+ addFontBorder: boolean;
174
+ addBackgroundColor: string;
175
+ }[];
176
+ }, {
177
+ translatedImage: string;
178
+ inpaintedImage: string;
179
+ textRegions: {
180
+ x: number;
181
+ y: number;
182
+ width: number;
183
+ height: number;
184
+ text: string;
185
+ originalText: string;
186
+ textAlign: "auto" | "left" | "center" | "right";
187
+ strokeColor: string;
188
+ lineWidth: number;
189
+ fillColor: string;
190
+ font: string;
191
+ addFontBackground: boolean;
192
+ addFontBorder: boolean;
193
+ addBackgroundColor: string;
194
+ }[];
195
+ }>;
196
+ export type TranslateImageOutput = z.infer<typeof TranslateImageOutputSchema>;
197
+ //# sourceMappingURL=translate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translate.d.ts","sourceRoot":"","sources":["../../../src/schemas/translate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmCxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiB3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
@@ -0,0 +1,70 @@
1
+ import { z } from "zod";
2
+ import { ImageInputSchema, LanguageCodeSchema } from "./common.js";
3
+ /**
4
+ * Translator enum - available translator models
5
+ */
6
+ const TranslatorEnum = z.enum([
7
+ "gemini-2.5-flash",
8
+ "deepseek",
9
+ "grok-4-fast",
10
+ "kimi-k2",
11
+ "gemini-3-flash",
12
+ "gpt-5.1",
13
+ ]);
14
+ /**
15
+ * Font enum - available fonts for text rendering
16
+ */
17
+ const FontEnum = z.enum([
18
+ "NotoSans",
19
+ "WildWords",
20
+ "BadComic",
21
+ "MaShanZheng",
22
+ "KomikaJam",
23
+ "Bangers",
24
+ "Edo",
25
+ "RIDIBatang",
26
+ "Bushidoo",
27
+ "Hayah",
28
+ "Itim",
29
+ "Mogul Irina",
30
+ ]);
31
+ const TextAlignEnum = z.enum(["auto", "left", "center", "right"]);
32
+ export const TextRegionSchema = z.object({
33
+ x: z.number().describe("X coordinate of text region"),
34
+ y: z.number().describe("Y coordinate of text region"),
35
+ width: z.number().describe("Width of text region"),
36
+ height: z.number().describe("Height of text region"),
37
+ text: z.string().describe("Translated text"),
38
+ originalText: z.string().describe("Original text before translation"),
39
+ textAlign: TextAlignEnum.describe("Text alignment"),
40
+ strokeColor: z.string().describe("Stroke color (hex or CSS color)"),
41
+ lineWidth: z.number().describe("Line width for stroke"),
42
+ fillColor: z.string().describe("Fill color (hex or CSS color)"),
43
+ font: z.string().describe("Font name"),
44
+ addFontBackground: z.boolean().describe("Whether to add background to text"),
45
+ addFontBorder: z.boolean().describe("Whether to add border to text"),
46
+ addBackgroundColor: z
47
+ .string()
48
+ .describe("Background color (hex or CSS color)"),
49
+ });
50
+ /**
51
+ * Translate image input schema
52
+ */
53
+ export const TranslateImageInputSchema = z.object({
54
+ image: ImageInputSchema.describe("Image to translate (URL or base64)"),
55
+ target_lang: LanguageCodeSchema.describe("Target language code"),
56
+ translator: TranslatorEnum.describe("Translator model to use for translation"),
57
+ font: FontEnum.optional().describe("Font to use for rendered text"),
58
+ });
59
+ /**
60
+ * Translate image output schema
61
+ */
62
+ export const TranslateImageOutputSchema = z.object({
63
+ translatedImage: z.string().describe("Base64-encoded translated image"),
64
+ inpaintedImage: z
65
+ .string()
66
+ .describe("Base64-encoded inpainted image (text removed)"),
67
+ textRegions: z
68
+ .array(TextRegionSchema)
69
+ .describe("Array of translated text regions with positioning"),
70
+ });
@@ -0,0 +1,4 @@
1
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
2
+ import type { McpServerConfig } from "./utils/config.js";
3
+ export declare function createMcpServer(config: McpServerConfig): Server;
4
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAO/D"}
@@ -0,0 +1,7 @@
1
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
2
+ import { registerAllTools } from "./tools/index.js";
3
+ export function createMcpServer(config) {
4
+ const server = new Server({ name: "@translateimage/mcp-server", version: "1.0.0" }, { capabilities: { tools: {}, logging: {} } });
5
+ registerAllTools(server, config);
6
+ return server;
7
+ }
@@ -0,0 +1,4 @@
1
+ import { McpServerConfig } from "../utils/config.js";
2
+ import { ImageToTextInput, ImageToTextOutput } from "../schemas/image-to-text.js";
3
+ export declare function handleImageToText(input: ImageToTextInput, config: McpServerConfig): Promise<ImageToTextOutput>;
4
+ //# sourceMappingURL=image-to-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-to-text.d.ts","sourceRoot":"","sources":["../../../src/tools/image-to-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AAErC,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,iBAAiB,CAAC,CAW5B"}
@@ -0,0 +1,12 @@
1
+ import { TranslateImageApiClient } from "../utils/api-client.js";
2
+ import { resolveImageInput } from "../utils/image.js";
3
+ export async function handleImageToText(input, config) {
4
+ const client = new TranslateImageApiClient(config);
5
+ const imageBlob = await resolveImageInput(input.image);
6
+ const result = await client.imageToText(imageBlob, input.targetLanguages);
7
+ return {
8
+ extractedText: result.text,
9
+ detectedLanguage: result.languages[0],
10
+ translations: result.translations,
11
+ };
12
+ }
@@ -0,0 +1,8 @@
1
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
2
+ import { McpServerConfig } from "../utils/config.js";
3
+ export declare function registerAllTools(server: Server, config: McpServerConfig): void;
4
+ export { handleTranslateImage } from "./translate.js";
5
+ export { handleOcr } from "./ocr.js";
6
+ export { handleTextRemoval } from "./text-removal.js";
7
+ export { handleImageToText } from "./image-to-text.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAUnE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAmDrD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,QAuLvE;AAED,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}