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/dist/tools.js CHANGED
@@ -1,114 +1,13 @@
1
- import { z } from "zod";
2
- function jsonResult(data) {
3
- return {
4
- content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
5
- };
6
- }
1
+ import { JETTY_TOOLS, jsonResult } from "./tool-definitions.js";
2
+ export { JETTY_TOOLS, JETTY_WEBMCP_TOOLS, getJettyTool, jsonResult } from "./tool-definitions.js";
7
3
  export function registerTools(server, client) {
8
- // ── Collections ──────────────────────────────────────────────
9
- server.tool("list-collections", "List all collections", {}, async () => {
10
- return jsonResult(await client.listCollections());
11
- });
12
- server.tool("get-collection", "Get collection details including environment variable keys", { collection: z.string().describe("Collection name") }, async ({ collection }) => {
13
- return jsonResult(await client.getCollection(collection));
14
- });
15
- // ── Tasks ────────────────────────────────────────────────────
16
- server.tool("list-tasks", "List tasks in a collection", { collection: z.string().describe("Collection name") }, async ({ collection }) => {
17
- return jsonResult(await client.listTasks(collection));
18
- });
19
- server.tool("get-task", "Get task details including workflow definition", {
20
- collection: z.string().describe("Collection name"),
21
- task: z.string().describe("Task name"),
22
- }, async ({ collection, task }) => {
23
- return jsonResult(await client.getTask(collection, task));
24
- });
25
- server.tool("create-task", "Create a new task with a workflow definition", {
26
- collection: z.string().describe("Collection name"),
27
- name: z.string().describe("Task name"),
28
- description: z.string().optional().describe("Task description"),
29
- workflow: z
30
- .record(z.unknown())
31
- .describe("Workflow JSON with init_params, step_configs, and steps"),
32
- }, async ({ collection, name, description, workflow }) => {
33
- return jsonResult(await client.createTask(collection, name, workflow, description));
34
- });
35
- server.tool("update-task", "Update a task's workflow or description", {
36
- collection: z.string().describe("Collection name"),
37
- task: z.string().describe("Task name"),
38
- workflow: z
39
- .record(z.unknown())
40
- .optional()
41
- .describe("Updated workflow JSON"),
42
- description: z.string().optional().describe("Updated description"),
43
- }, async ({ collection, task, workflow, description }) => {
44
- const updates = {};
45
- if (workflow)
46
- updates.workflow = workflow;
47
- if (description)
48
- updates.description = description;
49
- return jsonResult(await client.updateTask(collection, task, updates));
50
- });
51
- // ── Run Workflows ────────────────────────────────────────────
52
- server.tool("run-workflow", "Run a workflow asynchronously (returns immediately with workflow_id)", {
53
- collection: z.string().describe("Collection name"),
54
- task: z.string().describe("Task name"),
55
- init_params: z
56
- .record(z.unknown())
57
- .optional()
58
- .describe("Input parameters for the workflow"),
59
- }, async ({ collection, task, init_params }) => {
60
- return jsonResult(await client.runWorkflow(collection, task, init_params));
61
- });
62
- server.tool("run-workflow-sync", "Run a workflow synchronously (blocks until completion, may take 30-60s)", {
63
- collection: z.string().describe("Collection name"),
64
- task: z.string().describe("Task name"),
65
- init_params: z
66
- .record(z.unknown())
67
- .optional()
68
- .describe("Input parameters for the workflow"),
69
- }, async ({ collection, task, init_params }) => {
70
- return jsonResult(await client.runWorkflowSync(collection, task, init_params));
71
- });
72
- // ── Trajectories ─────────────────────────────────────────────
73
- server.tool("list-trajectories", "List recent workflow runs (trajectories) for a task", {
74
- collection: z.string().describe("Collection name"),
75
- task: z.string().describe("Task name"),
76
- limit: z.number().optional().default(10).describe("Max results"),
77
- page: z.number().optional().default(1).describe("Page number"),
78
- }, async ({ collection, task, limit, page }) => {
79
- return jsonResult(await client.listTrajectories(collection, task, limit, page));
80
- });
81
- server.tool("get-trajectory", "Get full details of a specific workflow run", {
82
- collection: z.string().describe("Collection name"),
83
- task: z.string().describe("Task name"),
84
- trajectory_id: z.string().describe("Trajectory ID"),
85
- }, async ({ collection, task, trajectory_id }) => {
86
- return jsonResult(await client.getTrajectory(collection, task, trajectory_id));
87
- });
88
- // ── Stats ────────────────────────────────────────────────────
89
- server.tool("get-stats", "Get execution statistics for a task", {
90
- collection: z.string().describe("Collection name"),
91
- task: z.string().describe("Task name"),
92
- }, async ({ collection, task }) => {
93
- return jsonResult(await client.getStats(collection, task));
94
- });
95
- // ── Labels ───────────────────────────────────────────────────
96
- server.tool("add-label", "Add a label to a trajectory (e.g., quality=high)", {
97
- collection: z.string().describe("Collection name"),
98
- task: z.string().describe("Task name"),
99
- trajectory_id: z.string().describe("Trajectory ID"),
100
- key: z.string().describe("Label key (e.g., 'quality', 'status')"),
101
- value: z.string().describe("Label value (e.g., 'high', 'approved')"),
102
- author: z.string().describe("Author email"),
103
- }, async ({ collection, task, trajectory_id, key, value, author }) => {
104
- return jsonResult(await client.addLabel(collection, task, trajectory_id, key, value, author));
105
- });
106
- // ── Step Templates ───────────────────────────────────────────
107
- server.tool("list-step-templates", "List all available workflow step templates", {}, async () => {
108
- return jsonResult(await client.listStepTemplates());
109
- });
110
- server.tool("get-step-template", "Get details and schema for a step template", { name: z.string().describe("Step template activity name") }, async ({ name }) => {
111
- return jsonResult(await client.getStepTemplate(name));
112
- });
4
+ for (const tool of JETTY_TOOLS) {
5
+ server.registerTool(tool.name, {
6
+ title: tool.title,
7
+ description: tool.description,
8
+ inputSchema: tool.inputSchema,
9
+ annotations: tool.annotations,
10
+ }, async (args) => jsonResult(await tool.handler(client, args)));
11
+ }
113
12
  }
114
13
  //# sourceMappingURL=tools.js.map
package/dist/tools.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,SAAS,UAAU,CAAC,IAAa;IAC/B,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;KAC1E,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAAiB,EAAE,MAAmB;IAClE,gEAAgE;IAEhE,MAAM,CAAC,IAAI,CAAC,kBAAkB,EAAE,sBAAsB,EAAE,EAAE,EAAE,KAAK,IAAI,EAA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AAI,CACT,mBAAmB,EACnB,4CAA4C,EAC5C,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC,EAAE,EAC5D,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACjB,OAAO,UAAU,CAAC,MAAM,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;IACxD,CAAC,CACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGlG,MAAM,UAAU,aAAa,CAAC,MAAiB,EAAE,MAAsB;IACrE,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QAC/B,MAAM,CAAC,YAAY,CACjB,IAAI,CAAC,IAAI,EACT;YACE,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,EACD,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAC7D,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,61 @@
1
+ import type { JettyApiClient } from "./api-client.js";
2
+ import { type JettyToolDefinition, type ToolAnnotations, type ToolResult } from "./tool-definitions.js";
3
+ export interface WebMcpTool {
4
+ name: string;
5
+ description: string;
6
+ /** JSON Schema (draft-07) for the tool's input. */
7
+ inputSchema: Record<string, unknown>;
8
+ annotations: ToolAnnotations;
9
+ execute: (input?: Record<string, unknown>) => Promise<ToolResult>;
10
+ }
11
+ /** The subset of `ModelContext` this module touches, in either API shape. */
12
+ export interface ModelContextLike {
13
+ registerTool?: (tool: WebMcpTool, options?: {
14
+ signal?: AbortSignal;
15
+ }) => unknown;
16
+ provideContext?: (context: {
17
+ tools: WebMcpTool[];
18
+ }) => unknown;
19
+ clearContext?: () => unknown;
20
+ }
21
+ export interface JettyWebMcpOptions {
22
+ /** Only these tool names (default: every tool). */
23
+ include?: string[];
24
+ /** Never these tool names. */
25
+ exclude?: string[];
26
+ /** Only tools whose annotations say readOnlyHint (list/get). */
27
+ readOnly?: boolean;
28
+ /** Prefix added to every tool name, e.g. "jetty_". Default: none. */
29
+ namePrefix?: string;
30
+ }
31
+ /** JSON Schema for a definition's zod input shape. */
32
+ export declare function toolInputJsonSchema(tool: JettyToolDefinition): Record<string, unknown>;
33
+ /** One WebMCP tool descriptor for a definition, executing through `client`. */
34
+ export declare function toWebMcpTool(tool: JettyToolDefinition, client: JettyApiClient, namePrefix?: string): WebMcpTool;
35
+ /**
36
+ * The catalog as WebMCP tool descriptors, filtered per `options`. Tools the
37
+ * catalog marks `webmcp: false` (trial-key management) are never exposed,
38
+ * even when `include` names them.
39
+ */
40
+ export declare function jettyWebMcpTools(client: JettyApiClient, options?: JettyWebMcpOptions): WebMcpTool[];
41
+ /** `document.modelContext` first (current spec), then `navigator.modelContext`. */
42
+ export declare function findModelContext(globals?: {
43
+ document?: unknown;
44
+ navigator?: unknown;
45
+ }): ModelContextLike | null;
46
+ export interface RegisterJettyWebMcpResult {
47
+ /** Which API shape was used, or null when the context offers neither. */
48
+ via: "registerTool" | "provideContext" | null;
49
+ /** Names of the tools registered. */
50
+ tools: string[];
51
+ }
52
+ /**
53
+ * Register the (filtered) catalog on `modelContext`. With `registerTool`,
54
+ * `signal` unregisters the tools when aborted; with `provideContext`, abort
55
+ * calls `clearContext()` when the context has one. A signal that is already
56
+ * aborted registers nothing (`via: null`).
57
+ */
58
+ export declare function registerJettyWebMcpTools(modelContext: ModelContextLike, client: JettyApiClient, options?: JettyWebMcpOptions & {
59
+ signal?: AbortSignal;
60
+ }): RegisterJettyWebMcpResult;
61
+ //# sourceMappingURL=webmcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webmcp.d.ts","sourceRoot":"","sources":["../src/webmcp.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,UAAU,EAChB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,WAAW,EAAE,eAAe,CAAC;IAC7B,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACnE;AAED,6EAA6E;AAC7E,MAAM,WAAW,gBAAgB;IAC/B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,KAAK,OAAO,CAAC;IACjF,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,UAAU,EAAE,CAAA;KAAE,KAAK,OAAO,CAAC;IAC/D,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,kBAAkB;IACjC,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,sDAAsD;AACtD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAOtF;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,CAC1B,IAAI,EAAE,mBAAmB,EACzB,MAAM,EAAE,cAAc,EACtB,UAAU,SAAK,GACd,UAAU,CAiBZ;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,cAAc,EACtB,OAAO,GAAE,kBAAuB,GAC/B,UAAU,EAAE,CASd;AAED,mFAAmF;AACnF,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAGjD,GACA,gBAAgB,GAAG,IAAI,CAYzB;AAED,MAAM,WAAW,yBAAyB;IACxC,yEAAyE;IACzE,GAAG,EAAE,cAAc,GAAG,gBAAgB,GAAG,IAAI,CAAC;IAC9C,qCAAqC;IACrC,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,gBAAgB,EAC9B,MAAM,EAAE,cAAc,EACtB,OAAO,GAAE,kBAAkB,GAAG;IAAE,MAAM,CAAC,EAAE,WAAW,CAAA;CAAO,GAC1D,yBAAyB,CAoB3B"}
package/dist/webmcp.js ADDED
@@ -0,0 +1,98 @@
1
+ /**
2
+ * WebMCP adapter: the Jetty tool catalog on a page's `modelContext`
3
+ * (https://webmachinelearning.github.io/webmcp/). Browser-safe.
4
+ *
5
+ * A site that already authenticates the visitor registers the same tools the
6
+ * stdio MCP server offers, executed with the visitor's own session:
7
+ *
8
+ * const client = new JettyApiClient({ token: () => session.getToken(), ... });
9
+ * registerJettyWebMcpTools(navigator.modelContext, client, { signal });
10
+ *
11
+ * Both API shapes are handled: the current `registerTool(tool, { signal })`
12
+ * and the earlier `provideContext({ tools })`.
13
+ */
14
+ import { z } from "zod";
15
+ import { zodToJsonSchema } from "zod-to-json-schema";
16
+ import { JETTY_WEBMCP_TOOLS, jsonResult, } from "./tool-definitions.js";
17
+ /** JSON Schema for a definition's zod input shape. */
18
+ export function toolInputJsonSchema(tool) {
19
+ const schema = zodToJsonSchema(z.object(tool.inputSchema), {
20
+ target: "jsonSchema7",
21
+ $refStrategy: "none",
22
+ });
23
+ delete schema.$schema;
24
+ return schema;
25
+ }
26
+ /** One WebMCP tool descriptor for a definition, executing through `client`. */
27
+ export function toWebMcpTool(tool, client, namePrefix = "") {
28
+ const parser = z.object(tool.inputSchema);
29
+ return {
30
+ name: `${namePrefix}${tool.name}`,
31
+ description: tool.description,
32
+ inputSchema: toolInputJsonSchema(tool),
33
+ annotations: tool.annotations,
34
+ execute: async (input) => {
35
+ try {
36
+ const args = parser.parse(input ?? {});
37
+ return jsonResult(await tool.handler(client, args));
38
+ }
39
+ catch (err) {
40
+ const message = err instanceof Error ? err.message : String(err);
41
+ return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
42
+ }
43
+ },
44
+ };
45
+ }
46
+ /**
47
+ * The catalog as WebMCP tool descriptors, filtered per `options`. Tools the
48
+ * catalog marks `webmcp: false` (trial-key management) are never exposed,
49
+ * even when `include` names them.
50
+ */
51
+ export function jettyWebMcpTools(client, options = {}) {
52
+ const include = options.include ? new Set(options.include) : null;
53
+ const exclude = new Set(options.exclude ?? []);
54
+ return JETTY_WEBMCP_TOOLS.filter((tool) => (!include || include.has(tool.name)) &&
55
+ !exclude.has(tool.name) &&
56
+ (!options.readOnly || tool.annotations.readOnlyHint)).map((tool) => toWebMcpTool(tool, client, options.namePrefix));
57
+ }
58
+ /** `document.modelContext` first (current spec), then `navigator.modelContext`. */
59
+ export function findModelContext(globals = globalThis) {
60
+ for (const host of [globals.document, globals.navigator]) {
61
+ const candidate = host?.modelContext;
62
+ if (candidate &&
63
+ (typeof candidate.registerTool === "function" ||
64
+ typeof candidate.provideContext === "function")) {
65
+ return candidate;
66
+ }
67
+ }
68
+ return null;
69
+ }
70
+ /**
71
+ * Register the (filtered) catalog on `modelContext`. With `registerTool`,
72
+ * `signal` unregisters the tools when aborted; with `provideContext`, abort
73
+ * calls `clearContext()` when the context has one. A signal that is already
74
+ * aborted registers nothing (`via: null`).
75
+ */
76
+ export function registerJettyWebMcpTools(modelContext, client, options = {}) {
77
+ // An AbortSignal never replays an earlier abort, so a signal that is
78
+ // already aborted would register tools nothing ever unregisters.
79
+ if (options.signal?.aborted)
80
+ return { via: null, tools: [] };
81
+ const tools = jettyWebMcpTools(client, options);
82
+ const names = tools.map((tool) => tool.name);
83
+ if (typeof modelContext.registerTool === "function") {
84
+ for (const tool of tools) {
85
+ modelContext.registerTool(tool, options.signal ? { signal: options.signal } : undefined);
86
+ }
87
+ return { via: "registerTool", tools: names };
88
+ }
89
+ if (typeof modelContext.provideContext === "function") {
90
+ modelContext.provideContext({ tools });
91
+ if (options.signal && typeof modelContext.clearContext === "function") {
92
+ options.signal.addEventListener("abort", () => modelContext.clearContext?.(), { once: true });
93
+ }
94
+ return { via: "provideContext", tools: names };
95
+ }
96
+ return { via: null, tools: [] };
97
+ }
98
+ //# sourceMappingURL=webmcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webmcp.js","sourceRoot":"","sources":["../src/webmcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EACL,kBAAkB,EAClB,UAAU,GAIX,MAAM,uBAAuB,CAAC;AA6B/B,sDAAsD;AACtD,MAAM,UAAU,mBAAmB,CAAC,IAAyB;IAC3D,MAAM,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;QACzD,MAAM,EAAE,aAAa;QACrB,YAAY,EAAE,MAAM;KACrB,CAA4B,CAAC;I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D,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7C,IAAI,OAAO,YAAY,CAAC,YAAY,KAAK,UAAU,EAAE,CAAC;QACpD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,YAAY,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAC3F,CAAC;QACD,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC/C,CAAC;IACD,IAAI,OAAO,YAAY,CAAC,cAAc,KAAK,UAAU,EAAE,CAAC;QACtD,YAAY,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACvC,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,YAAY,CAAC,YAAY,KAAK,UAAU,EAAE,CAAC;YACtE,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAChG,CAAC;QACD,OAAO,EAAE,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IACjD,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AAClC,CAAC"}
package/package.json CHANGED
@@ -1,23 +1,68 @@
1
1
  {
2
2
  "name": "jetty-mcp-server",
3
- "version": "1.0.0",
4
- "description": "MCP server for Jetty AI/ML workflow platform",
3
+ "version": "1.1.0",
4
+ "description": "MCP server for the Jetty agent workload platform, plus the same tools for WebMCP in the browser",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "jetty-mcp-server": "dist/index.js"
8
8
  },
9
- "main": "dist/index.js",
9
+ "main": "dist/lib.js",
10
+ "types": "dist/lib.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/lib.d.ts",
14
+ "default": "./dist/lib.js"
15
+ },
16
+ "./client": {
17
+ "types": "./dist/client.d.ts",
18
+ "default": "./dist/client.js"
19
+ },
20
+ "./api-client": {
21
+ "types": "./dist/api-client.d.ts",
22
+ "default": "./dist/api-client.js"
23
+ },
24
+ "./tool-definitions": {
25
+ "types": "./dist/tool-definitions.d.ts",
26
+ "default": "./dist/tool-definitions.js"
27
+ },
28
+ "./tools": {
29
+ "types": "./dist/tools.d.ts",
30
+ "default": "./dist/tools.js"
31
+ },
32
+ "./webmcp": {
33
+ "types": "./dist/webmcp.d.ts",
34
+ "default": "./dist/webmcp.js"
35
+ },
36
+ "./package.json": "./package.json"
37
+ },
38
+ "files": [
39
+ "dist",
40
+ "README.md"
41
+ ],
42
+ "sideEffects": [
43
+ "./dist/index.js"
44
+ ],
10
45
  "scripts": {
11
46
  "build": "tsc",
12
47
  "dev": "tsc --watch",
13
48
  "start": "node dist/index.js",
49
+ "pretest": "npm run build",
50
+ "test": "node --test 'tests/**/*.test.mjs'",
14
51
  "prepublishOnly": "npm run build"
15
52
  },
16
- "keywords": ["mcp", "jetty", "ai", "ml", "workflows"],
53
+ "keywords": [
54
+ "mcp",
55
+ "webmcp",
56
+ "jetty",
57
+ "ai",
58
+ "agents",
59
+ "runbooks"
60
+ ],
17
61
  "license": "MIT",
18
62
  "dependencies": {
19
- "@modelcontextprotocol/sdk": "^1.12.1",
20
- "zod": "^3.24.4"
63
+ "@modelcontextprotocol/sdk": "^1.13.0",
64
+ "zod": "^3.24.4",
65
+ "zod-to-json-schema": "^3.24.1"
21
66
  },
22
67
  "devDependencies": {
23
68
  "@types/node": "^22.15.3",
package/src/client.ts DELETED
@@ -1,206 +0,0 @@
1
- const DOCK_URL = process.env.JETTY_DOCK_URL || "https://dock.jetty.io";
2
- const FLOWS_URL = process.env.JETTY_FLOWS_URL || "https://flows-api.jetty.io";
3
-
4
- export class JettyClient {
5
- private token: string;
6
- private dockUrl: string;
7
- private flowsUrl: string;
8
-
9
- constructor() {
10
- const token = process.env.JETTY_API_TOKEN;
11
- if (!token) {
12
- throw new Error(
13
- "JETTY_API_TOKEN environment variable is required. " +
14
- "Get your token at https://flows.jetty.io → Settings → API Tokens"
15
- );
16
- }
17
- this.token = token;
18
- this.dockUrl = DOCK_URL;
19
- this.flowsUrl = FLOWS_URL;
20
- }
21
-
22
- private async request(
23
- baseUrl: string,
24
- path: string,
25
- options: RequestInit = {}
26
- ): Promise<unknown> {
27
- const url = `${baseUrl}${path}`;
28
- const headers: Record<string, string> = {
29
- Authorization: `Bearer ${this.token}`,
30
- ...((options.headers as Record<string, string>) || {}),
31
- };
32
-
33
- const res = await fetch(url, { ...options, headers });
34
-
35
- if (!res.ok) {
36
- const body = await res.text();
37
- throw new Error(`Jetty API error ${res.status}: ${body}`);
38
- }
39
-
40
- const contentType = res.headers.get("content-type") || "";
41
- if (contentType.includes("application/json")) {
42
- return res.json();
43
- }
44
- return res.text();
45
- }
46
-
47
- private dock(path: string, options?: RequestInit) {
48
- return this.request(this.dockUrl, path, options);
49
- }
50
-
51
- private flows(path: string, options?: RequestInit) {
52
- return this.request(this.flowsUrl, path, options);
53
- }
54
-
55
- // Collections
56
- async listCollections() {
57
- return this.dock("/api/v1/collections/");
58
- }
59
-
60
- async getCollection(collection: string) {
61
- return this.dock(`/api/v1/collections/${collection}`);
62
- }
63
-
64
- // Tasks
65
- async listTasks(collection: string) {
66
- return this.dock(`/api/v1/tasks/${collection}/`);
67
- }
68
-
69
- async getTask(collection: string, task: string) {
70
- return this.dock(`/api/v1/tasks/${collection}/${task}`);
71
- }
72
-
73
- async createTask(
74
- collection: string,
75
- name: string,
76
- workflow: unknown,
77
- description?: string
78
- ) {
79
- return this.dock(`/api/v1/tasks/${collection}`, {
80
- method: "POST",
81
- headers: { "Content-Type": "application/json" },
82
- body: JSON.stringify({ name, description: description || "", workflow }),
83
- });
84
- }
85
-
86
- async updateTask(
87
- collection: string,
88
- task: string,
89
- updates: { workflow?: unknown; description?: string }
90
- ) {
91
- return this.dock(`/api/v1/tasks/${collection}/${task}`, {
92
- method: "PUT",
93
- headers: { "Content-Type": "application/json" },
94
- body: JSON.stringify(updates),
95
- });
96
- }
97
-
98
- async deleteTask(collection: string, task: string) {
99
- return this.dock(`/api/v1/tasks/${collection}/${task}`, {
100
- method: "DELETE",
101
- });
102
- }
103
-
104
- // Run workflows
105
- async runWorkflow(
106
- collection: string,
107
- task: string,
108
- initParams?: Record<string, unknown>
109
- ) {
110
- const formData = new FormData();
111
- formData.append("bakery_host", this.dockUrl);
112
- formData.append("init_params", JSON.stringify(initParams || {}));
113
-
114
- return this.flows(`/api/v1/run/${collection}/${task}`, {
115
- method: "POST",
116
- body: formData,
117
- });
118
- }
119
-
120
- async runWorkflowSync(
121
- collection: string,
122
- task: string,
123
- initParams?: Record<string, unknown>
124
- ) {
125
- const formData = new FormData();
126
- formData.append("bakery_host", this.dockUrl);
127
- formData.append("init_params", JSON.stringify(initParams || {}));
128
-
129
- return this.flows(`/api/v1/run-sync/${collection}/${task}`, {
130
- method: "POST",
131
- body: formData,
132
- });
133
- }
134
-
135
- // Trajectories
136
- async listTrajectories(
137
- collection: string,
138
- task: string,
139
- limit = 10,
140
- page = 1
141
- ) {
142
- return this.flows(
143
- `/api/v1/db/trajectories/${collection}/${task}?limit=${limit}&page=${page}`
144
- );
145
- }
146
-
147
- async getTrajectory(
148
- collection: string,
149
- task: string,
150
- trajectoryId: string
151
- ) {
152
- return this.flows(
153
- `/api/v1/db/trajectory/${collection}/${task}/${trajectoryId}`
154
- );
155
- }
156
-
157
- // Stats
158
- async getStats(collection: string, task: string) {
159
- return this.flows(`/api/v1/db/stats/${collection}/${task}`);
160
- }
161
-
162
- // Labels
163
- async addLabel(
164
- collection: string,
165
- task: string,
166
- trajectoryId: string,
167
- key: string,
168
- value: string,
169
- author: string
170
- ) {
171
- return this.flows(
172
- `/api/v1/trajectory/${collection}/${task}/${trajectoryId}/labels`,
173
- {
174
- method: "POST",
175
- headers: { "Content-Type": "application/json" },
176
- body: JSON.stringify({ key, value, author }),
177
- }
178
- );
179
- }
180
-
181
- // Workflow logs
182
- async getWorkflowLogs(workflowId: string) {
183
- return this.flows(`/api/v1/workflows-logs/${workflowId}`);
184
- }
185
-
186
- // Step templates
187
- async listStepTemplates() {
188
- return this.request(this.flowsUrl, "/api/v1/step-templates");
189
- }
190
-
191
- async getStepTemplate(name: string) {
192
- return this.request(this.flowsUrl, `/api/v1/step-templates/${name}`);
193
- }
194
-
195
- // Environment variables
196
- async setEnvironmentVars(
197
- collection: string,
198
- vars: Record<string, string>
199
- ) {
200
- return this.dock(`/api/v1/collections/${collection}/environment`, {
201
- method: "PATCH",
202
- headers: { "Content-Type": "application/json" },
203
- body: JSON.stringify({ environment_variables: vars }),
204
- });
205
- }
206
- }
package/src/index.ts DELETED
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
- import { JettyClient } from "./client.js";
6
- import { registerTools } from "./tools.js";
7
-
8
- const server = new McpServer({
9
- name: "jetty",
10
- version: "1.0.0",
11
- });
12
-
13
- const client = new JettyClient();
14
- registerTools(server, client);
15
-
16
- const transport = new StdioServerTransport();
17
- await server.connect(transport);