jetty-mcp-server 1.0.0 → 1.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.
package/src/tools.ts DELETED
@@ -1,222 +0,0 @@
1
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- import { z } from "zod";
3
- import { JettyClient } from "./client.js";
4
-
5
- function jsonResult(data: unknown) {
6
- return {
7
- content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }],
8
- };
9
- }
10
-
11
- export function registerTools(server: McpServer, client: JettyClient) {
12
- // ── Collections ──────────────────────────────────────────────
13
-
14
- server.tool("list-collections", "List all collections", {}, async () => {
15
- return jsonResult(await client.listCollections());
16
- });
17
-
18
- server.tool(
19
- "get-collection",
20
- "Get collection details including environment variable keys",
21
- { collection: z.string().describe("Collection name") },
22
- async ({ collection }) => {
23
- return jsonResult(await client.getCollection(collection));
24
- }
25
- );
26
-
27
- // ── Tasks ────────────────────────────────────────────────────
28
-
29
- server.tool(
30
- "list-tasks",
31
- "List tasks in a collection",
32
- { collection: z.string().describe("Collection name") },
33
- async ({ collection }) => {
34
- return jsonResult(await client.listTasks(collection));
35
- }
36
- );
37
-
38
- server.tool(
39
- "get-task",
40
- "Get task details including workflow definition",
41
- {
42
- collection: z.string().describe("Collection name"),
43
- task: z.string().describe("Task name"),
44
- },
45
- async ({ collection, task }) => {
46
- return jsonResult(await client.getTask(collection, task));
47
- }
48
- );
49
-
50
- server.tool(
51
- "create-task",
52
- "Create a new task with a workflow definition",
53
- {
54
- collection: z.string().describe("Collection name"),
55
- name: z.string().describe("Task name"),
56
- description: z.string().optional().describe("Task description"),
57
- workflow: z
58
- .record(z.unknown())
59
- .describe(
60
- "Workflow JSON with init_params, step_configs, and steps"
61
- ),
62
- },
63
- async ({ collection, name, description, workflow }) => {
64
- return jsonResult(
65
- await client.createTask(collection, name, workflow, description)
66
- );
67
- }
68
- );
69
-
70
- server.tool(
71
- "update-task",
72
- "Update a task's workflow or description",
73
- {
74
- collection: z.string().describe("Collection name"),
75
- task: z.string().describe("Task name"),
76
- workflow: z
77
- .record(z.unknown())
78
- .optional()
79
- .describe("Updated workflow JSON"),
80
- description: z.string().optional().describe("Updated description"),
81
- },
82
- async ({ collection, task, workflow, description }) => {
83
- const updates: { workflow?: unknown; description?: string } = {};
84
- if (workflow) updates.workflow = workflow;
85
- if (description) updates.description = description;
86
- return jsonResult(await client.updateTask(collection, task, updates));
87
- }
88
- );
89
-
90
- // ── Run Workflows ────────────────────────────────────────────
91
-
92
- server.tool(
93
- "run-workflow",
94
- "Run a workflow asynchronously (returns immediately with workflow_id)",
95
- {
96
- collection: z.string().describe("Collection name"),
97
- task: z.string().describe("Task name"),
98
- init_params: z
99
- .record(z.unknown())
100
- .optional()
101
- .describe("Input parameters for the workflow"),
102
- },
103
- async ({ collection, task, init_params }) => {
104
- return jsonResult(
105
- await client.runWorkflow(
106
- collection,
107
- task,
108
- init_params as Record<string, unknown>
109
- )
110
- );
111
- }
112
- );
113
-
114
- server.tool(
115
- "run-workflow-sync",
116
- "Run a workflow synchronously (blocks until completion, may take 30-60s)",
117
- {
118
- collection: z.string().describe("Collection name"),
119
- task: z.string().describe("Task name"),
120
- init_params: z
121
- .record(z.unknown())
122
- .optional()
123
- .describe("Input parameters for the workflow"),
124
- },
125
- async ({ collection, task, init_params }) => {
126
- return jsonResult(
127
- await client.runWorkflowSync(
128
- collection,
129
- task,
130
- init_params as Record<string, unknown>
131
- )
132
- );
133
- }
134
- );
135
-
136
- // ── Trajectories ─────────────────────────────────────────────
137
-
138
- server.tool(
139
- "list-trajectories",
140
- "List recent workflow runs (trajectories) for a task",
141
- {
142
- collection: z.string().describe("Collection name"),
143
- task: z.string().describe("Task name"),
144
- limit: z.number().optional().default(10).describe("Max results"),
145
- page: z.number().optional().default(1).describe("Page number"),
146
- },
147
- async ({ collection, task, limit, page }) => {
148
- return jsonResult(
149
- await client.listTrajectories(collection, task, limit, page)
150
- );
151
- }
152
- );
153
-
154
- server.tool(
155
- "get-trajectory",
156
- "Get full details of a specific workflow run",
157
- {
158
- collection: z.string().describe("Collection name"),
159
- task: z.string().describe("Task name"),
160
- trajectory_id: z.string().describe("Trajectory ID"),
161
- },
162
- async ({ collection, task, trajectory_id }) => {
163
- return jsonResult(
164
- await client.getTrajectory(collection, task, trajectory_id)
165
- );
166
- }
167
- );
168
-
169
- // ── Stats ────────────────────────────────────────────────────
170
-
171
- server.tool(
172
- "get-stats",
173
- "Get execution statistics for a task",
174
- {
175
- collection: z.string().describe("Collection name"),
176
- task: z.string().describe("Task name"),
177
- },
178
- async ({ collection, task }) => {
179
- return jsonResult(await client.getStats(collection, task));
180
- }
181
- );
182
-
183
- // ── Labels ───────────────────────────────────────────────────
184
-
185
- server.tool(
186
- "add-label",
187
- "Add a label to a trajectory (e.g., quality=high)",
188
- {
189
- collection: z.string().describe("Collection name"),
190
- task: z.string().describe("Task name"),
191
- trajectory_id: z.string().describe("Trajectory ID"),
192
- key: z.string().describe("Label key (e.g., 'quality', 'status')"),
193
- value: z.string().describe("Label value (e.g., 'high', 'approved')"),
194
- author: z.string().describe("Author email"),
195
- },
196
- async ({ collection, task, trajectory_id, key, value, author }) => {
197
- return jsonResult(
198
- await client.addLabel(collection, task, trajectory_id, key, value, author)
199
- );
200
- }
201
- );
202
-
203
- // ── Step Templates ───────────────────────────────────────────
204
-
205
- server.tool(
206
- "list-step-templates",
207
- "List all available workflow step templates",
208
- {},
209
- async () => {
210
- return jsonResult(await client.listStepTemplates());
211
- }
212
- );
213
-
214
- server.tool(
215
- "get-step-template",
216
- "Get details and schema for a step template",
217
- { name: z.string().describe("Step template activity name") },
218
- async ({ name }) => {
219
- return jsonResult(await client.getStepTemplate(name));
220
- }
221
- );
222
- }
package/tsconfig.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "Node16",
5
- "moduleResolution": "Node16",
6
- "outDir": "dist",
7
- "rootDir": "src",
8
- "strict": true,
9
- "esModuleInterop": true,
10
- "skipLibCheck": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "declaration": true,
13
- "declarationMap": true,
14
- "sourceMap": true
15
- },
16
- "include": ["src"],
17
- "exclude": ["node_modules", "dist"]
18
- }