@labelzoom/mcp 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +157 -3
- package/dist/api.d.ts +58 -0
- package/dist/api.js +78 -0
- package/dist/api.js.map +1 -0
- package/dist/client.d.ts +15 -0
- package/dist/client.js +26 -0
- package/dist/client.js.map +1 -0
- package/dist/formats.d.ts +24 -0
- package/dist/formats.js +81 -0
- package/dist/formats.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/tools.d.ts +79 -0
- package/dist/tools.js +407 -0
- package/dist/tools.js.map +1 -0
- package/package.json +59 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 LabelZoom
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,157 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# LabelZoom MCP server
|
|
2
|
+
|
|
3
|
+
An [MCP](https://modelcontextprotocol.io) server for [LabelZoom](https://www.labelzoom.com). It lets
|
|
4
|
+
Claude and other MCP clients convert barcode labels between formats, render a label to an image and
|
|
5
|
+
look at it, and print labels with LabelZoom Cloud Print. It's published to npm as `@labelzoom/mcp`.
|
|
6
|
+
|
|
7
|
+
Rendering is the part that changes how label work goes: the assistant can check that ZPL produces the
|
|
8
|
+
label you meant, instead of reasoning about the code blind.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
You need Node.js 20 or later.
|
|
13
|
+
|
|
14
|
+
Add the server to Claude Code:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
claude mcp add labelzoom -- npx -y @labelzoom/mcp
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
To convert without a watermark, or to print, give it a LabelZoom API key:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
claude mcp add labelzoom --env LABELZOOM_API_KEY=YOUR_API_KEY -- npx -y @labelzoom/mcp
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
For Claude Desktop and other clients, add this to the client's MCP configuration:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"labelzoom": {
|
|
32
|
+
"command": "npx",
|
|
33
|
+
"args": ["-y", "@labelzoom/mcp"],
|
|
34
|
+
"env": { "LABELZOOM_API_KEY": "YOUR_API_KEY" }
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Configuration
|
|
41
|
+
|
|
42
|
+
| Variable | Default | Description |
|
|
43
|
+
| --- | --- | --- |
|
|
44
|
+
| `LABELZOOM_API_KEY` | None | An API key from the **API Access** section of your [LabelZoom dashboard](https://www.labelzoom.com/dashboard). Printing needs a key with the `print` scope. |
|
|
45
|
+
| `LABELZOOM_API_BASE_URL` | `https://api.labelzoom.com` | The API to call. Change it only if you were given a dedicated endpoint. |
|
|
46
|
+
|
|
47
|
+
Without a key, conversions run on the free tier: output is watermarked and holds only the first label,
|
|
48
|
+
and some conversions, such as JSON output and image to image, need a paid plan. See
|
|
49
|
+
[rate limits and plans](https://docs.labelzoom.com/reference/rate-limits-and-plans/).
|
|
50
|
+
|
|
51
|
+
`LABELZOOM_TOKEN`, the variable name before version 0.2.0, still works when `LABELZOOM_API_KEY` isn't
|
|
52
|
+
set.
|
|
53
|
+
|
|
54
|
+
## Tools
|
|
55
|
+
|
|
56
|
+
| Tool | What it does |
|
|
57
|
+
| --- | --- |
|
|
58
|
+
| `render_label_preview` | Renders a label to a PNG and returns it as an image, so the assistant can see it |
|
|
59
|
+
| `convert_label` | Converts a label between any source and target format |
|
|
60
|
+
| `list_conversion_formats` | Lists the formats, which sources take `sourceDpi`, and whether a key is set |
|
|
61
|
+
| `print_label` | Sends a document to a Cloud Print printer, converting it to the printer's language on the way |
|
|
62
|
+
| `print_template` | Fills a published Print Template with data and prints it, one label per record |
|
|
63
|
+
| `get_print_job` | Looks up a print job to see whether it printed |
|
|
64
|
+
| `get_print_quota` | Shows your plan's printer and daily job limits, and when the daily count resets |
|
|
65
|
+
|
|
66
|
+
### Documents
|
|
67
|
+
|
|
68
|
+
The tools that take a document read it from `content` or from a file at `input_path`:
|
|
69
|
+
|
|
70
|
+
- **Text formats:** pass label code in `content` as is. This covers the printer languages, LabelZoom XML
|
|
71
|
+
and JSON, and DYMO files.
|
|
72
|
+
- **Binary formats:** pass a PDF, an image, or a NiceLabel or BarTender file in `content` as base64, or
|
|
73
|
+
point `input_path` at the file.
|
|
74
|
+
- **The `url` source:** put the URL in `content`, and LabelZoom fetches the document. You can convert a
|
|
75
|
+
URL, but you can't print one.
|
|
76
|
+
|
|
77
|
+
`convert_label` returns text output inline. It writes binary output to `output_path` when you give one,
|
|
78
|
+
and returns it as base64 otherwise. EPL, IPL, TSPL, DPL and SBPL output can contain raw bytes, such as an
|
|
79
|
+
inline bitmap. That output comes back inline only when it has none, and as base64 when it does.
|
|
80
|
+
|
|
81
|
+
### Formats
|
|
82
|
+
|
|
83
|
+
| Kind | Sources | Targets |
|
|
84
|
+
| --- | --- | --- |
|
|
85
|
+
| Printer languages | `zpl` `epl` `ipl` `tspl` `dpl` `sbpl` `cpcl` `esclabel` `fingerprint` `ezpl` `tpcl` | `zpl` `epl` `ipl` `tspl` `dpl` `sbpl` `cpcl` |
|
|
86
|
+
| Label design files | `nlbl` `lbl` (NiceLabel), `btw` (BarTender), `dymo` (DYMO) | None |
|
|
87
|
+
| Documents and images | `pdf` `png` `bmp` `gif` `jpeg` `jpg` | `pdf` `png` `bmp` `gif` `jpeg` |
|
|
88
|
+
| LabelZoom | `xml` `json` | `xml` `json` |
|
|
89
|
+
| Other | `url` | None |
|
|
90
|
+
|
|
91
|
+
### Options
|
|
92
|
+
|
|
93
|
+
Options use the API's own names.
|
|
94
|
+
|
|
95
|
+
| Option | Applies to | What it does |
|
|
96
|
+
| --- | --- | --- |
|
|
97
|
+
| `sourceDpi` | Printer-language and image sources | The resolution the document was made for. The output follows it unless `targetDpi` is set |
|
|
98
|
+
| `targetDpi` | Every target except PDF | The resolution of the output. Match the printer |
|
|
99
|
+
| `labelWidth`, `labelHeight` | Every source | The label size in inches. Leave them unset to use the size the label code declares |
|
|
100
|
+
| `labelIndex` | Multi-label documents | Converts only this label, counting from 0 |
|
|
101
|
+
| `data` | Labels with variable fields | Values for the fields. An array produces one label per entry |
|
|
102
|
+
| `rotation` | Every conversion and print | Rotates the output by a multiple of 90 degrees |
|
|
103
|
+
| `pdfPageNumber`, `pdfConversionMode` | PDF sources | The page, counting from 0, and `IMAGE` or `NATIVE` conversion |
|
|
104
|
+
| `split` | PDF and image sources | Cuts each page into a grid of labels. Lengths are in inches |
|
|
105
|
+
| `scaling`, `darkness`, `colorMode` | PDF and image sources | How the page is scaled and reduced to black and white |
|
|
106
|
+
| `zplCommandsToIgnore` | ZPL and ESC/Label sources | Commands to skip, such as `["^PQ"]` |
|
|
107
|
+
| `zplImageCompression`, `zplCollapseCopies`, `layout` | ZPL targets | Image encoding, collapsing identical labels into a `^PQ` count, and labels side by side on a multi-across roll |
|
|
108
|
+
| `watermark`, `dialect` | Every target | Forces a watermark, or picks an output dialect on a paid plan |
|
|
109
|
+
|
|
110
|
+
A print takes the document options and `rotation`. The printer decides the output format.
|
|
111
|
+
|
|
112
|
+
### Printing
|
|
113
|
+
|
|
114
|
+
Printing needs a printer connected through [LabelZoom Cloud Print](https://www.labelzoom.com/cloud-print)
|
|
115
|
+
and an API key with the `print` scope. Copy the printer's ID from the dashboard.
|
|
116
|
+
|
|
117
|
+
- **Accepted is not printed.** A job starts out `dispatched` or `queued`. Only `completed` means the label
|
|
118
|
+
came out of the printer, so use `get_print_job` to follow it.
|
|
119
|
+
- **Retries are safe.** Every print carries an idempotency key. Pass `idempotency_key`, such as an order
|
|
120
|
+
number, and repeating the print returns the original job instead of printing again. Without one,
|
|
121
|
+
the server generates a key for each call and reuses it if that call is retried.
|
|
122
|
+
- **Copies multiply.** `copies` sends the job 1 to 9999 times. A quantity in the label itself, such as
|
|
123
|
+
`^PQ3`, multiplies with it.
|
|
124
|
+
- **The daily job limit isn't retried.** It resets at midnight UTC, and `get_print_quota` shows when.
|
|
125
|
+
|
|
126
|
+
## Try it
|
|
127
|
+
|
|
128
|
+
> Render this ZPL and tell me if the barcode fits on a 4x6 label.
|
|
129
|
+
>
|
|
130
|
+
> ```
|
|
131
|
+
> ^XA
|
|
132
|
+
> ^FO50,50^A0N,60,60^FDHello LabelZoom^FS
|
|
133
|
+
> ^FO50,150^BY3^BCN,100,Y,N,N^FD12345678^FS
|
|
134
|
+
> ^XZ
|
|
135
|
+
> ```
|
|
136
|
+
|
|
137
|
+
## Contributing
|
|
138
|
+
|
|
139
|
+
The server is built on the [LabelZoom Node.js SDK](https://www.npmjs.com/package/@labelzoom/sdk), which
|
|
140
|
+
handles the API's wire rules and runs the shared LabelZoom conformance suite. The tests here check that
|
|
141
|
+
each tool drives the SDK correctly. They run offline.
|
|
142
|
+
|
|
143
|
+
```sh
|
|
144
|
+
npm install
|
|
145
|
+
npm test # builds, then runs the tool tests
|
|
146
|
+
npm run typecheck
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
`src/tools.ts` registers the tools, `src/client.ts` builds the SDK client from the environment,
|
|
150
|
+
`src/formats.ts` decides how documents travel in a tool call, and `src/index.ts` is the stdio entry point.
|
|
151
|
+
|
|
152
|
+
To release, publish a GitHub Release tagged `vX.Y.Z` that matches `package.json`. The publish workflow
|
|
153
|
+
tests the build and publishes it to npm with provenance.
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
MIT
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin client over the LabelZoom conversion API.
|
|
3
|
+
*
|
|
4
|
+
* Endpoint: POST {base}/api/v2/convert/{sourceFormat}/to/{targetFormat}?params={json}
|
|
5
|
+
* The Content-Type must agree with sourceFormat, and Accept must admit the
|
|
6
|
+
* media type implied by targetFormat, or the server rejects the request before
|
|
7
|
+
* any conversion happens.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SOURCE_FORMATS: readonly ["zpl", "xml", "json", "pdf", "png", "bmp", "gif", "jpeg", "jpg"];
|
|
10
|
+
export declare const TARGET_FORMATS: readonly ["zpl", "xml", "json", "pdf", "png", "bmp", "gif", "jpeg"];
|
|
11
|
+
export type SourceFormat = (typeof SOURCE_FORMATS)[number];
|
|
12
|
+
export type TargetFormat = (typeof TARGET_FORMATS)[number];
|
|
13
|
+
export declare const isTextFormat: (format: string) => boolean;
|
|
14
|
+
export declare const mediaTypeFor: (format: string) => string;
|
|
15
|
+
export interface ConversionParams {
|
|
16
|
+
dpi?: number;
|
|
17
|
+
rotation?: number;
|
|
18
|
+
scaling?: number;
|
|
19
|
+
darkness?: number;
|
|
20
|
+
colorMode?: 'BW' | 'GRAYSCALE' | 'COLOR';
|
|
21
|
+
watermark?: boolean;
|
|
22
|
+
dialect?: string;
|
|
23
|
+
data?: unknown;
|
|
24
|
+
label?: {
|
|
25
|
+
width?: number;
|
|
26
|
+
height?: number;
|
|
27
|
+
};
|
|
28
|
+
pdf?: {
|
|
29
|
+
conversionMode?: 'IMAGE' | 'NATIVE';
|
|
30
|
+
pageNumber?: number;
|
|
31
|
+
};
|
|
32
|
+
zpl?: {
|
|
33
|
+
commandsToIgnore?: string[];
|
|
34
|
+
imageCompression?: 'Z64' | 'COMPRESSED_HEX';
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export interface ConversionResult {
|
|
38
|
+
bytes: Uint8Array;
|
|
39
|
+
contentType: string;
|
|
40
|
+
}
|
|
41
|
+
export declare class LabelZoomError extends Error {
|
|
42
|
+
readonly status: number;
|
|
43
|
+
readonly detail: string;
|
|
44
|
+
constructor(status: number, detail: string);
|
|
45
|
+
}
|
|
46
|
+
export interface ClientOptions {
|
|
47
|
+
baseUrl?: string;
|
|
48
|
+
token?: string;
|
|
49
|
+
fetchImpl?: typeof fetch;
|
|
50
|
+
}
|
|
51
|
+
export declare class LabelZoomClient {
|
|
52
|
+
private readonly baseUrl;
|
|
53
|
+
private readonly token?;
|
|
54
|
+
private readonly fetchImpl;
|
|
55
|
+
constructor(options?: ClientOptions);
|
|
56
|
+
get isAuthenticated(): boolean;
|
|
57
|
+
convert(sourceFormat: SourceFormat, targetFormat: TargetFormat, body: Uint8Array, params?: ConversionParams): Promise<ConversionResult>;
|
|
58
|
+
}
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin client over the LabelZoom conversion API.
|
|
3
|
+
*
|
|
4
|
+
* Endpoint: POST {base}/api/v2/convert/{sourceFormat}/to/{targetFormat}?params={json}
|
|
5
|
+
* The Content-Type must agree with sourceFormat, and Accept must admit the
|
|
6
|
+
* media type implied by targetFormat, or the server rejects the request before
|
|
7
|
+
* any conversion happens.
|
|
8
|
+
*/
|
|
9
|
+
export const SOURCE_FORMATS = ['zpl', 'xml', 'json', 'pdf', 'png', 'bmp', 'gif', 'jpeg', 'jpg'];
|
|
10
|
+
export const TARGET_FORMATS = ['zpl', 'xml', 'json', 'pdf', 'png', 'bmp', 'gif', 'jpeg'];
|
|
11
|
+
const MEDIA_TYPES = {
|
|
12
|
+
xml: 'application/xml',
|
|
13
|
+
json: 'application/json',
|
|
14
|
+
zpl: 'text/plain',
|
|
15
|
+
png: 'image/png',
|
|
16
|
+
bmp: 'image/bmp',
|
|
17
|
+
gif: 'image/gif',
|
|
18
|
+
jpeg: 'image/jpeg',
|
|
19
|
+
jpg: 'image/jpeg',
|
|
20
|
+
pdf: 'application/pdf',
|
|
21
|
+
};
|
|
22
|
+
/** Formats whose payload is human-readable text rather than opaque bytes. */
|
|
23
|
+
const TEXT_FORMATS = new Set(['zpl', 'xml', 'json']);
|
|
24
|
+
export const isTextFormat = (format) => TEXT_FORMATS.has(format.toLowerCase());
|
|
25
|
+
export const mediaTypeFor = (format) => MEDIA_TYPES[format.toLowerCase()] ?? 'application/octet-stream';
|
|
26
|
+
export class LabelZoomError extends Error {
|
|
27
|
+
status;
|
|
28
|
+
detail;
|
|
29
|
+
constructor(status, detail) {
|
|
30
|
+
super(`LabelZoom API returned ${status}: ${detail}`);
|
|
31
|
+
this.status = status;
|
|
32
|
+
this.detail = detail;
|
|
33
|
+
this.name = 'LabelZoomError';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export class LabelZoomClient {
|
|
37
|
+
baseUrl;
|
|
38
|
+
token;
|
|
39
|
+
fetchImpl;
|
|
40
|
+
constructor(options = {}) {
|
|
41
|
+
this.baseUrl = (options.baseUrl ?? 'https://api.labelzoom.net').replace(/\/+$/, '');
|
|
42
|
+
this.token = options.token;
|
|
43
|
+
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
44
|
+
}
|
|
45
|
+
get isAuthenticated() {
|
|
46
|
+
return Boolean(this.token);
|
|
47
|
+
}
|
|
48
|
+
async convert(sourceFormat, targetFormat, body, params = {}) {
|
|
49
|
+
if (body.byteLength === 0) {
|
|
50
|
+
throw new Error('Refusing to send an empty body; the API rejects zero-length requests.');
|
|
51
|
+
}
|
|
52
|
+
const url = new URL(`${this.baseUrl}/api/v2/convert/${sourceFormat}/to/${targetFormat}`);
|
|
53
|
+
if (Object.keys(params).length > 0) {
|
|
54
|
+
url.searchParams.set('params', JSON.stringify(params));
|
|
55
|
+
}
|
|
56
|
+
const headers = {
|
|
57
|
+
'Content-Type': mediaTypeFor(sourceFormat),
|
|
58
|
+
Accept: mediaTypeFor(targetFormat),
|
|
59
|
+
};
|
|
60
|
+
if (this.token) {
|
|
61
|
+
headers.Authorization = `Bearer ${this.token}`;
|
|
62
|
+
}
|
|
63
|
+
const response = await this.fetchImpl(url, {
|
|
64
|
+
method: 'POST',
|
|
65
|
+
headers,
|
|
66
|
+
// Copy into a fresh ArrayBuffer so a pooled Buffer's offset can't leak extra bytes.
|
|
67
|
+
body: body.slice().buffer,
|
|
68
|
+
});
|
|
69
|
+
if (!response.ok) {
|
|
70
|
+
throw new LabelZoomError(response.status, (await response.text()).trim() || response.statusText);
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
bytes: new Uint8Array(await response.arrayBuffer()),
|
|
74
|
+
contentType: response.headers.get('content-type') ?? mediaTypeFor(targetFormat),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|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;QACjD,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE;YACzC,MAAM,EAAE,MAAM;YACd,OAAO;YACP,oFAAoF;YACpF,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,MAAqB;SACzC,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,cAAc,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC;QACnG,CAAC;QAED,OAAO;YACL,KAAK,EAAE,IAAI,UAAU,CAAC,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC;YACnD,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,YAAY,CAAC,YAAY,CAAC;SAChF,CAAC;IACJ,CAAC;CACF"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LabelZoomClient, type LabelZoomClientOptions } from '@labelzoom/sdk';
|
|
2
|
+
/** This package's version, read from package.json so the User-Agent never drifts from it. */
|
|
3
|
+
export declare const VERSION: string;
|
|
4
|
+
/**
|
|
5
|
+
* Build the LabelZoom client from the server's environment.
|
|
6
|
+
*
|
|
7
|
+
* - `LABELZOOM_API_KEY`: an API key or license token. Without one, conversions run on the free
|
|
8
|
+
* tier (watermarked, first label only) and printing is unavailable. `LABELZOOM_TOKEN`, the name
|
|
9
|
+
* used before 0.2.0, is still read when `LABELZOOM_API_KEY` is unset.
|
|
10
|
+
* - `LABELZOOM_API_BASE_URL`: another environment. Defaults to the production API.
|
|
11
|
+
*
|
|
12
|
+
* The SDK identifies itself first in the User-Agent and this server appends its own token, so
|
|
13
|
+
* LabelZoom can tell MCP traffic apart.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createClient(env?: NodeJS.ProcessEnv, overrides?: Partial<LabelZoomClientOptions>): LabelZoomClient;
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { LabelZoomClient } from '@labelzoom/sdk';
|
|
3
|
+
/** This package's version, read from package.json so the User-Agent never drifts from it. */
|
|
4
|
+
export const VERSION = createRequire(import.meta.url)('../package.json').version;
|
|
5
|
+
/**
|
|
6
|
+
* Build the LabelZoom client from the server's environment.
|
|
7
|
+
*
|
|
8
|
+
* - `LABELZOOM_API_KEY`: an API key or license token. Without one, conversions run on the free
|
|
9
|
+
* tier (watermarked, first label only) and printing is unavailable. `LABELZOOM_TOKEN`, the name
|
|
10
|
+
* used before 0.2.0, is still read when `LABELZOOM_API_KEY` is unset.
|
|
11
|
+
* - `LABELZOOM_API_BASE_URL`: another environment. Defaults to the production API.
|
|
12
|
+
*
|
|
13
|
+
* The SDK identifies itself first in the User-Agent and this server appends its own token, so
|
|
14
|
+
* LabelZoom can tell MCP traffic apart.
|
|
15
|
+
*/
|
|
16
|
+
export function createClient(env = process.env, overrides = {}) {
|
|
17
|
+
return new LabelZoomClient({
|
|
18
|
+
// An empty string is passed through on purpose: the SDK reads it as "anonymous" rather than
|
|
19
|
+
// falling back to the environment.
|
|
20
|
+
apiKey: env.LABELZOOM_API_KEY ?? env.LABELZOOM_TOKEN ?? '',
|
|
21
|
+
baseUrl: env.LABELZOOM_API_BASE_URL?.trim() || undefined,
|
|
22
|
+
userAgentSuffix: `labelzoom-mcp/${VERSION}`,
|
|
23
|
+
...overrides,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,eAAe,EAA+B,MAAM,gBAAgB,CAAC;AAE9E,6FAA6F;AAC7F,MAAM,CAAC,MAAM,OAAO,GAAY,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,iBAAiB,CAAyB,CAAC,OAAO,CAAC;AAElH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAC1B,MAAyB,OAAO,CAAC,GAAG,EACpC,YAA6C,EAAE;IAE/C,OAAO,IAAI,eAAe,CAAC;QACzB,4FAA4F;QAC5F,mCAAmC;QACnC,MAAM,EAAE,GAAG,CAAC,iBAAiB,IAAI,GAAG,CAAC,eAAe,IAAI,EAAE;QAC1D,OAAO,EAAE,GAAG,CAAC,sBAAsB,EAAE,IAAI,EAAE,IAAI,SAAS;QACxD,eAAe,EAAE,iBAAiB,OAAO,EAAE;QAC3C,GAAG,SAAS;KACb,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How this server moves documents in and out of tool calls.
|
|
3
|
+
*
|
|
4
|
+
* The format list itself comes from `@labelzoom/sdk`, which owns the wire contract. What is
|
|
5
|
+
* decided here is MCP-specific: a tool call carries text, so binary documents travel as base64,
|
|
6
|
+
* and output is shown inline only when doing so cannot change a byte.
|
|
7
|
+
*/
|
|
8
|
+
import { SOURCE_FORMATS, TARGET_FORMATS, type SourceFormat, type TargetFormat } from '@labelzoom/sdk';
|
|
9
|
+
export { SOURCE_FORMATS, TARGET_FORMATS, type SourceFormat, type TargetFormat };
|
|
10
|
+
/** Print takes every source except a URL: print sends the document itself and never fetches. */
|
|
11
|
+
export declare const PRINT_SOURCE_FORMATS: ("zpl" | "epl" | "ipl" | "tspl" | "dpl" | "sbpl" | "esclabel" | "fingerprint" | "ezpl" | "cpcl" | "tpcl" | "nlbl" | "lbl" | "btw" | "dymo" | "xml" | "json" | "pdf" | "png" | "bmp" | "gif" | "jpeg" | "jpg")[];
|
|
12
|
+
export declare const isBinarySource: (format: SourceFormat) => boolean;
|
|
13
|
+
export declare const isTextTarget: (format: TargetFormat) => boolean;
|
|
14
|
+
/** Sources that accept `sourceDpi`: the printer languages and images. */
|
|
15
|
+
export declare const SOURCE_DPI_SOURCES: Set<SourceFormat>;
|
|
16
|
+
/**
|
|
17
|
+
* The output as text, or `undefined` when showing it as text could alter it.
|
|
18
|
+
*
|
|
19
|
+
* Text targets always decode. A printer-language target decodes only when every byte is valid
|
|
20
|
+
* UTF-8 and the only control characters are tab, line feed and carriage return; anything else
|
|
21
|
+
* goes out as base64, so a label with an inline bitmap is never corrupted on the way to the user.
|
|
22
|
+
*/
|
|
23
|
+
export declare function outputText(target: TargetFormat, bytes: Uint8Array): string | undefined;
|
|
24
|
+
export declare const formatLabel: (format: string) => string;
|
package/dist/formats.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How this server moves documents in and out of tool calls.
|
|
3
|
+
*
|
|
4
|
+
* The format list itself comes from `@labelzoom/sdk`, which owns the wire contract. What is
|
|
5
|
+
* decided here is MCP-specific: a tool call carries text, so binary documents travel as base64,
|
|
6
|
+
* and output is shown inline only when doing so cannot change a byte.
|
|
7
|
+
*/
|
|
8
|
+
import { SOURCE_FORMATS, TARGET_FORMATS } from '@labelzoom/sdk';
|
|
9
|
+
export { SOURCE_FORMATS, TARGET_FORMATS };
|
|
10
|
+
/** Print takes every source except a URL: print sends the document itself and never fetches. */
|
|
11
|
+
export const PRINT_SOURCE_FORMATS = SOURCE_FORMATS.filter((format) => format !== 'url');
|
|
12
|
+
/**
|
|
13
|
+
* Sources whose files are binary, so inline `content` for them is base64. Every other source is
|
|
14
|
+
* text: printer code, LabelZoom XML or JSON, a DYMO file (XML), or a URL.
|
|
15
|
+
*/
|
|
16
|
+
const BINARY_SOURCES = new Set(['pdf', 'png', 'bmp', 'gif', 'jpeg', 'jpg', 'nlbl', 'lbl', 'btw']);
|
|
17
|
+
export const isBinarySource = (format) => BINARY_SOURCES.has(format);
|
|
18
|
+
/** Targets that are always text. CPCL writes its graphics as hex, so it is one of them. */
|
|
19
|
+
const TEXT_TARGETS = new Set(['zpl', 'cpcl', 'xml', 'json']);
|
|
20
|
+
/**
|
|
21
|
+
* Printer languages that come back as `text/plain` but can carry raw bytes: EPL's `GW` and
|
|
22
|
+
* TSPL's `BITMAP` inline a bitmap, IPL frames commands in STX/ETX, DPL starts with STX, and SBPL
|
|
23
|
+
* prefixes every command with ESC. They are shown inline only when the output has none of that.
|
|
24
|
+
*/
|
|
25
|
+
const MAYBE_BINARY_TARGETS = new Set(['epl', 'ipl', 'tspl', 'dpl', 'sbpl']);
|
|
26
|
+
export const isTextTarget = (format) => TEXT_TARGETS.has(format);
|
|
27
|
+
/** Sources that accept `sourceDpi`: the printer languages and images. */
|
|
28
|
+
export const SOURCE_DPI_SOURCES = new Set([
|
|
29
|
+
'zpl', 'epl', 'ipl', 'tspl', 'dpl', 'sbpl', 'esclabel', 'fingerprint', 'ezpl', 'cpcl', 'tpcl',
|
|
30
|
+
'png', 'bmp', 'gif', 'jpeg', 'jpg',
|
|
31
|
+
]);
|
|
32
|
+
/**
|
|
33
|
+
* The output as text, or `undefined` when showing it as text could alter it.
|
|
34
|
+
*
|
|
35
|
+
* Text targets always decode. A printer-language target decodes only when every byte is valid
|
|
36
|
+
* UTF-8 and the only control characters are tab, line feed and carriage return; anything else
|
|
37
|
+
* goes out as base64, so a label with an inline bitmap is never corrupted on the way to the user.
|
|
38
|
+
*/
|
|
39
|
+
export function outputText(target, bytes) {
|
|
40
|
+
if (TEXT_TARGETS.has(target))
|
|
41
|
+
return new TextDecoder().decode(bytes);
|
|
42
|
+
if (!MAYBE_BINARY_TARGETS.has(target))
|
|
43
|
+
return undefined;
|
|
44
|
+
let text;
|
|
45
|
+
try {
|
|
46
|
+
text = new TextDecoder('utf-8', { fatal: true }).decode(bytes);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
// eslint-disable-next-line no-control-regex
|
|
52
|
+
return /[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/.test(text) ? undefined : text;
|
|
53
|
+
}
|
|
54
|
+
const FORMAT_LABELS = {
|
|
55
|
+
zpl: 'ZPL (Zebra)',
|
|
56
|
+
epl: 'EPL (Eltron, Zebra)',
|
|
57
|
+
ipl: 'IPL (Intermec, Honeywell)',
|
|
58
|
+
tspl: 'TSPL (TSC)',
|
|
59
|
+
dpl: 'DPL (Datamax-O\'Neil, Honeywell)',
|
|
60
|
+
sbpl: 'SBPL (SATO)',
|
|
61
|
+
cpcl: 'CPCL (Zebra mobile printers)',
|
|
62
|
+
esclabel: 'ESC/Label (Epson ColorWorks)',
|
|
63
|
+
fingerprint: 'Fingerprint and Direct Protocol (Honeywell)',
|
|
64
|
+
ezpl: 'EZPL (GoDEX)',
|
|
65
|
+
tpcl: 'TPCL (Toshiba TEC)',
|
|
66
|
+
nlbl: 'NiceLabel or ZebraDesigner 3 design file (.nlbl)',
|
|
67
|
+
lbl: 'NiceLabel design file (.lbl)',
|
|
68
|
+
btw: 'BarTender design file (.btw, .btc)',
|
|
69
|
+
dymo: 'DYMO design file (.label, .dymo)',
|
|
70
|
+
xml: 'LabelZoom XML',
|
|
71
|
+
json: 'LabelZoom JSON',
|
|
72
|
+
pdf: 'PDF',
|
|
73
|
+
png: 'PNG',
|
|
74
|
+
bmp: 'BMP',
|
|
75
|
+
gif: 'GIF',
|
|
76
|
+
jpeg: 'JPEG',
|
|
77
|
+
jpg: 'JPEG (jpg spelling)',
|
|
78
|
+
url: 'A URL that LabelZoom fetches',
|
|
79
|
+
};
|
|
80
|
+
export const formatLabel = (format) => FORMAT_LABELS[format] ?? format.toUpperCase();
|
|
81
|
+
//# sourceMappingURL=formats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formats.js","sourceRoot":"","sources":["../src/formats.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,cAAc,EAAE,cAAc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AW,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
+
import { VERSION, createClient } from './client.js';
|
|
5
|
+
import { registerTools } from './tools.js';
|
|
6
|
+
const server = new McpServer({ name: 'labelzoom', version: VERSION });
|
|
7
|
+
registerTools(server, createClient());
|
|
8
|
+
async function main() {
|
|
9
|
+
await server.connect(new StdioServerTransport());
|
|
10
|
+
}
|
|
11
|
+
main().catch((err) => {
|
|
12
|
+
// stdout carries the protocol; diagnostics must go to stderr.
|
|
13
|
+
console.error('labelzoom-mcp failed to start:', err);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;AAEtE,aAAa,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;AAEtC,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;AACnD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC5B,8DAA8D;IAC9D,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAC;IACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import { type ConversionOptions, type LabelZoomClient, type PrintOptions } from '@labelzoom/sdk';
|
|
4
|
+
type Content = {
|
|
5
|
+
type: 'text';
|
|
6
|
+
text: string;
|
|
7
|
+
} | {
|
|
8
|
+
type: 'image';
|
|
9
|
+
data: string;
|
|
10
|
+
mimeType: string;
|
|
11
|
+
};
|
|
12
|
+
type ToolResult = {
|
|
13
|
+
content: Content[];
|
|
14
|
+
isError?: boolean;
|
|
15
|
+
};
|
|
16
|
+
/** How the document is read. Every tool that takes a document takes these. */
|
|
17
|
+
declare const sourceOptionsShape: {
|
|
18
|
+
sourceDpi: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
labelWidth: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
labelHeight: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
labelIndex: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
data: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
23
|
+
pdfPageNumber: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
pdfConversionMode: z.ZodOptional<z.ZodEnum<{
|
|
25
|
+
IMAGE: "IMAGE";
|
|
26
|
+
NATIVE: "NATIVE";
|
|
27
|
+
}>>;
|
|
28
|
+
zplCommandsToIgnore: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
29
|
+
scaling: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
darkness: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
colorMode: z.ZodOptional<z.ZodEnum<{
|
|
32
|
+
BW: "BW";
|
|
33
|
+
GRAYSCALE: "GRAYSCALE";
|
|
34
|
+
COLOR: "COLOR";
|
|
35
|
+
}>>;
|
|
36
|
+
split: z.ZodOptional<z.ZodObject<{
|
|
37
|
+
rows: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
columns: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
left: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
top: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
columnGap: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
rowGap: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
skipBlank: z.ZodOptional<z.ZodBoolean>;
|
|
46
|
+
}, z.core.$strip>>;
|
|
47
|
+
rotation: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
};
|
|
49
|
+
/** What is written. Convert and preview take these; a print's output is set by the printer. */
|
|
50
|
+
declare const targetOptionsShape: {
|
|
51
|
+
targetDpi: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
zplImageCompression: z.ZodOptional<z.ZodEnum<{
|
|
53
|
+
Z64: "Z64";
|
|
54
|
+
COMPRESSED_HEX: "COMPRESSED_HEX";
|
|
55
|
+
}>>;
|
|
56
|
+
zplCollapseCopies: z.ZodOptional<z.ZodBoolean>;
|
|
57
|
+
layout: z.ZodOptional<z.ZodObject<{
|
|
58
|
+
across: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
gap: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
fill: z.ZodOptional<z.ZodEnum<{
|
|
61
|
+
SEQUENTIAL: "SEQUENTIAL";
|
|
62
|
+
REPEAT: "REPEAT";
|
|
63
|
+
}>>;
|
|
64
|
+
}, z.core.$strip>>;
|
|
65
|
+
watermark: z.ZodOptional<z.ZodBoolean>;
|
|
66
|
+
dialect: z.ZodOptional<z.ZodString>;
|
|
67
|
+
};
|
|
68
|
+
type SourceOptionArgs = {
|
|
69
|
+
[K in keyof typeof sourceOptionsShape]?: z.infer<(typeof sourceOptionsShape)[K]>;
|
|
70
|
+
};
|
|
71
|
+
type TargetOptionArgs = {
|
|
72
|
+
[K in keyof typeof targetOptionsShape]?: z.infer<(typeof targetOptionsShape)[K]>;
|
|
73
|
+
};
|
|
74
|
+
/** Map tool arguments to the API's option object. Only what the caller set is included. */
|
|
75
|
+
export declare function printOptions(args: SourceOptionArgs): PrintOptions;
|
|
76
|
+
export declare function conversionOptions(args: SourceOptionArgs & TargetOptionArgs): ConversionOptions;
|
|
77
|
+
export declare function errorResult(error: unknown): ToolResult;
|
|
78
|
+
export declare function registerTools(server: McpServer, client: LabelZoomClient): void;
|
|
79
|
+
export {};
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { LabelZoomError, LabelZoomValidationError, PrintQuotaExceededError, } from '@labelzoom/sdk';
|
|
4
|
+
import { PRINT_SOURCE_FORMATS, SOURCE_DPI_SOURCES, SOURCE_FORMATS, TARGET_FORMATS, formatLabel, isBinarySource, isTextTarget, outputText, } from './formats.js';
|
|
5
|
+
const text = (value) => ({ type: 'text', text: value });
|
|
6
|
+
const base64 = (bytes) => Buffer.from(bytes).toString('base64');
|
|
7
|
+
// --- Options ------------------------------------------------------------------------------------
|
|
8
|
+
//
|
|
9
|
+
// Named as the API names them, so an option reads the same here, in the SDKs and in the docs.
|
|
10
|
+
// The SDK serializes them and checks what it can locally; which formats take which option is the
|
|
11
|
+
// server's call, and its error message comes back through the tool result.
|
|
12
|
+
const record = z.record(z.string(), z.unknown());
|
|
13
|
+
/** How the document is read. Every tool that takes a document takes these. */
|
|
14
|
+
const sourceOptionsShape = {
|
|
15
|
+
sourceDpi: z.number().int().positive().optional()
|
|
16
|
+
.describe('The resolution the label code or image was made for, in dots per inch. Printer languages and images only. The output follows it unless targetDpi is set.'),
|
|
17
|
+
labelWidth: z.number().positive().optional()
|
|
18
|
+
.describe('Label width in inches. Leave unset to use the size the label code declares, or else the size of its content.'),
|
|
19
|
+
labelHeight: z.number().positive().optional()
|
|
20
|
+
.describe('Label height in inches. Leave unset to use the size the label code declares, or else the size of its content.'),
|
|
21
|
+
labelIndex: z.number().int().min(0).optional()
|
|
22
|
+
.describe('Convert only this label of a multi-label document, counting from 0.'),
|
|
23
|
+
data: z.union([record, z.array(record)]).optional()
|
|
24
|
+
.describe('Values for the label\'s variable fields. An array produces one label per entry.'),
|
|
25
|
+
pdfPageNumber: z.number().int().min(0).optional()
|
|
26
|
+
.describe('PDF sources: the page to convert, counting from 0. Omit to convert every page.'),
|
|
27
|
+
pdfConversionMode: z.enum(['IMAGE', 'NATIVE']).optional()
|
|
28
|
+
.describe('PDF sources: IMAGE (the default) rasterizes each page; NATIVE extracts text and vector content.'),
|
|
29
|
+
zplCommandsToIgnore: z.array(z.string()).optional()
|
|
30
|
+
.describe('ZPL and ESC/Label sources: commands to skip, such as ["^PQ"].'),
|
|
31
|
+
scaling: z.number().positive().optional()
|
|
32
|
+
.describe('PDF and image sources: scale percentage. 100 is no scaling.'),
|
|
33
|
+
darkness: z.number().min(0).max(100).optional()
|
|
34
|
+
.describe('Luminance threshold, 0 to 100, used when reducing color to black and white. Raise it to darken thin lines.'),
|
|
35
|
+
colorMode: z.enum(['BW', 'GRAYSCALE', 'COLOR']).optional()
|
|
36
|
+
.describe('How color is reduced. GRAYSCALE (the default) dithers to simulate gray.'),
|
|
37
|
+
split: z.object({
|
|
38
|
+
rows: z.number().int().min(1).max(20).optional(),
|
|
39
|
+
columns: z.number().int().min(1).max(20).optional(),
|
|
40
|
+
width: z.number().positive().optional(),
|
|
41
|
+
height: z.number().positive().optional(),
|
|
42
|
+
left: z.number().min(0).optional(),
|
|
43
|
+
top: z.number().min(0).optional(),
|
|
44
|
+
columnGap: z.number().min(0).optional(),
|
|
45
|
+
rowGap: z.number().min(0).optional(),
|
|
46
|
+
skipBlank: z.boolean().optional(),
|
|
47
|
+
}).optional()
|
|
48
|
+
.describe('PDF and image sources: cut each page into a grid of labels, such as a sheet of address labels. Lengths are in inches; leave width and height unset to divide the page equally.'),
|
|
49
|
+
rotation: z.number().int().optional()
|
|
50
|
+
.describe('Rotate the output, in degrees. A multiple of 90.'),
|
|
51
|
+
};
|
|
52
|
+
/** What is written. Convert and preview take these; a print's output is set by the printer. */
|
|
53
|
+
const targetOptionsShape = {
|
|
54
|
+
targetDpi: z.number().int().positive().optional()
|
|
55
|
+
.describe('The resolution of the output, in dots per inch. Match the printer. Every target except PDF.'),
|
|
56
|
+
zplImageCompression: z.enum(['Z64', 'COMPRESSED_HEX']).optional()
|
|
57
|
+
.describe('ZPL targets: how images are encoded. COMPRESSED_HEX suits older firmware.'),
|
|
58
|
+
zplCollapseCopies: z.boolean().optional()
|
|
59
|
+
.describe('ZPL targets from a PDF or image: write each run of identical labels as one label with a ^PQ count.'),
|
|
60
|
+
layout: z.object({
|
|
61
|
+
across: z.number().int().min(1).max(10).optional(),
|
|
62
|
+
gap: z.number().min(0).optional(),
|
|
63
|
+
fill: z.enum(['SEQUENTIAL', 'REPEAT']).optional(),
|
|
64
|
+
}).optional()
|
|
65
|
+
.describe('ZPL targets from a PDF or image: labels side by side on a multi-across roll. gap is in inches.'),
|
|
66
|
+
watermark: z.boolean().optional().describe('Force a watermark on the output.'),
|
|
67
|
+
dialect: z.string().optional().describe('Output dialect, such as "moca". Requires a paid plan.'),
|
|
68
|
+
};
|
|
69
|
+
/** Map tool arguments to the API's option object. Only what the caller set is included. */
|
|
70
|
+
export function printOptions(args) {
|
|
71
|
+
const options = {};
|
|
72
|
+
if (args.sourceDpi !== undefined)
|
|
73
|
+
options.sourceDpi = args.sourceDpi;
|
|
74
|
+
if (args.labelWidth !== undefined || args.labelHeight !== undefined) {
|
|
75
|
+
options.label = {
|
|
76
|
+
...(args.labelWidth !== undefined ? { width: args.labelWidth } : {}),
|
|
77
|
+
...(args.labelHeight !== undefined ? { height: args.labelHeight } : {}),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
if (args.labelIndex !== undefined)
|
|
81
|
+
options.labelIndex = args.labelIndex;
|
|
82
|
+
if (args.data !== undefined)
|
|
83
|
+
options.data = args.data;
|
|
84
|
+
if (args.pdfPageNumber !== undefined || args.pdfConversionMode !== undefined) {
|
|
85
|
+
options.pdf = {
|
|
86
|
+
...(args.pdfPageNumber !== undefined ? { pageNumber: args.pdfPageNumber } : {}),
|
|
87
|
+
...(args.pdfConversionMode !== undefined ? { conversionMode: args.pdfConversionMode } : {}),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
if (args.zplCommandsToIgnore !== undefined)
|
|
91
|
+
options.zpl = { commandsToIgnore: args.zplCommandsToIgnore };
|
|
92
|
+
if (args.scaling !== undefined)
|
|
93
|
+
options.scaling = args.scaling;
|
|
94
|
+
if (args.darkness !== undefined)
|
|
95
|
+
options.darkness = args.darkness;
|
|
96
|
+
if (args.colorMode !== undefined)
|
|
97
|
+
options.colorMode = args.colorMode;
|
|
98
|
+
if (args.split !== undefined)
|
|
99
|
+
options.split = args.split;
|
|
100
|
+
if (args.rotation !== undefined)
|
|
101
|
+
options.rotation = args.rotation;
|
|
102
|
+
return options;
|
|
103
|
+
}
|
|
104
|
+
export function conversionOptions(args) {
|
|
105
|
+
const options = { ...printOptions(args) };
|
|
106
|
+
if (args.targetDpi !== undefined)
|
|
107
|
+
options.targetDpi = args.targetDpi;
|
|
108
|
+
if (args.zplImageCompression !== undefined || args.zplCollapseCopies !== undefined) {
|
|
109
|
+
options.zpl = {
|
|
110
|
+
...options.zpl,
|
|
111
|
+
...(args.zplImageCompression !== undefined ? { imageCompression: args.zplImageCompression } : {}),
|
|
112
|
+
...(args.zplCollapseCopies !== undefined ? { collapseCopies: args.zplCollapseCopies } : {}),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (args.layout !== undefined)
|
|
116
|
+
options.layout = args.layout;
|
|
117
|
+
if (args.watermark !== undefined)
|
|
118
|
+
options.watermark = args.watermark;
|
|
119
|
+
if (args.dialect !== undefined)
|
|
120
|
+
options.dialect = args.dialect;
|
|
121
|
+
return options;
|
|
122
|
+
}
|
|
123
|
+
// --- Documents ----------------------------------------------------------------------------------
|
|
124
|
+
const documentShape = {
|
|
125
|
+
content: z.string().optional()
|
|
126
|
+
.describe('The document inline: label code as text, or base64 for a PDF, an image, or a NiceLabel or BarTender file. For the url source, the URL.'),
|
|
127
|
+
input_path: z.string().optional().describe('A file to read the document from, instead of content.'),
|
|
128
|
+
};
|
|
129
|
+
function requireOneInput(content, inputPath) {
|
|
130
|
+
if ((content === undefined) === (inputPath === undefined)) {
|
|
131
|
+
throw new LabelZoomValidationError('body', 'Provide exactly one of `content` or `input_path`.');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* The document for a conversion. Inline content for a binary source is sent as base64 text,
|
|
136
|
+
* which the API decodes; a file is sent as its own bytes.
|
|
137
|
+
*/
|
|
138
|
+
async function conversionDocument(source, content, inputPath) {
|
|
139
|
+
requireOneInput(content, inputPath);
|
|
140
|
+
if (inputPath !== undefined)
|
|
141
|
+
return { body: new Uint8Array(await readFile(inputPath)), asBase64Text: false };
|
|
142
|
+
return { body: content, asBase64Text: isBinarySource(source) };
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The document for a print. Print reads the body as the file itself, so inline base64 is decoded
|
|
146
|
+
* here: sent as base64 text, it would reach the printer as base64 characters.
|
|
147
|
+
*/
|
|
148
|
+
async function printDocument(source, content, inputPath) {
|
|
149
|
+
requireOneInput(content, inputPath);
|
|
150
|
+
if (inputPath !== undefined)
|
|
151
|
+
return new Uint8Array(await readFile(inputPath));
|
|
152
|
+
if (!isBinarySource(source))
|
|
153
|
+
return content;
|
|
154
|
+
const compact = content.replace(/\s+/g, '');
|
|
155
|
+
if (!/^[A-Za-z0-9+/]*={0,2}$/.test(compact) || compact.length % 4 === 1) {
|
|
156
|
+
throw new LabelZoomValidationError('body', `Inline content for a ${source} document must be base64.`);
|
|
157
|
+
}
|
|
158
|
+
return new Uint8Array(Buffer.from(compact, 'base64'));
|
|
159
|
+
}
|
|
160
|
+
// --- Results and errors -------------------------------------------------------------------------
|
|
161
|
+
export function errorResult(error) {
|
|
162
|
+
if (error instanceof LabelZoomValidationError) {
|
|
163
|
+
return { content: [text(`Invalid ${error.parameter}: ${error.message}`)], isError: true };
|
|
164
|
+
}
|
|
165
|
+
if (error instanceof LabelZoomError) {
|
|
166
|
+
const lines = [
|
|
167
|
+
`LabelZoom returned HTTP ${error.status}${error.code !== null ? ` (${error.code})` : ''}: ${error.message}`,
|
|
168
|
+
];
|
|
169
|
+
if (error instanceof PrintQuotaExceededError) {
|
|
170
|
+
lines.push('The daily print job limit is reached. It resets at midnight UTC; get_print_quota shows the reset time.');
|
|
171
|
+
}
|
|
172
|
+
else if (error.status === 401) {
|
|
173
|
+
lines.push('Set LABELZOOM_API_KEY to a LabelZoom API key. Printing needs a key with the print scope.');
|
|
174
|
+
}
|
|
175
|
+
else if (error.status === 403 && /paid/i.test(error.message)) {
|
|
176
|
+
lines.push('This conversion needs a paid LabelZoom plan.');
|
|
177
|
+
}
|
|
178
|
+
if (error.requestId !== undefined)
|
|
179
|
+
lines.push(`Request ID: ${error.requestId} (quote it to LabelZoom support).`);
|
|
180
|
+
return { content: [text(lines.join('\n'))], isError: true };
|
|
181
|
+
}
|
|
182
|
+
// fetch rejects with a TypeError when the request never got a response: DNS, a refused
|
|
183
|
+
// connection, TLS. The SDK has already retried it by the time it lands here.
|
|
184
|
+
if (error instanceof TypeError) {
|
|
185
|
+
return {
|
|
186
|
+
content: [text(`Could not reach the LabelZoom API: ${error.message}. Check the network, and LABELZOOM_API_BASE_URL if it is set.`)],
|
|
187
|
+
isError: true,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
return { content: [text(error instanceof Error ? error.message : String(error))], isError: true };
|
|
191
|
+
}
|
|
192
|
+
const json = (value) => ({ content: [text(JSON.stringify(value, null, 2))] });
|
|
193
|
+
function requireKey(client) {
|
|
194
|
+
if (!client.isAuthenticated) {
|
|
195
|
+
throw new Error('Printing needs a LabelZoom API key with the print scope. Set LABELZOOM_API_KEY in this server\'s environment.');
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
const WATERMARK_NOTE = 'Converted without a LabelZoom API key, so the output carries a watermark and holds only the first label.';
|
|
199
|
+
// --- Tools --------------------------------------------------------------------------------------
|
|
200
|
+
export function registerTools(server, client) {
|
|
201
|
+
server.registerTool('convert_label', {
|
|
202
|
+
title: 'Convert a label between formats',
|
|
203
|
+
description: 'Convert a barcode label between formats: printer languages (ZPL, EPL, IPL, TSPL, DPL, SBPL, CPCL, ' +
|
|
204
|
+
'and read-only ESC/Label, Fingerprint, EZPL and TPCL), NiceLabel, BarTender and DYMO design files ' +
|
|
205
|
+
'(read-only), PDF, PNG, BMP, GIF, JPEG, and LabelZoom XML and JSON. Text output is returned inline; ' +
|
|
206
|
+
'binary output is written to output_path when given and returned as base64 otherwise. To look at a ' +
|
|
207
|
+
'label, use render_label_preview.',
|
|
208
|
+
inputSchema: {
|
|
209
|
+
source_format: z.enum(SOURCE_FORMATS).describe('Format of the input.'),
|
|
210
|
+
target_format: z.enum(TARGET_FORMATS).describe('Format to convert to.'),
|
|
211
|
+
...documentShape,
|
|
212
|
+
output_path: z.string().optional()
|
|
213
|
+
.describe('Where to write the result. Use it for large or binary output.'),
|
|
214
|
+
...sourceOptionsShape,
|
|
215
|
+
...targetOptionsShape,
|
|
216
|
+
},
|
|
217
|
+
}, async (args) => {
|
|
218
|
+
try {
|
|
219
|
+
const source = args.source_format;
|
|
220
|
+
const target = args.target_format;
|
|
221
|
+
const document = await conversionDocument(source, args.content, args.input_path);
|
|
222
|
+
const result = await client.convert({
|
|
223
|
+
from: source,
|
|
224
|
+
to: target,
|
|
225
|
+
body: document.body,
|
|
226
|
+
asBase64Text: document.asBase64Text,
|
|
227
|
+
options: conversionOptions(args),
|
|
228
|
+
});
|
|
229
|
+
const content = [];
|
|
230
|
+
if (args.output_path !== undefined) {
|
|
231
|
+
await writeFile(args.output_path, result.bytes);
|
|
232
|
+
const kb = (result.bytes.byteLength / 1024).toFixed(1);
|
|
233
|
+
content.push(text(`Wrote ${kb} KB of ${target.toUpperCase()} to ${args.output_path}.`));
|
|
234
|
+
}
|
|
235
|
+
else if (target === 'png') {
|
|
236
|
+
content.push({ type: 'image', data: base64(result.bytes), mimeType: 'image/png' });
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
const decoded = outputText(target, result.bytes);
|
|
240
|
+
content.push(text(decoded ??
|
|
241
|
+
`${target.toUpperCase()} output, base64-encoded${isTextTarget(target) ? '' : ' because it holds raw bytes'}:\n\n${base64(result.bytes)}`));
|
|
242
|
+
}
|
|
243
|
+
if (!client.isAuthenticated)
|
|
244
|
+
content.push(text(WATERMARK_NOTE));
|
|
245
|
+
return { content };
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
return errorResult(error);
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
server.registerTool('render_label_preview', {
|
|
252
|
+
title: 'Render a label to a viewable image',
|
|
253
|
+
description: 'Render a label to a PNG image so it can be looked at directly. Use this to check that label code ' +
|
|
254
|
+
'produces the intended label (element placement, barcodes, text overflow) instead of reasoning ' +
|
|
255
|
+
'about the source alone. Takes any source format convert_label takes.',
|
|
256
|
+
inputSchema: {
|
|
257
|
+
source_format: z.enum(SOURCE_FORMATS).describe('Format of the input.'),
|
|
258
|
+
...documentShape,
|
|
259
|
+
save_to: z.string().optional().describe('Also write the PNG to this path.'),
|
|
260
|
+
...sourceOptionsShape,
|
|
261
|
+
targetDpi: targetOptionsShape.targetDpi,
|
|
262
|
+
},
|
|
263
|
+
}, async (args) => {
|
|
264
|
+
try {
|
|
265
|
+
const source = args.source_format;
|
|
266
|
+
const document = await conversionDocument(source, args.content, args.input_path);
|
|
267
|
+
const result = await client.convert({
|
|
268
|
+
from: source,
|
|
269
|
+
to: 'png',
|
|
270
|
+
body: document.body,
|
|
271
|
+
asBase64Text: document.asBase64Text,
|
|
272
|
+
options: conversionOptions(args),
|
|
273
|
+
});
|
|
274
|
+
const content = [{ type: 'image', data: base64(result.bytes), mimeType: 'image/png' }];
|
|
275
|
+
if (args.save_to !== undefined) {
|
|
276
|
+
await writeFile(args.save_to, result.bytes);
|
|
277
|
+
content.push(text(`Also saved to ${args.save_to}.`));
|
|
278
|
+
}
|
|
279
|
+
if (!client.isAuthenticated)
|
|
280
|
+
content.push(text(WATERMARK_NOTE));
|
|
281
|
+
return { content };
|
|
282
|
+
}
|
|
283
|
+
catch (error) {
|
|
284
|
+
return errorResult(error);
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
server.registerTool('list_conversion_formats', {
|
|
288
|
+
title: 'List supported label formats',
|
|
289
|
+
description: 'List the formats LabelZoom converts from and to, which sources take sourceDpi, and whether an API ' +
|
|
290
|
+
'key is configured. Call this when unsure whether a conversion or print is supported.',
|
|
291
|
+
inputSchema: {},
|
|
292
|
+
}, async () => {
|
|
293
|
+
const describe = (formats, dpi) => formats
|
|
294
|
+
.map((f) => ` ${f.padEnd(12)} ${formatLabel(f)}${dpi?.has(f) ? ' [sourceDpi]' : ''}`)
|
|
295
|
+
.join('\n');
|
|
296
|
+
return {
|
|
297
|
+
content: [
|
|
298
|
+
text(`Source formats:\n${describe(SOURCE_FORMATS, SOURCE_DPI_SOURCES)}\n\n` +
|
|
299
|
+
`Target formats:\n${describe(TARGET_FORMATS)}\n\n` +
|
|
300
|
+
'Any source converts to any target, and every source except url prints. Inline content is ' +
|
|
301
|
+
'text for label code and base64 for a PDF, an image, or a NiceLabel or BarTender file. ' +
|
|
302
|
+
'Without an API key, output is watermarked and holds only the first label; some paths, such ' +
|
|
303
|
+
'as JSON output and image to image, need a paid plan. ' +
|
|
304
|
+
(client.isAuthenticated ? 'An API key is configured.' : 'No API key is configured.')),
|
|
305
|
+
],
|
|
306
|
+
};
|
|
307
|
+
});
|
|
308
|
+
server.registerTool('print_label', {
|
|
309
|
+
title: 'Print a label on a Cloud Print printer',
|
|
310
|
+
description: 'Send a document to a printer connected through LabelZoom Cloud Print. LabelZoom converts it to the ' +
|
|
311
|
+
'printer\'s own language on the way, so a PDF prints on a ZPL printer. Needs an API key with the ' +
|
|
312
|
+
'print scope. The job is accepted, not printed, when this returns: use get_print_job to follow it.',
|
|
313
|
+
inputSchema: {
|
|
314
|
+
printer_id: z.string().min(1).describe('The printer\'s ID, from the LabelZoom dashboard.'),
|
|
315
|
+
source_format: z
|
|
316
|
+
.enum(PRINT_SOURCE_FORMATS)
|
|
317
|
+
.describe('Format of the document.'),
|
|
318
|
+
...documentShape,
|
|
319
|
+
copies: z.number().int().min(1).max(9999).optional()
|
|
320
|
+
.describe('Send the job this many times, 1 to 9999. A quantity in the label itself multiplies with it.'),
|
|
321
|
+
idempotency_key: z.string().optional()
|
|
322
|
+
.describe('Repeating a key returns the original job instead of printing again. Use an order number to make a retry safe. Without one, a key is generated for this call.'),
|
|
323
|
+
...sourceOptionsShape,
|
|
324
|
+
},
|
|
325
|
+
}, async (args) => {
|
|
326
|
+
try {
|
|
327
|
+
requireKey(client);
|
|
328
|
+
const source = args.source_format;
|
|
329
|
+
const job = await client.print({
|
|
330
|
+
printerId: args.printer_id,
|
|
331
|
+
from: source,
|
|
332
|
+
body: await printDocument(source, args.content, args.input_path),
|
|
333
|
+
options: printOptions(args),
|
|
334
|
+
copies: args.copies,
|
|
335
|
+
idempotencyKey: args.idempotency_key,
|
|
336
|
+
});
|
|
337
|
+
return json(job);
|
|
338
|
+
}
|
|
339
|
+
catch (error) {
|
|
340
|
+
return errorResult(error);
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
server.registerTool('print_template', {
|
|
344
|
+
title: 'Print a LabelZoom template',
|
|
345
|
+
description: 'Fill a Print Template published from LabelZoom Studio with data and print it on a Cloud Print ' +
|
|
346
|
+
'printer, one label per record. Needs an API key with the print scope. Returns the jobs and how many ' +
|
|
347
|
+
'records at the end were not submitted (remaining); resend with the same idempotency_key to submit them.',
|
|
348
|
+
inputSchema: {
|
|
349
|
+
printer_id: z.string().min(1).describe('The printer\'s ID, from the LabelZoom dashboard.'),
|
|
350
|
+
template_id: z.string().min(1).describe('The template\'s ID.'),
|
|
351
|
+
data: z.union([record, z.array(record)]).optional()
|
|
352
|
+
.describe('Merge-field values: one object per label. Omit it for a template with no merge fields.'),
|
|
353
|
+
validate: z.boolean().optional()
|
|
354
|
+
.describe('Check every record for missing merge fields before anything prints.'),
|
|
355
|
+
copies: z.number().int().min(1).max(9999).optional().describe('Send each label this many times.'),
|
|
356
|
+
idempotency_key: z.string().optional()
|
|
357
|
+
.describe('One key for the whole batch. Repeating it returns the original jobs instead of printing again.'),
|
|
358
|
+
},
|
|
359
|
+
}, async (args) => {
|
|
360
|
+
try {
|
|
361
|
+
requireKey(client);
|
|
362
|
+
const batch = await client.printTemplate({
|
|
363
|
+
printerId: args.printer_id,
|
|
364
|
+
templateId: args.template_id,
|
|
365
|
+
data: args.data,
|
|
366
|
+
validate: args.validate,
|
|
367
|
+
copies: args.copies,
|
|
368
|
+
idempotencyKey: args.idempotency_key,
|
|
369
|
+
});
|
|
370
|
+
return json(batch);
|
|
371
|
+
}
|
|
372
|
+
catch (error) {
|
|
373
|
+
return errorResult(error);
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
server.registerTool('get_print_job', {
|
|
377
|
+
title: 'Get a print job',
|
|
378
|
+
description: 'Look up a print job by ID to see whether it printed. dispatched and queued mean accepted; only ' +
|
|
379
|
+
'completed means the label came out of the printer.',
|
|
380
|
+
inputSchema: {
|
|
381
|
+
job_id: z.string().min(1).describe('The jobId returned by print_label or print_template.'),
|
|
382
|
+
},
|
|
383
|
+
}, async (args) => {
|
|
384
|
+
try {
|
|
385
|
+
requireKey(client);
|
|
386
|
+
return json(await client.jobs.get(args.job_id));
|
|
387
|
+
}
|
|
388
|
+
catch (error) {
|
|
389
|
+
return errorResult(error);
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
server.registerTool('get_print_quota', {
|
|
393
|
+
title: 'Get the Cloud Print quota',
|
|
394
|
+
description: 'Show the plan\'s limits on agents, printers and daily print jobs, what is used, and when the daily ' +
|
|
395
|
+
'count resets.',
|
|
396
|
+
inputSchema: {},
|
|
397
|
+
}, async () => {
|
|
398
|
+
try {
|
|
399
|
+
requireKey(client);
|
|
400
|
+
return json(await client.getPrintQuota());
|
|
401
|
+
}
|
|
402
|
+
catch (error) {
|
|
403
|
+
return errorResult(error);
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,uBAAuB,GAKxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,WAAW,EACX,cAAc,EACd,YAAY,EACZ,UAAU,GAGX,MAAM,cAAc,CAAC;AAKtB,MAAM,IAAI,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AACzE,MAAM,MAAM,GAAG,CAAC,KAAiB,EAA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AW,EAAE,EAAE;KAChB,EACD,KAAK,IAAyB,EAAE;QAC9B,IAAI,CAAC;YACH,UAAU,CAAC,MAAM,CAAC,CAAC;YACnB,OAAO,IAAI,CAAC,MAAM,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC;QAC5C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,59 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@labelzoom/mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@labelzoom/mcp",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "MCP server for LabelZoom: convert, preview and print barcode labels (ZPL, EPL, CPCL and other printer languages, BarTender, NiceLabel and DYMO files, PDF and images) from Claude and other MCP clients",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mcp",
|
|
7
|
+
"model-context-protocol",
|
|
8
|
+
"labelzoom",
|
|
9
|
+
"zpl",
|
|
10
|
+
"epl",
|
|
11
|
+
"cpcl",
|
|
12
|
+
"barcode",
|
|
13
|
+
"label",
|
|
14
|
+
"thermal-printer",
|
|
15
|
+
"bartender",
|
|
16
|
+
"nicelabel"
|
|
17
|
+
],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": {
|
|
20
|
+
"name": "RJF Technology Solutions LLC",
|
|
21
|
+
"email": "support@labelzoom.com"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/labelzoom/labelzoom-mcp#readme",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/labelzoom/labelzoom-mcp.git"
|
|
27
|
+
},
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/labelzoom/labelzoom-mcp/issues"
|
|
30
|
+
},
|
|
31
|
+
"type": "module",
|
|
32
|
+
"bin": {
|
|
33
|
+
"labelzoom-mcp": "dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist",
|
|
37
|
+
"!dist/**/*.test.*",
|
|
38
|
+
"README.md"
|
|
39
|
+
],
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=20"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc",
|
|
45
|
+
"dev": "tsc --watch",
|
|
46
|
+
"prepack": "npm run build",
|
|
47
|
+
"test": "tsc && node --test dist/*.test.js",
|
|
48
|
+
"typecheck": "tsc --noEmit"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@labelzoom/sdk": "^2.0.0",
|
|
52
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
53
|
+
"zod": "^4.6.7"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/node": "^24.19.2",
|
|
57
|
+
"typescript": "^5.9.3"
|
|
58
|
+
}
|
|
59
|
+
}
|