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