@voxslopuli/moveit-mcp 0.0.0-stage → 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 (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +234 -2
  3. package/dist/index.js +647 -0
  4. package/package.json +54 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 voxslopuli
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,235 @@
1
- # Temporary Holding Version
1
+ # @voxslopuli/moveit-mcp
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ MCP server exposing the MOVEit Automation REST API over stdio — 24 tools for browsing configuration, controlling tasks and the scheduler, and running audit, file-activity, and task-runs reports.
4
+
5
+ [![CI](https://github.com/voxslopuli/moveit-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/voxslopuli/moveit-mcp/actions)
6
+ [![npm](https://img.shields.io/npm/v/@voxslopuli/moveit-mcp)](https://www.npmjs.com/package/@voxslopuli/moveit-mcp)
7
+
8
+ ## Features
9
+
10
+ - 24 tools covering the MOVEit Automation REST API (`/api/v1`)
11
+ - Browse configuration objects: hosts, task groups, global parameters, custom scripts, date lists, PGP keys, SSH keys, tasks
12
+ - Control task execution and scheduler: start/stop task runs (with optional task parameters), enable/disable the global scheduler
13
+ - Web Admin-equivalent reports: audit (failed transfers), file activity (file/folder errors), task runs (completed runs)
14
+ - OAuth token lifecycle handled transparently: automatic refresh, revocation on shutdown
15
+ - Strict TLS by default; opt-out flag for self-signed certificates
16
+
17
+ ## Requirements
18
+
19
+ - Node.js >= 20
20
+ - MOVEit Automation with the Web Admin REST API reachable over HTTPS
21
+ - A MOVEit account with API access enabled
22
+
23
+ ## Installation
24
+
25
+ From npm (no clone needed):
26
+
27
+ ```sh
28
+ npx -y @voxslopuli/moveit-mcp
29
+ ```
30
+
31
+ From source:
32
+
33
+ ```sh
34
+ git clone https://github.com/voxslopuli/moveit-mcp
35
+ cd moveit-mcp
36
+ npm ci
37
+ npm run build
38
+ ```
39
+
40
+ ## Configuration
41
+
42
+ All configuration is via environment variables (see `.env.example`):
43
+
44
+ | Variable | Required | Default | Description |
45
+ | -------------------------------- | -------- | ------- | ------------------------------------------------------------------------------- |
46
+ | `MOVEIT_BASE_URL` | yes | — | Web Admin base URL, **including the `/webadmin` suffix** |
47
+ | `MOVEIT_USERNAME` | yes | — | MOVEit account username |
48
+ | `MOVEIT_PASSWORD` | yes | — | MOVEit account password |
49
+ | `MOVEIT_SERVER_HOST` | no | — | Server hostname sent in the token request when different from the base URL host |
50
+ | `MOVEIT_TLS_REJECT_UNAUTHORIZED` | no | `true` | Set `"false"` to accept self-signed certificates |
51
+
52
+ Missing required variables fail startup with a list of what is missing.
53
+
54
+ ### Security notes
55
+
56
+ - Credentials come from environment variables only; never passed as tool arguments.
57
+ - Access/refresh tokens are never logged or echoed in tool output or error messages.
58
+ - Token lifecycle: ~15 min access token, ~30 min refresh token; refresh is automatic.
59
+ - Tokens are revoked on `SIGINT`/`SIGTERM` shutdown.
60
+ - Set `MOVEIT_TLS_REJECT_UNAUTHORIZED=false` only for self-signed certificates in non-production environments.
61
+
62
+ ## Client setup
63
+
64
+ ### Claude Desktop
65
+
66
+ `claude_desktop_config.json`:
67
+
68
+ ```json
69
+ {
70
+ "mcpServers": {
71
+ "moveit": {
72
+ "command": "npx",
73
+ "args": ["-y", "@voxslopuli/moveit-mcp"],
74
+ "env": {
75
+ "MOVEIT_BASE_URL": "https://moveit.example.com/webadmin",
76
+ "MOVEIT_USERNAME": "svc-account",
77
+ "MOVEIT_PASSWORD": "changeme",
78
+ "MOVEIT_TLS_REJECT_UNAUTHORIZED": "true"
79
+ }
80
+ }
81
+ }
82
+ }
83
+ ```
84
+
85
+ ### Generic MCP client
86
+
87
+ Any client that supports `mcpServers`:
88
+
89
+ ```json
90
+ {
91
+ "mcpServers": {
92
+ "moveit": {
93
+ "command": "npx",
94
+ "args": ["-y", "@voxslopuli/moveit-mcp"],
95
+ "env": {
96
+ "MOVEIT_BASE_URL": "https://moveit.example.com/webadmin",
97
+ "MOVEIT_USERNAME": "svc-account",
98
+ "MOVEIT_PASSWORD": "changeme",
99
+ "MOVEIT_SERVER_HOST": "",
100
+ "MOVEIT_TLS_REJECT_UNAUTHORIZED": "true"
101
+ }
102
+ }
103
+ }
104
+ }
105
+ ```
106
+
107
+ > **`MOVEIT_BASE_URL` must include the `/webadmin` suffix** — the REST API lives under `https://<host>/webadmin/api/v1/`. A bare host URL like `https://moveit.example.com` will fail authentication.
108
+
109
+ ## Tool reference
110
+
111
+ Pagination tools accept `page`, `perPage`, `fields`, and (where noted) a `name`/`uid` filter — all optional.
112
+
113
+ ### Info
114
+
115
+ | Tool | Input | Description |
116
+ | ----------------- | ----- | -------------------------------------- |
117
+ | `moveit_get_info` | none | Server info including product version. |
118
+
119
+ ### Hosts
120
+
121
+ | Tool | Input | Description |
122
+ | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
123
+ | `moveit_list_hosts` | pagination, `fields`, `name`, optional `type` (`FileSystem`, `FTP`, `POP3`, `Share`, `siLock`, `SMTP`, `SSHFTP`, `AS1`, `AS2`, `AS3`, `S3`) | List hosts. |
124
+ | `moveit_get_host` | `hostId` | Get one host by ID (host name). |
125
+
126
+ ### Task Groups
127
+
128
+ | Tool | Input | Description |
129
+ | ------------------------- | ---------------------------- | --------------------------- |
130
+ | `moveit_list_task_groups` | pagination, `fields`, `name` | List task groups. |
131
+ | `moveit_get_task_group` | `taskGroupName` | Get one task group by name. |
132
+
133
+ ### Global Parameters
134
+
135
+ | Tool | Input | Description |
136
+ | ------------------------------- | ---------------------------- | ---------------------------------------------- |
137
+ | `moveit_list_global_parameters` | pagination, `fields`, `name` | List MOVEit Transfer global system parameters. |
138
+ | `moveit_get_global_parameter` | `name` | Get one global parameter by exact name. |
139
+
140
+ ### Custom Scripts
141
+
142
+ | Tool | Input | Description |
143
+ | ---------------------------- | ---------------------------- | ------------------------------------------ |
144
+ | `moveit_list_custom_scripts` | pagination, `fields`, `name` | List custom scripts. |
145
+ | `moveit_get_custom_script` | `customScriptId` | Get one custom script by ID (script name). |
146
+
147
+ ### Date Lists
148
+
149
+ | Tool | Input | Description |
150
+ | ------------------------ | ---------------------------- | ----------------------------------------------------------------- |
151
+ | `moveit_list_date_lists` | pagination, `fields`, `name` | List date lists (named date collections for schedule conditions). |
152
+ | `moveit_get_date_list` | `dateListId` | Get one date list by ID (list name). |
153
+
154
+ ### PGP Keys
155
+
156
+ | Tool | Input | Description |
157
+ | ---------------------- | -------------------------------------------------- | ---------------------- |
158
+ | `moveit_list_pgp_keys` | `page`, `perPage`, `fields`, optional `uid` filter | List OpenPGP keys. |
159
+ | `moveit_get_pgp_key` | `pGPKeyId` | Get one PGP key by ID. |
160
+
161
+ ### SSH Keys
162
+
163
+ | Tool | Input | Description |
164
+ | ---------------------- | ---------------------------- | --------------------------------- |
165
+ | `moveit_list_ssh_keys` | pagination, `fields`, `name` | List SSH client keys. |
166
+ | `moveit_get_ssh_key` | `sshKeyId` | Get one SSH key by ID (key name). |
167
+
168
+ ### Tasks
169
+
170
+ | Tool | Input | Description |
171
+ | --------------------------- | -------------------------------------------------------- | -------------------------------------------------- |
172
+ | `moveit_list_tasks` | pagination, `fields`, `name` search | List tasks. |
173
+ | `moveit_get_task` | `taskId` | Get one task by ID. |
174
+ | `moveit_list_running_tasks` | none | List currently running task runs. |
175
+ | `moveit_start_task` ⚠️ | `taskId`, optional `parameters` (string key/value pairs) | **Mutating:** start a run of a task on the server. |
176
+ | `moveit_stop_task` ⚠️ | `taskId` | **Mutating:** stop a running task. |
177
+ | `moveit_set_scheduler` ⚠️ | `action`: `"start"` or `"stop"` | **Mutating:** start or stop the global scheduler. |
178
+
179
+ ### Reports
180
+
181
+ All report tools take `predicate` (required), optional `orderBy`, optional `maxCount` (positive integer, max 10000).
182
+
183
+ | Tool | Input | Description |
184
+ | ----------------------------- | ---------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
185
+ | `moveit_audit_report` | `predicate`, `orderBy`, `maxCount` | Audit report. Web Admin failed-transfers view: `Status=="Failure"` with `orderBy: "!LogTime"` |
186
+ | `moveit_file_activity_report` | `predicate`, `orderBy`, `maxCount` | File activity report. Web Admin file/folder errors view: `StatusCode=out=("5000","5010")` with `orderBy: "!LogStamp"` |
187
+ | `moveit_task_runs_report` | `predicate`, `orderBy`, `maxCount` | Task runs report. Completed runs of both outcomes: `Status=in=("Success","Failure")` with `orderBy: "!StartTime"` |
188
+
189
+ Example:
190
+
191
+ ```json
192
+ {
193
+ "predicate": "Status==\"Failure\"",
194
+ "orderBy": "!LogTime",
195
+ "maxCount": 100
196
+ }
197
+ ```
198
+
199
+ #### Predicate language
200
+
201
+ - Combining: `;` or `and` for AND, `,` or `or` for OR.
202
+ - Operators: `==`, `!=`, `=lt=` (`<`), `=le=` (`<=`), `=gt=` (`>`), `=ge=` (`>=`), `=in=`, `=out=`, `=like=`.
203
+ - `=like=` supports `%` (any string) and `_` (any single character) wildcards.
204
+ - String values are quoted; `=in=`/`=out=` take a parenthesized, comma-separated list of quoted values, e.g. `Status=in=("Success","Failure")`.
205
+ - A leading `!` in `orderBy` values sorts descending (`!LogTime` = newest first).
206
+
207
+ ## Out of scope (v1)
208
+
209
+ - Configuration export/import (`GET`/`PUT /api/v1/config`)
210
+ - Task create/update/delete
211
+
212
+ ## Troubleshooting
213
+
214
+ - **Missing environment variables** — startup fails with a list naming exactly which required variables are missing.
215
+ - **401 loops** — usually wrong credentials, or `MOVEIT_BASE_URL` missing the `/webadmin` suffix while `MOVEIT_SERVER_HOST` diverges from the base URL host. Verify all three.
216
+ - **Self-signed certificate errors** — set `MOVEIT_TLS_REJECT_UNAUTHORIZED=false` (non-production only).
217
+ - **HTTP 422 on reports** — invalid `page`/`perPage` combinations or out-of-range `maxCount`; both must be positive integers (`maxCount` ≤ 10000).
218
+
219
+ ## Development
220
+
221
+ | Script | Description |
222
+ | ---------------- | ---------------------------- |
223
+ | `npm run dev` | Run from source via tsx. |
224
+ | `npm run build` | Build to `dist/` via tsup. |
225
+ | `npm test` | Run vitest suite. |
226
+ | `npm run lint` | Biome check (lint + format). |
227
+ | `npm run format` | Biome check with auto-fix. |
228
+
229
+ Stack: TypeScript (ESM), `@modelcontextprotocol/server`, zod, tsup, tsx, vitest, Biome, husky + lint-staged.
230
+
231
+ Workflow is test-driven: write the failing test (red), implement minimally (green), refactor. Commits follow Conventional Commits (`feat:`, `fix:`, `docs:`, ...). Coverage: `npx vitest --coverage`.
232
+
233
+ ## License
234
+
235
+ [MIT](https://github.com/voxslopuli/moveit-mcp/blob/main/LICENSE)
package/dist/index.js ADDED
@@ -0,0 +1,647 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/index.ts
4
+ import { pathToFileURL } from "url";
5
+ import { McpServer } from "@modelcontextprotocol/server";
6
+ import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
7
+
8
+ // package.json
9
+ var package_default = {
10
+ name: "@voxslopuli/moveit-mcp",
11
+ version: "0.1.0",
12
+ type: "module",
13
+ engines: {
14
+ node: ">=20"
15
+ },
16
+ scripts: {
17
+ dev: "tsx src/index.ts",
18
+ build: "tsup",
19
+ test: "vitest run",
20
+ lint: "biome check .",
21
+ format: "biome check --write .",
22
+ prepare: "husky"
23
+ },
24
+ "lint-staged": {
25
+ "*.{ts,tsx}": [
26
+ "biome check --write"
27
+ ]
28
+ },
29
+ dependencies: {
30
+ "@modelcontextprotocol/server": "^2.4.0",
31
+ zod: "^4.6.7"
32
+ },
33
+ devDependencies: {
34
+ "@biomejs/biome": "^2.6.8",
35
+ "@modelcontextprotocol/client": "^2.4.0",
36
+ "@types/node": "^26.6.6",
37
+ husky: "^9.1.7",
38
+ "lint-staged": "^17.6.1",
39
+ tsup: "^9.0.0",
40
+ tsx: "^4.23.15",
41
+ typescript: "^7.0.2",
42
+ vitest: "^5.1.0"
43
+ },
44
+ license: "MIT",
45
+ repository: {
46
+ type: "git",
47
+ url: "git+https://github.com/voxslopuli/moveit-mcp.git"
48
+ },
49
+ bugs: "https://github.com/voxslopuli/moveit-mcp/issues",
50
+ homepage: "https://github.com/voxslopuli/moveit-mcp#readme",
51
+ files: [
52
+ "dist",
53
+ "README.md",
54
+ "LICENSE"
55
+ ],
56
+ bin: {
57
+ "moveit-mcp": "dist/index.js"
58
+ },
59
+ publishConfig: {
60
+ access: "public"
61
+ }
62
+ };
63
+
64
+ // src/client.ts
65
+ var MoveitApiError = class extends Error {
66
+ status;
67
+ detail;
68
+ constructor(status, detail) {
69
+ super(detail);
70
+ this.name = "MoveitApiError";
71
+ this.status = status;
72
+ this.detail = detail;
73
+ }
74
+ };
75
+ var VALID_RESOURCES = /* @__PURE__ */ new Set([
76
+ "hosts",
77
+ "taskgroups",
78
+ "globalparameters",
79
+ "customscripts",
80
+ "datelists",
81
+ "pgpkeys",
82
+ "sshkeys",
83
+ "tasks"
84
+ ]);
85
+ var MoveitClient = class {
86
+ baseUrl;
87
+ tokenManager;
88
+ fetchImpl;
89
+ constructor(cfg, tokenManager, opts) {
90
+ this.baseUrl = cfg.baseUrl;
91
+ this.tokenManager = tokenManager;
92
+ this.fetchImpl = opts?.fetchImpl ?? fetch;
93
+ }
94
+ async info() {
95
+ return this.request("GET", "/api/v1/info");
96
+ }
97
+ async list(resource, params) {
98
+ this.assertResource(resource);
99
+ const query = new URLSearchParams();
100
+ for (const [key, value] of Object.entries(params ?? {})) {
101
+ if (value !== void 0) {
102
+ query.set(key, String(value));
103
+ }
104
+ }
105
+ const qs = query.toString();
106
+ return this.request("GET", `/api/v1/${resource}${qs ? `?${qs}` : ""}`);
107
+ }
108
+ async get(resource, id) {
109
+ this.assertResource(resource);
110
+ return this.request("GET", `/api/v1/${resource}/${id}`);
111
+ }
112
+ async runningTasks() {
113
+ return this.request("GET", "/api/v1/tasks/running");
114
+ }
115
+ async startTask(id, params) {
116
+ return this.request("POST", `/api/v1/tasks/${id}/start`, params);
117
+ }
118
+ async stopTask(id) {
119
+ return this.request("POST", `/api/v1/tasks/${id}/stop`);
120
+ }
121
+ async setScheduler(action) {
122
+ await this.request("PUT", `/api/v1/tasks/scheduler/${action}`);
123
+ }
124
+ async report(kind, q) {
125
+ const body = { predicate: q.predicate };
126
+ if (q.orderBy !== void 0) body.orderBy = q.orderBy;
127
+ if (q.maxCount !== void 0) body.maxCount = q.maxCount;
128
+ return this.request("POST", `/api/v1/reports/${kind}`, body);
129
+ }
130
+ async shutdown() {
131
+ await this.tokenManager.revoke();
132
+ }
133
+ assertResource(resource) {
134
+ if (!VALID_RESOURCES.has(resource)) {
135
+ throw new Error(`Unknown MOVEit resource: ${resource}`);
136
+ }
137
+ }
138
+ async request(method, path, jsonBody, retry = true) {
139
+ const token = await this.tokenManager.getToken();
140
+ const headers = {
141
+ Authorization: `Bearer ${token}`
142
+ };
143
+ let body;
144
+ if (jsonBody !== void 0) {
145
+ headers["Content-Type"] = "application/json";
146
+ body = JSON.stringify(jsonBody);
147
+ }
148
+ const res = await this.fetchImpl(`${this.baseUrl}${path}`, {
149
+ method,
150
+ headers,
151
+ body
152
+ });
153
+ if (res.status === 401 && retry) {
154
+ this.tokenManager.invalidate();
155
+ return this.request(method, path, jsonBody, false);
156
+ }
157
+ if (!res.ok) {
158
+ await this.throwApiError(res);
159
+ }
160
+ const text = await res.text();
161
+ return text ? JSON.parse(text) : null;
162
+ }
163
+ async throwApiError(res) {
164
+ const status = res.status;
165
+ let detail = `Request failed with status ${status}`;
166
+ try {
167
+ const err = await res.json();
168
+ if (err.detail) {
169
+ detail = err.detail;
170
+ } else if (err.error_description) {
171
+ detail = err.error_description;
172
+ } else if (err.error) {
173
+ detail = err.error;
174
+ } else if (err.title) {
175
+ detail = err.title;
176
+ }
177
+ } catch {
178
+ }
179
+ throw new MoveitApiError(status, detail);
180
+ }
181
+ };
182
+
183
+ // src/config.ts
184
+ var ConfigError = class extends Error {
185
+ };
186
+ var REQUIRED_KEYS = [
187
+ "MOVEIT_BASE_URL",
188
+ "MOVEIT_USERNAME",
189
+ "MOVEIT_PASSWORD"
190
+ ];
191
+ function loadConfig(env) {
192
+ const missing = REQUIRED_KEYS.filter((key) => !env[key]);
193
+ if (missing.length > 0) {
194
+ throw new ConfigError(
195
+ `Missing required environment variables: ${missing.join(", ")}`
196
+ );
197
+ }
198
+ const [baseUrl, username, password] = REQUIRED_KEYS.map(
199
+ (key) => env[key]
200
+ );
201
+ const tlsRaw = env.MOVEIT_TLS_REJECT_UNAUTHORIZED;
202
+ return {
203
+ baseUrl: baseUrl.replace(/\/+$/, ""),
204
+ username,
205
+ password,
206
+ serverHost: env.MOVEIT_SERVER_HOST,
207
+ tlsRejectUnauthorized: tlsRaw?.toLowerCase() !== "false"
208
+ };
209
+ }
210
+
211
+ // src/token-manager.ts
212
+ var REFRESH_MARGIN_MS = 6e4;
213
+ var TokenManager = class {
214
+ cfg;
215
+ fetchImpl;
216
+ accessToken = null;
217
+ refreshToken = null;
218
+ expiresAt = 0;
219
+ constructor(cfg, fetchImpl = fetch) {
220
+ this.cfg = cfg;
221
+ this.fetchImpl = fetchImpl;
222
+ }
223
+ async getToken() {
224
+ if (this.accessToken && Date.now() < this.expiresAt - REFRESH_MARGIN_MS) {
225
+ return this.accessToken;
226
+ }
227
+ if (this.refreshToken) {
228
+ await this.refresh();
229
+ } else {
230
+ await this.passwordGrant();
231
+ }
232
+ return this.accessToken;
233
+ }
234
+ invalidate() {
235
+ this.accessToken = null;
236
+ this.refreshToken = null;
237
+ this.expiresAt = 0;
238
+ }
239
+ async revoke() {
240
+ if (!this.accessToken) {
241
+ return;
242
+ }
243
+ const body = new URLSearchParams({ token: this.accessToken });
244
+ const res = await this.fetchImpl(
245
+ `${this.cfg.baseUrl}/api/v1/token/revoke`,
246
+ {
247
+ method: "POST",
248
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
249
+ body: body.toString()
250
+ }
251
+ );
252
+ if (!res.ok) {
253
+ throw new Error(`Token revocation failed with status ${res.status}`);
254
+ }
255
+ this.invalidate();
256
+ }
257
+ async passwordGrant() {
258
+ const body = new URLSearchParams({
259
+ grant_type: "password",
260
+ username: this.cfg.username,
261
+ password: this.cfg.password
262
+ });
263
+ if (this.cfg.serverHost !== void 0) {
264
+ body.set("server_host", this.cfg.serverHost);
265
+ }
266
+ await this.request(body);
267
+ }
268
+ async refresh() {
269
+ const refreshToken = this.refreshToken;
270
+ this.invalidate();
271
+ const body = new URLSearchParams({
272
+ grant_type: "refresh_token",
273
+ refresh_token: refreshToken
274
+ });
275
+ await this.request(body);
276
+ }
277
+ async request(body) {
278
+ const res = await this.fetchImpl(`${this.cfg.baseUrl}/api/v1/token`, {
279
+ method: "POST",
280
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
281
+ body: body.toString()
282
+ });
283
+ if (!res.ok) {
284
+ await this.throwTokenError(res);
285
+ }
286
+ const data = await res.json();
287
+ this.accessToken = data.access_token;
288
+ this.refreshToken = data.refresh_token;
289
+ this.expiresAt = Date.now() + data.expires_in * 1e3;
290
+ }
291
+ async throwTokenError(res) {
292
+ let message = `Token request failed with status ${res.status}`;
293
+ try {
294
+ const err = await res.json();
295
+ if (err.error_description) {
296
+ message = err.error_description;
297
+ } else if (err.error) {
298
+ message = err.error;
299
+ }
300
+ } catch {
301
+ }
302
+ throw new Error(message);
303
+ }
304
+ };
305
+
306
+ // src/tools/customscripts.ts
307
+ import { z as z2 } from "zod/v4";
308
+
309
+ // src/schemas.ts
310
+ import { z } from "zod/v4";
311
+ var ListParamsSchema = z.object({
312
+ page: z.number().int().positive().optional(),
313
+ perPage: z.number().int().positive().optional(),
314
+ fields: z.string().optional(),
315
+ name: z.string().optional()
316
+ });
317
+ var HostListParamsSchema = ListParamsSchema.extend({
318
+ type: z.enum([
319
+ "FileSystem",
320
+ "FTP",
321
+ "POP3",
322
+ "Share",
323
+ "siLock",
324
+ "SMTP",
325
+ "SSHFTP",
326
+ "AS1",
327
+ "AS2",
328
+ "AS3",
329
+ "S3"
330
+ ]).optional()
331
+ });
332
+ var PgpListParamsSchema = z.object({
333
+ page: z.number().int().positive().optional(),
334
+ perPage: z.number().int().positive().optional(),
335
+ fields: z.string().optional(),
336
+ uid: z.string().optional()
337
+ });
338
+ var IdParamsSchema = z.object({ id: z.string().min(1) });
339
+ var ReportQuerySchema = z.object({
340
+ predicate: z.string().min(1),
341
+ orderBy: z.string().optional(),
342
+ maxCount: z.number().int().positive().max(1e4).optional()
343
+ });
344
+
345
+ // src/tools/util.ts
346
+ function jsonResult(data) {
347
+ return {
348
+ content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
349
+ };
350
+ }
351
+
352
+ // src/tools/customscripts.ts
353
+ function registerMoveitCustomScripts(server, client) {
354
+ server.registerTool(
355
+ "moveit_list_custom_scripts",
356
+ {
357
+ description: "List custom scripts configured in MOVEit Automation, with pagination and optional name filter.",
358
+ inputSchema: ListParamsSchema
359
+ },
360
+ async (args) => jsonResult(await client.list("customscripts", args))
361
+ );
362
+ server.registerTool(
363
+ "moveit_get_custom_script",
364
+ {
365
+ description: "Get a single custom script by its custom script ID (script name).",
366
+ inputSchema: z2.object({ customScriptId: z2.string().min(1) })
367
+ },
368
+ async ({ customScriptId }) => jsonResult(await client.get("customscripts", customScriptId))
369
+ );
370
+ }
371
+
372
+ // src/tools/datelists.ts
373
+ import { z as z3 } from "zod/v4";
374
+ function registerMoveitDateLists(server, client) {
375
+ server.registerTool(
376
+ "moveit_list_date_lists",
377
+ {
378
+ description: "List date lists (named collections of dates usable in MOVEit Automation schedule conditions), with pagination and optional name filter.",
379
+ inputSchema: ListParamsSchema
380
+ },
381
+ async (args) => jsonResult(await client.list("datelists", args))
382
+ );
383
+ server.registerTool(
384
+ "moveit_get_date_list",
385
+ {
386
+ description: "Get a single date list by its date list ID (list name).",
387
+ inputSchema: z3.object({ dateListId: z3.string().min(1) })
388
+ },
389
+ async ({ dateListId }) => jsonResult(await client.get("datelists", dateListId))
390
+ );
391
+ }
392
+
393
+ // src/tools/globalparameters.ts
394
+ import { z as z4 } from "zod/v4";
395
+ function registerMoveitGlobalParameters(server, client) {
396
+ server.registerTool(
397
+ "moveit_list_global_parameters",
398
+ {
399
+ description: "List MOVEit Transfer global system parameters (server settings) with optional pagination.",
400
+ inputSchema: ListParamsSchema
401
+ },
402
+ async (args) => jsonResult(await client.list("globalparameters", args))
403
+ );
404
+ server.registerTool(
405
+ "moveit_get_global_parameter",
406
+ {
407
+ description: "Get a single MOVEit Transfer global parameter by its exact name.",
408
+ inputSchema: z4.object({ name: z4.string().min(1) })
409
+ },
410
+ async ({ name }) => jsonResult(await client.get("globalparameters", name))
411
+ );
412
+ }
413
+
414
+ // src/tools/hosts.ts
415
+ import { z as z5 } from "zod/v4";
416
+ function registerMoveitHosts(server, client) {
417
+ server.registerTool(
418
+ "moveit_list_hosts",
419
+ {
420
+ description: "List MOVEit Transfer hosts, optionally filtered by host type (FileSystem, FTP, POP3, Share, siLock, SMTP, SSHFTP, AS1, AS2, AS3, S3) with pagination.",
421
+ inputSchema: HostListParamsSchema
422
+ },
423
+ async (args) => jsonResult(await client.list("hosts", args))
424
+ );
425
+ server.registerTool(
426
+ "moveit_get_host",
427
+ {
428
+ description: "Get a single MOVEit Transfer host by its host ID (host name).",
429
+ inputSchema: z5.object({ hostId: z5.string().min(1) })
430
+ },
431
+ async ({ hostId }) => jsonResult(await client.get("hosts", hostId))
432
+ );
433
+ }
434
+
435
+ // src/tools/info.ts
436
+ function registerMoveitInfo(server, client) {
437
+ server.registerTool(
438
+ "moveit_get_info",
439
+ {
440
+ description: "Get MOVEit Automation server information, including the product version."
441
+ },
442
+ async () => jsonResult(await client.info())
443
+ );
444
+ }
445
+
446
+ // src/tools/pgpkeys.ts
447
+ import { z as z6 } from "zod/v4";
448
+ function registerMoveitPgpKeys(server, client) {
449
+ server.registerTool(
450
+ "moveit_list_pgp_keys",
451
+ {
452
+ description: "List OpenPGP keys known to MOVEit Automation, optionally filtered by key uid (user ID), with pagination.",
453
+ inputSchema: PgpListParamsSchema
454
+ },
455
+ async (args) => jsonResult(await client.list("pgpkeys", args))
456
+ );
457
+ server.registerTool(
458
+ "moveit_get_pgp_key",
459
+ {
460
+ description: "Get a single OpenPGP key by its PGP key ID.",
461
+ inputSchema: z6.object({ pGPKeyId: z6.string().min(1) })
462
+ },
463
+ async ({ pGPKeyId }) => jsonResult(await client.get("pgpkeys", pGPKeyId))
464
+ );
465
+ }
466
+
467
+ // src/tools/reports.ts
468
+ function registerMoveitReports(server, client) {
469
+ server.registerTool(
470
+ "moveit_audit_report",
471
+ {
472
+ description: 'Run a MOVEit Automation audit report. For Web Admin-style failed-transfer results, use predicate `Status=="Failure"` with orderBy `!LogTime` (newest failures first).',
473
+ inputSchema: ReportQuerySchema
474
+ },
475
+ async (args) => jsonResult(await client.report("audit", args))
476
+ );
477
+ server.registerTool(
478
+ "moveit_file_activity_report",
479
+ {
480
+ description: 'Run a MOVEit Automation file activity report. For Web Admin-style file/folder errors, use predicate `StatusCode=out=("5000","5010")` with orderBy `!LogStamp` (newest first).',
481
+ inputSchema: ReportQuerySchema
482
+ },
483
+ async (args) => jsonResult(await client.report("fileactivity", args))
484
+ );
485
+ server.registerTool(
486
+ "moveit_task_runs_report",
487
+ {
488
+ description: 'Run a MOVEit Automation task runs report. For completed runs of both outcomes, use predicate `Status=in=("Success","Failure")` with orderBy `!StartTime` (newest first).',
489
+ inputSchema: ReportQuerySchema
490
+ },
491
+ async (args) => jsonResult(await client.report("taskruns", args))
492
+ );
493
+ }
494
+
495
+ // src/tools/sshkeys.ts
496
+ import { z as z7 } from "zod/v4";
497
+ function registerMoveitSshKeys(server, client) {
498
+ server.registerTool(
499
+ "moveit_list_ssh_keys",
500
+ {
501
+ description: "List SSH client keys known to MOVEit Automation, with pagination and optional name filter.",
502
+ inputSchema: ListParamsSchema
503
+ },
504
+ async (args) => jsonResult(await client.list("sshkeys", args))
505
+ );
506
+ server.registerTool(
507
+ "moveit_get_ssh_key",
508
+ {
509
+ description: "Get a single SSH key by its SSH key ID (key name).",
510
+ inputSchema: z7.object({ sshKeyId: z7.string().min(1) })
511
+ },
512
+ async ({ sshKeyId }) => jsonResult(await client.get("sshkeys", sshKeyId))
513
+ );
514
+ }
515
+
516
+ // src/tools/taskgroups.ts
517
+ import { z as z8 } from "zod/v4";
518
+ function registerMoveitTaskGroups(server, client) {
519
+ server.registerTool(
520
+ "moveit_list_task_groups",
521
+ {
522
+ description: "List MOVEit Transfer task groups with optional pagination and name filtering.",
523
+ inputSchema: ListParamsSchema
524
+ },
525
+ async (args) => jsonResult(await client.list("taskgroups", args))
526
+ );
527
+ server.registerTool(
528
+ "moveit_get_task_group",
529
+ {
530
+ description: "Get a single MOVEit Transfer task group by its name.",
531
+ inputSchema: z8.object({ taskGroupName: z8.string().min(1) })
532
+ },
533
+ async ({ taskGroupName }) => jsonResult(await client.get("taskgroups", taskGroupName))
534
+ );
535
+ }
536
+
537
+ // src/tools/tasks.ts
538
+ import { z as z9 } from "zod/v4";
539
+ function registerMoveitTasks(server, client) {
540
+ server.registerTool(
541
+ "moveit_list_tasks",
542
+ {
543
+ description: "List MOVEit Automation tasks with optional name search, field selection, and pagination.",
544
+ inputSchema: ListParamsSchema
545
+ },
546
+ async (args) => jsonResult(await client.list("tasks", args))
547
+ );
548
+ server.registerTool(
549
+ "moveit_get_task",
550
+ {
551
+ description: "Get a single MOVEit Automation task by its task ID.",
552
+ inputSchema: z9.object({ taskId: z9.string().min(1) })
553
+ },
554
+ async ({ taskId }) => jsonResult(await client.get("tasks", taskId))
555
+ );
556
+ server.registerTool(
557
+ "moveit_list_running_tasks",
558
+ {
559
+ description: "List currently running MOVEit Automation task runs.",
560
+ inputSchema: z9.object({})
561
+ },
562
+ async () => jsonResult(await client.runningTasks())
563
+ );
564
+ server.registerTool(
565
+ "moveit_start_task",
566
+ {
567
+ description: "Start a run of a MOVEit Automation task on the server (mutating action). Optionally accepts task parameters as string key/value pairs.",
568
+ inputSchema: z9.object({
569
+ taskId: z9.string().min(1),
570
+ parameters: z9.record(z9.string(), z9.string()).optional()
571
+ })
572
+ },
573
+ async ({ taskId, parameters }) => jsonResult(await client.startTask(taskId, parameters))
574
+ );
575
+ server.registerTool(
576
+ "moveit_stop_task",
577
+ {
578
+ description: "Stop a running MOVEit Automation task on the server (mutating action).",
579
+ inputSchema: z9.object({ taskId: z9.string().min(1) })
580
+ },
581
+ async ({ taskId }) => jsonResult(await client.stopTask(taskId))
582
+ );
583
+ server.registerTool(
584
+ "moveit_set_scheduler",
585
+ {
586
+ description: "Start or stop the global MOVEit Automation scheduler on the server (mutating action).",
587
+ inputSchema: z9.object({ action: z9.enum(["start", "stop"]) })
588
+ },
589
+ async ({ action }) => {
590
+ await client.setScheduler(action);
591
+ return jsonResult({ scheduler: action });
592
+ }
593
+ );
594
+ }
595
+
596
+ // src/index.ts
597
+ function createServer(cfg) {
598
+ const tokenManager = new TokenManager(cfg);
599
+ const client = new MoveitClient(cfg, tokenManager);
600
+ const server = new McpServer({
601
+ name: "moveit-mcp",
602
+ version: package_default.version
603
+ });
604
+ registerMoveitHosts(server, client);
605
+ registerMoveitInfo(server, client);
606
+ registerMoveitTaskGroups(server, client);
607
+ registerMoveitGlobalParameters(server, client);
608
+ registerMoveitCustomScripts(server, client);
609
+ registerMoveitDateLists(server, client);
610
+ registerMoveitPgpKeys(server, client);
611
+ registerMoveitSshKeys(server, client);
612
+ registerMoveitTasks(server, client);
613
+ registerMoveitReports(server, client);
614
+ let shuttingDown = false;
615
+ const shutdown = async () => {
616
+ if (shuttingDown) return;
617
+ shuttingDown = true;
618
+ await client.shutdown();
619
+ };
620
+ return { server, client, tokenManager, shutdown };
621
+ }
622
+ async function runMain(env) {
623
+ const cfg = loadConfig(env);
624
+ const { server, shutdown } = createServer(cfg);
625
+ process.on("SIGINT", () => void shutdown());
626
+ process.on("SIGTERM", () => void shutdown());
627
+ await server.connect(new StdioServerTransport());
628
+ }
629
+ async function main() {
630
+ try {
631
+ await runMain(process.env);
632
+ } catch (err) {
633
+ if (err instanceof ConfigError) {
634
+ console.error(`moveit-mcp: ${err.message}`);
635
+ process.exit(1);
636
+ }
637
+ throw err;
638
+ }
639
+ }
640
+ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
641
+ void main();
642
+ }
643
+ export {
644
+ createServer,
645
+ main,
646
+ runMain
647
+ };
package/package.json CHANGED
@@ -1,6 +1,56 @@
1
1
  {
2
2
  "name": "@voxslopuli/moveit-mcp",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "engines": {
6
+ "node": ">=20"
7
+ },
8
+ "scripts": {
9
+ "dev": "tsx src/index.ts",
10
+ "build": "tsup",
11
+ "test": "vitest run",
12
+ "lint": "biome check .",
13
+ "format": "biome check --write .",
14
+ "prepare": "husky",
15
+ "test:coverage": "vitest run --coverage"
16
+ },
17
+ "lint-staged": {
18
+ "*.{ts,tsx}": [
19
+ "biome check --write"
20
+ ]
21
+ },
22
+ "dependencies": {
23
+ "@modelcontextprotocol/server": "^2.4.0",
24
+ "zod": "^4.6.7"
25
+ },
26
+ "devDependencies": {
27
+ "@biomejs/biome": "^2.6.8",
28
+ "@modelcontextprotocol/client": "^2.4.0",
29
+ "@types/node": "^26.6.6",
30
+ "husky": "^9.1.7",
31
+ "lint-staged": "^17.6.1",
32
+ "tsup": "^9.0.0",
33
+ "tsx": "^4.23.15",
34
+ "typescript": "^7.0.2",
35
+ "vitest": "^5.1.0",
36
+ "@vitest/coverage-v8": "^5.1.0"
37
+ },
38
+ "license": "MIT",
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/voxslopuli/moveit-mcp.git"
42
+ },
43
+ "bugs": "https://github.com/voxslopuli/moveit-mcp/issues",
44
+ "homepage": "https://github.com/voxslopuli/moveit-mcp#readme",
45
+ "files": [
46
+ "dist",
47
+ "README.md",
48
+ "LICENSE"
49
+ ],
50
+ "bin": {
51
+ "moveit-mcp": "dist/index.js"
52
+ },
53
+ "publishConfig": {
54
+ "access": "public"
55
+ }
56
+ }