@firfi/huly-mcp 0.8.0 → 0.9.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/README.md +11 -1
- package/dist/index.cjs +25858 -25303
- package/package.json +31 -19
- package/dist/index.js +0 -116694
- package/dist/src/config/config.d.ts +0 -94
- package/dist/src/config/config.d.ts.map +0 -1
- package/dist/src/config/config.js +0 -247
- package/dist/src/config/config.js.map +0 -1
- package/dist/src/domain/schemas.d.ts +0 -256
- package/dist/src/domain/schemas.d.ts.map +0 -1
- package/dist/src/domain/schemas.js +0 -275
- package/dist/src/domain/schemas.js.map +0 -1
- package/dist/src/huly/client.d.ts +0 -63
- package/dist/src/huly/client.d.ts.map +0 -1
- package/dist/src/huly/client.js +0 -149
- package/dist/src/huly/client.js.map +0 -1
- package/dist/src/huly/errors.d.ts +0 -133
- package/dist/src/huly/errors.d.ts.map +0 -1
- package/dist/src/huly/errors.js +0 -108
- package/dist/src/huly/errors.js.map +0 -1
- package/dist/src/huly/operations/issues.d.ts +0 -122
- package/dist/src/huly/operations/issues.d.ts.map +0 -1
- package/dist/src/huly/operations/issues.js +0 -627
- package/dist/src/huly/operations/issues.js.map +0 -1
- package/dist/src/index.d.ts +0 -43
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -154
- package/dist/src/index.js.map +0 -1
- package/dist/src/mcp/error-mapping.d.ts +0 -67
- package/dist/src/mcp/error-mapping.d.ts.map +0 -1
- package/dist/src/mcp/error-mapping.js +0 -195
- package/dist/src/mcp/error-mapping.js.map +0 -1
- package/dist/src/mcp/server.d.ts +0 -86
- package/dist/src/mcp/server.d.ts.map +0 -1
- package/dist/src/mcp/server.js +0 -216
- package/dist/src/mcp/server.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Domain type schemas for Huly MCP server.
|
|
3
|
-
*
|
|
4
|
-
* Type-safe representations of Huly domain objects (issues, projects, people)
|
|
5
|
-
* with validation. Schemas enable:
|
|
6
|
-
* - Parsing Huly API responses into typed objects
|
|
7
|
-
* - Validating MCP tool parameters
|
|
8
|
-
* - JSON Schema generation for MCP tool definitions
|
|
9
|
-
*
|
|
10
|
-
* @module
|
|
11
|
-
*/
|
|
12
|
-
import { JSONSchema, Schema } from "effect";
|
|
13
|
-
// --- Primitive Schemas ---
|
|
14
|
-
/**
|
|
15
|
-
* Non-empty string schema.
|
|
16
|
-
*/
|
|
17
|
-
const NonEmptyString = Schema.String.pipe(Schema.filter((s) => s.trim().length > 0, { message: () => "Must not be empty" }));
|
|
18
|
-
/**
|
|
19
|
-
* ISO timestamp schema (number representing milliseconds since epoch).
|
|
20
|
-
*/
|
|
21
|
-
const Timestamp = Schema.Number.pipe(Schema.int({ message: () => "Timestamp must be an integer" }), Schema.nonNegative({ message: () => "Timestamp must be non-negative" }));
|
|
22
|
-
// --- Priority Schema ---
|
|
23
|
-
/**
|
|
24
|
-
* Issue priority values.
|
|
25
|
-
* Maps to Huly IssuePriority enum: NoPriority=0, Urgent=1, High=2, Medium=3, Low=4
|
|
26
|
-
*/
|
|
27
|
-
export const IssuePriorityValues = ["urgent", "high", "medium", "low", "no-priority"];
|
|
28
|
-
/**
|
|
29
|
-
* Issue priority schema.
|
|
30
|
-
*/
|
|
31
|
-
export const IssuePrioritySchema = Schema.Literal(...IssuePriorityValues).annotations({
|
|
32
|
-
title: "IssuePriority",
|
|
33
|
-
description: "Issue priority level",
|
|
34
|
-
});
|
|
35
|
-
// --- Label Schema ---
|
|
36
|
-
/**
|
|
37
|
-
* Label schema for issue tags/labels.
|
|
38
|
-
*/
|
|
39
|
-
export const LabelSchema = Schema.Struct({
|
|
40
|
-
title: NonEmptyString,
|
|
41
|
-
color: Schema.optional(Schema.Number),
|
|
42
|
-
}).annotations({
|
|
43
|
-
title: "Label",
|
|
44
|
-
description: "Issue label/tag",
|
|
45
|
-
});
|
|
46
|
-
// --- Person Schema ---
|
|
47
|
-
/**
|
|
48
|
-
* Person reference schema (assignee, reporter).
|
|
49
|
-
*/
|
|
50
|
-
export const PersonRefSchema = Schema.Struct({
|
|
51
|
-
id: NonEmptyString,
|
|
52
|
-
name: Schema.optional(Schema.String),
|
|
53
|
-
email: Schema.optional(Schema.String),
|
|
54
|
-
}).annotations({
|
|
55
|
-
title: "PersonRef",
|
|
56
|
-
description: "Reference to a person (assignee, reporter)",
|
|
57
|
-
});
|
|
58
|
-
// --- Project Schema ---
|
|
59
|
-
/**
|
|
60
|
-
* Project summary schema for list operations.
|
|
61
|
-
*/
|
|
62
|
-
export const ProjectSummarySchema = Schema.Struct({
|
|
63
|
-
identifier: NonEmptyString,
|
|
64
|
-
name: Schema.String,
|
|
65
|
-
description: Schema.optional(Schema.String),
|
|
66
|
-
}).annotations({
|
|
67
|
-
title: "ProjectSummary",
|
|
68
|
-
description: "Project summary for list operations",
|
|
69
|
-
});
|
|
70
|
-
/**
|
|
71
|
-
* Full project schema with statuses.
|
|
72
|
-
*/
|
|
73
|
-
export const ProjectSchema = Schema.Struct({
|
|
74
|
-
identifier: NonEmptyString,
|
|
75
|
-
name: Schema.String,
|
|
76
|
-
description: Schema.optional(Schema.String),
|
|
77
|
-
defaultStatus: Schema.optional(Schema.String),
|
|
78
|
-
statuses: Schema.optional(Schema.Array(Schema.String)),
|
|
79
|
-
}).annotations({
|
|
80
|
-
title: "Project",
|
|
81
|
-
description: "Full project with status information",
|
|
82
|
-
});
|
|
83
|
-
// --- Issue Schemas ---
|
|
84
|
-
/**
|
|
85
|
-
* Issue summary schema for list operations.
|
|
86
|
-
* Lighter weight than full Issue - used when listing multiple issues.
|
|
87
|
-
*/
|
|
88
|
-
export const IssueSummarySchema = Schema.Struct({
|
|
89
|
-
identifier: NonEmptyString,
|
|
90
|
-
title: Schema.String,
|
|
91
|
-
status: Schema.String,
|
|
92
|
-
priority: Schema.optional(IssuePrioritySchema),
|
|
93
|
-
assignee: Schema.optional(Schema.String),
|
|
94
|
-
modifiedOn: Schema.optional(Timestamp),
|
|
95
|
-
}).annotations({
|
|
96
|
-
title: "IssueSummary",
|
|
97
|
-
description: "Issue summary for list operations",
|
|
98
|
-
});
|
|
99
|
-
/**
|
|
100
|
-
* Full issue schema with all fields.
|
|
101
|
-
*/
|
|
102
|
-
export const IssueSchema = Schema.Struct({
|
|
103
|
-
identifier: NonEmptyString,
|
|
104
|
-
title: Schema.String,
|
|
105
|
-
description: Schema.optional(Schema.String),
|
|
106
|
-
status: Schema.String,
|
|
107
|
-
priority: Schema.optional(IssuePrioritySchema),
|
|
108
|
-
assignee: Schema.optional(Schema.String),
|
|
109
|
-
assigneeRef: Schema.optional(PersonRefSchema),
|
|
110
|
-
labels: Schema.optional(Schema.Array(LabelSchema)),
|
|
111
|
-
project: NonEmptyString,
|
|
112
|
-
modifiedOn: Schema.optional(Timestamp),
|
|
113
|
-
createdOn: Schema.optional(Timestamp),
|
|
114
|
-
dueDate: Schema.optional(Schema.NullOr(Timestamp)),
|
|
115
|
-
estimation: Schema.optional(Schema.Number),
|
|
116
|
-
}).annotations({
|
|
117
|
-
title: "Issue",
|
|
118
|
-
description: "Full issue with all fields",
|
|
119
|
-
});
|
|
120
|
-
// --- MCP Tool Parameter Schemas ---
|
|
121
|
-
/**
|
|
122
|
-
* Parameters for list_issues tool.
|
|
123
|
-
*/
|
|
124
|
-
export const ListIssuesParamsSchema = Schema.Struct({
|
|
125
|
-
project: NonEmptyString.annotations({
|
|
126
|
-
description: "Project identifier (e.g., 'HULY')",
|
|
127
|
-
}),
|
|
128
|
-
status: Schema.optional(Schema.String.annotations({
|
|
129
|
-
description: "Filter by status name",
|
|
130
|
-
})),
|
|
131
|
-
assignee: Schema.optional(Schema.String.annotations({
|
|
132
|
-
description: "Filter by assignee email",
|
|
133
|
-
})),
|
|
134
|
-
limit: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.positive()).annotations({
|
|
135
|
-
description: "Maximum number of issues to return (default: 20)",
|
|
136
|
-
})),
|
|
137
|
-
}).annotations({
|
|
138
|
-
title: "ListIssuesParams",
|
|
139
|
-
description: "Parameters for listing issues",
|
|
140
|
-
});
|
|
141
|
-
/**
|
|
142
|
-
* Parameters for get_issue tool.
|
|
143
|
-
*/
|
|
144
|
-
export const GetIssueParamsSchema = Schema.Struct({
|
|
145
|
-
project: NonEmptyString.annotations({
|
|
146
|
-
description: "Project identifier (e.g., 'HULY')",
|
|
147
|
-
}),
|
|
148
|
-
identifier: NonEmptyString.annotations({
|
|
149
|
-
description: "Issue identifier (e.g., 'HULY-123')",
|
|
150
|
-
}),
|
|
151
|
-
}).annotations({
|
|
152
|
-
title: "GetIssueParams",
|
|
153
|
-
description: "Parameters for getting a single issue",
|
|
154
|
-
});
|
|
155
|
-
/**
|
|
156
|
-
* Parameters for create_issue tool.
|
|
157
|
-
*/
|
|
158
|
-
export const CreateIssueParamsSchema = Schema.Struct({
|
|
159
|
-
project: NonEmptyString.annotations({
|
|
160
|
-
description: "Project identifier (e.g., 'HULY')",
|
|
161
|
-
}),
|
|
162
|
-
title: NonEmptyString.annotations({
|
|
163
|
-
description: "Issue title",
|
|
164
|
-
}),
|
|
165
|
-
description: Schema.optional(Schema.String.annotations({
|
|
166
|
-
description: "Issue description (markdown supported)",
|
|
167
|
-
})),
|
|
168
|
-
priority: Schema.optional(IssuePrioritySchema.annotations({
|
|
169
|
-
description: "Issue priority (urgent, high, medium, low, no-priority)",
|
|
170
|
-
})),
|
|
171
|
-
assignee: Schema.optional(Schema.String.annotations({
|
|
172
|
-
description: "Assignee email address",
|
|
173
|
-
})),
|
|
174
|
-
status: Schema.optional(Schema.String.annotations({
|
|
175
|
-
description: "Initial status (uses project default if not specified)",
|
|
176
|
-
})),
|
|
177
|
-
}).annotations({
|
|
178
|
-
title: "CreateIssueParams",
|
|
179
|
-
description: "Parameters for creating an issue",
|
|
180
|
-
});
|
|
181
|
-
/**
|
|
182
|
-
* Parameters for update_issue tool.
|
|
183
|
-
*/
|
|
184
|
-
export const UpdateIssueParamsSchema = Schema.Struct({
|
|
185
|
-
project: NonEmptyString.annotations({
|
|
186
|
-
description: "Project identifier (e.g., 'HULY')",
|
|
187
|
-
}),
|
|
188
|
-
identifier: NonEmptyString.annotations({
|
|
189
|
-
description: "Issue identifier (e.g., 'HULY-123')",
|
|
190
|
-
}),
|
|
191
|
-
title: Schema.optional(NonEmptyString.annotations({
|
|
192
|
-
description: "New issue title",
|
|
193
|
-
})),
|
|
194
|
-
description: Schema.optional(Schema.String.annotations({
|
|
195
|
-
description: "New issue description (markdown supported)",
|
|
196
|
-
})),
|
|
197
|
-
priority: Schema.optional(IssuePrioritySchema.annotations({
|
|
198
|
-
description: "New issue priority",
|
|
199
|
-
})),
|
|
200
|
-
assignee: Schema.optional(Schema.NullOr(Schema.String).annotations({
|
|
201
|
-
description: "New assignee email (null to unassign)",
|
|
202
|
-
})),
|
|
203
|
-
status: Schema.optional(Schema.String.annotations({
|
|
204
|
-
description: "New status",
|
|
205
|
-
})),
|
|
206
|
-
}).annotations({
|
|
207
|
-
title: "UpdateIssueParams",
|
|
208
|
-
description: "Parameters for updating an issue",
|
|
209
|
-
});
|
|
210
|
-
/**
|
|
211
|
-
* Parameters for add_label tool.
|
|
212
|
-
*/
|
|
213
|
-
export const AddLabelParamsSchema = Schema.Struct({
|
|
214
|
-
project: NonEmptyString.annotations({
|
|
215
|
-
description: "Project identifier (e.g., 'HULY')",
|
|
216
|
-
}),
|
|
217
|
-
identifier: NonEmptyString.annotations({
|
|
218
|
-
description: "Issue identifier (e.g., 'HULY-123')",
|
|
219
|
-
}),
|
|
220
|
-
label: NonEmptyString.annotations({
|
|
221
|
-
description: "Label name to add",
|
|
222
|
-
}),
|
|
223
|
-
color: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.greaterThanOrEqualTo(0), Schema.lessThanOrEqualTo(9)).annotations({
|
|
224
|
-
description: "Color code (0-9, default: 0)",
|
|
225
|
-
})),
|
|
226
|
-
}).annotations({
|
|
227
|
-
title: "AddLabelParams",
|
|
228
|
-
description: "Parameters for adding a label to an issue",
|
|
229
|
-
});
|
|
230
|
-
// --- JSON Schema Generation ---
|
|
231
|
-
/**
|
|
232
|
-
* Generate JSON Schema from an Effect Schema.
|
|
233
|
-
* Use for MCP tool parameter definitions.
|
|
234
|
-
*/
|
|
235
|
-
export const makeJsonSchema = (schema) => JSONSchema.make(schema);
|
|
236
|
-
// Pre-generated JSON schemas for MCP tools
|
|
237
|
-
export const listIssuesParamsJsonSchema = makeJsonSchema(ListIssuesParamsSchema);
|
|
238
|
-
export const getIssueParamsJsonSchema = makeJsonSchema(GetIssueParamsSchema);
|
|
239
|
-
export const createIssueParamsJsonSchema = makeJsonSchema(CreateIssueParamsSchema);
|
|
240
|
-
export const updateIssueParamsJsonSchema = makeJsonSchema(UpdateIssueParamsSchema);
|
|
241
|
-
export const addLabelParamsJsonSchema = makeJsonSchema(AddLabelParamsSchema);
|
|
242
|
-
// --- Parsing Utilities ---
|
|
243
|
-
/**
|
|
244
|
-
* Parse unknown data into an Issue.
|
|
245
|
-
*/
|
|
246
|
-
export const parseIssue = Schema.decodeUnknown(IssueSchema);
|
|
247
|
-
/**
|
|
248
|
-
* Parse unknown data into an IssueSummary.
|
|
249
|
-
*/
|
|
250
|
-
export const parseIssueSummary = Schema.decodeUnknown(IssueSummarySchema);
|
|
251
|
-
/**
|
|
252
|
-
* Parse unknown data into a Project.
|
|
253
|
-
*/
|
|
254
|
-
export const parseProject = Schema.decodeUnknown(ProjectSchema);
|
|
255
|
-
/**
|
|
256
|
-
* Parse unknown data into ListIssuesParams.
|
|
257
|
-
*/
|
|
258
|
-
export const parseListIssuesParams = Schema.decodeUnknown(ListIssuesParamsSchema);
|
|
259
|
-
/**
|
|
260
|
-
* Parse unknown data into GetIssueParams.
|
|
261
|
-
*/
|
|
262
|
-
export const parseGetIssueParams = Schema.decodeUnknown(GetIssueParamsSchema);
|
|
263
|
-
/**
|
|
264
|
-
* Parse unknown data into CreateIssueParams.
|
|
265
|
-
*/
|
|
266
|
-
export const parseCreateIssueParams = Schema.decodeUnknown(CreateIssueParamsSchema);
|
|
267
|
-
/**
|
|
268
|
-
* Parse unknown data into UpdateIssueParams.
|
|
269
|
-
*/
|
|
270
|
-
export const parseUpdateIssueParams = Schema.decodeUnknown(UpdateIssueParamsSchema);
|
|
271
|
-
/**
|
|
272
|
-
* Parse unknown data into AddLabelParams.
|
|
273
|
-
*/
|
|
274
|
-
export const parseAddLabelParams = Schema.decodeUnknown(AddLabelParamsSchema);
|
|
275
|
-
//# sourceMappingURL=schemas.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../src/domain/schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE3C,4BAA4B;AAE5B;;GAEG;AACH,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CACvC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB,EAAE,CAAC,CAClF,CAAA;AAED;;GAEG;AACH,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAClC,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,8BAA8B,EAAE,CAAC,EAC7D,MAAM,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,gCAAgC,EAAE,CAAC,CACxE,CAAA;AAED,0BAA0B;AAE1B;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,CAAU,CAAA;AAE9F;;GAEG;AACH,MAAM,CAAC,MAAM,mBA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aAAa,CAAC,oBAAoB,CAAC,CAAA;AAE7E;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,aAAa,CAAC,uBAAuB,CAAC,CAAA;AAEnF;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,aAAa,CAAC,uBAAuB,CAAC,CAAA;AAEnF;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAA"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import type { AttachedData, AttachedDoc, Class, Data, Doc, DocumentQuery, DocumentUpdate, FindOptions, FindResult, Ref, Space, TxResult, WithLookup } from "@hcengineering/core";
|
|
2
|
-
import type { MarkupFormat, MarkupRef } from "@hcengineering/api-client";
|
|
3
|
-
import { Context, Effect, Layer } from "effect";
|
|
4
|
-
import { HulyAuthError, HulyConnectionError } from "./errors.js";
|
|
5
|
-
import { HulyConfigService } from "../config/config.js";
|
|
6
|
-
/**
|
|
7
|
-
* Union of errors that HulyClient operations can produce.
|
|
8
|
-
*/
|
|
9
|
-
export type HulyClientError = HulyConnectionError | HulyAuthError;
|
|
10
|
-
/**
|
|
11
|
-
* Operations exposed by the HulyClient service.
|
|
12
|
-
* Wraps PlatformClient methods with Effect error handling.
|
|
13
|
-
*/
|
|
14
|
-
export interface HulyClientOperations {
|
|
15
|
-
/**
|
|
16
|
-
* Find multiple documents.
|
|
17
|
-
*/
|
|
18
|
-
readonly findAll: <T extends Doc>(_class: Ref<Class<T>>, query: DocumentQuery<T>, options?: FindOptions<T>) => Effect.Effect<FindResult<T>, HulyClientError>;
|
|
19
|
-
/**
|
|
20
|
-
* Find a single document.
|
|
21
|
-
*/
|
|
22
|
-
readonly findOne: <T extends Doc>(_class: Ref<Class<T>>, query: DocumentQuery<T>, options?: FindOptions<T>) => Effect.Effect<WithLookup<T> | undefined, HulyClientError>;
|
|
23
|
-
/**
|
|
24
|
-
* Create a new document.
|
|
25
|
-
*/
|
|
26
|
-
readonly createDoc: <T extends Doc>(_class: Ref<Class<T>>, space: Ref<Space>, attributes: Data<T>, id?: Ref<T>) => Effect.Effect<Ref<T>, HulyClientError>;
|
|
27
|
-
/**
|
|
28
|
-
* Update an existing document.
|
|
29
|
-
*/
|
|
30
|
-
readonly updateDoc: <T extends Doc>(_class: Ref<Class<T>>, space: Ref<Space>, objectId: Ref<T>, operations: DocumentUpdate<T>, retrieve?: boolean) => Effect.Effect<TxResult, HulyClientError>;
|
|
31
|
-
/**
|
|
32
|
-
* Add a document to a collection.
|
|
33
|
-
*/
|
|
34
|
-
readonly addCollection: <T extends Doc, P extends AttachedDoc>(_class: Ref<Class<P>>, space: Ref<Space>, attachedTo: Ref<T>, attachedToClass: Ref<Class<T>>, collection: string, attributes: AttachedData<P>, id?: Ref<P>) => Effect.Effect<Ref<P>, HulyClientError>;
|
|
35
|
-
/**
|
|
36
|
-
* Upload markup content.
|
|
37
|
-
*/
|
|
38
|
-
readonly uploadMarkup: (objectClass: Ref<Class<Doc>>, objectId: Ref<Doc>, objectAttr: string, markup: string, format: MarkupFormat) => Effect.Effect<MarkupRef, HulyClientError>;
|
|
39
|
-
/**
|
|
40
|
-
* Fetch markup content.
|
|
41
|
-
*/
|
|
42
|
-
readonly fetchMarkup: (objectClass: Ref<Class<Doc>>, objectId: Ref<Doc>, objectAttr: string, id: MarkupRef, format: MarkupFormat) => Effect.Effect<string, HulyClientError>;
|
|
43
|
-
}
|
|
44
|
-
declare const HulyClient_base: Context.TagClass<HulyClient, "@hulymcp/HulyClient", HulyClientOperations>;
|
|
45
|
-
/**
|
|
46
|
-
* HulyClient service tag.
|
|
47
|
-
* Provides authenticated access to Huly platform operations.
|
|
48
|
-
*/
|
|
49
|
-
export declare class HulyClient extends HulyClient_base {
|
|
50
|
-
/**
|
|
51
|
-
* Production layer - connects to Huly platform.
|
|
52
|
-
* Connection is lazy (on first use) and cached.
|
|
53
|
-
* Handles graceful shutdown on scope finalization.
|
|
54
|
-
*/
|
|
55
|
-
static readonly layer: Layer.Layer<HulyClient, HulyClientError, HulyConfigService>;
|
|
56
|
-
/**
|
|
57
|
-
* Create a test layer with mock operations.
|
|
58
|
-
* For unit testing without actual Huly connection.
|
|
59
|
-
*/
|
|
60
|
-
static testLayer(mockOperations: Partial<HulyClientOperations>): Layer.Layer<HulyClient>;
|
|
61
|
-
}
|
|
62
|
-
export {};
|
|
63
|
-
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/huly/client.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,KAAK,EACL,IAAI,EACJ,GAAG,EACH,aAAa,EACb,cAAc,EACd,WAAW,EACX,UAAU,EACV,GAAG,EACH,KAAK,EACL,QAAQ,EACR,UAAU,EACX,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAsB,MAAM,QAAQ,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAIvD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG,aAAa,CAAA;AAIjE;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,SAAS,GAAG,EAC9B,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACrB,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EACvB,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,KACrB,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAA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
|
-
* HulyClient service for Huly MCP server.
|
|
3
|
-
*
|
|
4
|
-
* Provides authenticated connection to Huly platform with:
|
|
5
|
-
* - Lazy connection (connects on first use)
|
|
6
|
-
* - Connection caching (reuses same connection)
|
|
7
|
-
* - Graceful shutdown (closes on scope finalization)
|
|
8
|
-
* - Retry on connection failures
|
|
9
|
-
* - Error mapping to HulyConnectionError/HulyAuthError
|
|
10
|
-
*
|
|
11
|
-
* @module
|
|
12
|
-
*/
|
|
13
|
-
import { connect, NodeWebSocketFactory, } from "@hcengineering/api-client";
|
|
14
|
-
import { Context, Effect, Layer, Redacted, Schedule } from "effect";
|
|
15
|
-
import { HulyAuthError, HulyConnectionError } from "./errors.js";
|
|
16
|
-
import { HulyConfigService } from "../config/config.js";
|
|
17
|
-
// --- HulyClient Service Tag ---
|
|
18
|
-
/**
|
|
19
|
-
* HulyClient service tag.
|
|
20
|
-
* Provides authenticated access to Huly platform operations.
|
|
21
|
-
*/
|
|
22
|
-
export class HulyClient extends Context.Tag("@hulymcp/HulyClient")() {
|
|
23
|
-
/**
|
|
24
|
-
* Production layer - connects to Huly platform.
|
|
25
|
-
* Connection is lazy (on first use) and cached.
|
|
26
|
-
* Handles graceful shutdown on scope finalization.
|
|
27
|
-
*/
|
|
28
|
-
static layer = Layer.scoped(HulyClient, Effect.gen(function* () {
|
|
29
|
-
const config = yield* HulyConfigService;
|
|
30
|
-
// Lazy connection - only connect when first operation is called
|
|
31
|
-
let cachedClient = null;
|
|
32
|
-
const getClient = Effect.suspend(() => {
|
|
33
|
-
if (cachedClient !== null) {
|
|
34
|
-
return Effect.succeed(cachedClient);
|
|
35
|
-
}
|
|
36
|
-
return connectWithRetry({
|
|
37
|
-
url: config.url,
|
|
38
|
-
email: config.email,
|
|
39
|
-
password: Redacted.value(config.password),
|
|
40
|
-
workspace: config.workspace,
|
|
41
|
-
connectionTimeout: config.connectionTimeout,
|
|
42
|
-
}).pipe(Effect.tap((client) => Effect.sync(() => {
|
|
43
|
-
cachedClient = client;
|
|
44
|
-
})));
|
|
45
|
-
});
|
|
46
|
-
// Register cleanup on scope finalization
|
|
47
|
-
yield* Effect.addFinalizer(() => Effect.suspend(() => {
|
|
48
|
-
if (cachedClient !== null) {
|
|
49
|
-
const client = cachedClient;
|
|
50
|
-
cachedClient = null;
|
|
51
|
-
return Effect.promise(() => client.close()).pipe(Effect.catchAll(() => Effect.void));
|
|
52
|
-
}
|
|
53
|
-
return Effect.void;
|
|
54
|
-
}));
|
|
55
|
-
// Helper to wrap operations with connection
|
|
56
|
-
const withClient = (op, errorMsg) => Effect.gen(function* () {
|
|
57
|
-
const client = yield* getClient;
|
|
58
|
-
return yield* Effect.tryPromise({
|
|
59
|
-
try: () => op(client),
|
|
60
|
-
catch: (e) => new HulyConnectionError({
|
|
61
|
-
message: `${errorMsg}: ${String(e)}`,
|
|
62
|
-
cause: e,
|
|
63
|
-
}),
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
// Create service operations
|
|
67
|
-
const operations = {
|
|
68
|
-
findAll: (_class, query, options) => withClient((client) => client.findAll(_class, query, options), "findAll failed"),
|
|
69
|
-
findOne: (_class, query, options) => withClient((client) => client.findOne(_class, query, options), "findOne failed"),
|
|
70
|
-
createDoc: (_class, space, attributes, id) => withClient((client) => client.createDoc(_class, space, attributes, id), "createDoc failed"),
|
|
71
|
-
updateDoc: (_class, space, objectId, ops, retrieve) => withClient((client) => client.updateDoc(_class, space, objectId, ops, retrieve), "updateDoc failed"),
|
|
72
|
-
addCollection: (_class, space, attachedTo, attachedToClass, collection, attributes, id) => withClient((client) => client.addCollection(_class, space, attachedTo, attachedToClass, collection, attributes, id), "addCollection failed"),
|
|
73
|
-
uploadMarkup: (objectClass, objectId, objectAttr, markup, format) => withClient((client) => client.uploadMarkup(objectClass, objectId, objectAttr, markup, format), "uploadMarkup failed"),
|
|
74
|
-
fetchMarkup: (objectClass, objectId, objectAttr, id, format) => withClient((client) => client.fetchMarkup(objectClass, objectId, objectAttr, id, format), "fetchMarkup failed"),
|
|
75
|
-
};
|
|
76
|
-
return operations;
|
|
77
|
-
}));
|
|
78
|
-
/**
|
|
79
|
-
* Create a test layer with mock operations.
|
|
80
|
-
* For unit testing without actual Huly connection.
|
|
81
|
-
*/
|
|
82
|
-
static testLayer(mockOperations) {
|
|
83
|
-
const noopFindAll = () => Effect.succeed([]);
|
|
84
|
-
const noopFindOne = () => Effect.succeed(undefined);
|
|
85
|
-
const noopCreateDoc = () => Effect.succeed("");
|
|
86
|
-
const noopUpdateDoc = () => Effect.succeed({});
|
|
87
|
-
const noopAddCollection = () => Effect.succeed("");
|
|
88
|
-
const noopUploadMarkup = () => Effect.succeed("");
|
|
89
|
-
const noopFetchMarkup = () => Effect.succeed("");
|
|
90
|
-
const defaultOps = {
|
|
91
|
-
findAll: noopFindAll,
|
|
92
|
-
findOne: noopFindOne,
|
|
93
|
-
createDoc: noopCreateDoc,
|
|
94
|
-
updateDoc: noopUpdateDoc,
|
|
95
|
-
addCollection: noopAddCollection,
|
|
96
|
-
uploadMarkup: noopUploadMarkup,
|
|
97
|
-
fetchMarkup: noopFetchMarkup,
|
|
98
|
-
};
|
|
99
|
-
return Layer.succeed(HulyClient, { ...defaultOps, ...mockOperations });
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Check if error looks like an auth error.
|
|
104
|
-
*/
|
|
105
|
-
const isAuthError = (error) => {
|
|
106
|
-
const msg = String(error).toLowerCase();
|
|
107
|
-
return (msg.includes("unauthorized") ||
|
|
108
|
-
msg.includes("authentication") ||
|
|
109
|
-
msg.includes("auth") ||
|
|
110
|
-
msg.includes("credentials") ||
|
|
111
|
-
msg.includes("401") ||
|
|
112
|
-
msg.includes("invalid password") ||
|
|
113
|
-
msg.includes("invalid email"));
|
|
114
|
-
};
|
|
115
|
-
/**
|
|
116
|
-
* Connect to Huly with retry policy.
|
|
117
|
-
* Retries on transient connection errors, fails fast on auth errors.
|
|
118
|
-
*/
|
|
119
|
-
const connectWithRetry = (config) => {
|
|
120
|
-
const attemptConnect = Effect.tryPromise({
|
|
121
|
-
try: () => connect(config.url, {
|
|
122
|
-
email: config.email,
|
|
123
|
-
password: config.password,
|
|
124
|
-
workspace: config.workspace,
|
|
125
|
-
socketFactory: NodeWebSocketFactory,
|
|
126
|
-
connectionTimeout: config.connectionTimeout,
|
|
127
|
-
}),
|
|
128
|
-
catch: (e) => {
|
|
129
|
-
if (isAuthError(e)) {
|
|
130
|
-
return new HulyAuthError({
|
|
131
|
-
message: `Authentication failed: ${String(e)}`,
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
return new HulyConnectionError({
|
|
135
|
-
message: `Connection failed: ${String(e)}`,
|
|
136
|
-
cause: e,
|
|
137
|
-
});
|
|
138
|
-
},
|
|
139
|
-
});
|
|
140
|
-
// Retry policy: 3 attempts with exponential backoff
|
|
141
|
-
// Don't retry auth errors (they won't succeed on retry)
|
|
142
|
-
const retrySchedule = Schedule.exponential("100 millis").pipe(Schedule.compose(Schedule.recurs(2)) // 3 total attempts
|
|
143
|
-
);
|
|
144
|
-
return attemptConnect.pipe(Effect.retry({
|
|
145
|
-
schedule: retrySchedule,
|
|
146
|
-
while: (e) => !(e instanceof HulyAuthError),
|
|
147
|
-
}));
|
|
148
|
-
};
|
|
149
|
-
//# sourceMappingURL=client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/huly/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,OAAO,EACP,oBAAoB,GAErB,MAAM,2BAA2B,CAAA;AAiBlC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AA2FvD,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AC,KAAK,CAAC;QACX,QAAQ,EAAE,aAAa;QACvB,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,aAAa,CAAC;KAC5C,CAAC,CACH,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error hierarchy for Huly MCP server.
|
|
3
|
-
*
|
|
4
|
-
* Tagged errors for pattern matching in Effect code.
|
|
5
|
-
* Maps to MCP error codes:
|
|
6
|
-
* - -32602 (Invalid params): IssueNotFoundError, ProjectNotFoundError, InvalidStatusError
|
|
7
|
-
* - -32603 (Internal error): HulyConnectionError, HulyAuthError, HulyError
|
|
8
|
-
*
|
|
9
|
-
* @module
|
|
10
|
-
*/
|
|
11
|
-
import { Schema } from "effect";
|
|
12
|
-
/**
|
|
13
|
-
* MCP standard error codes.
|
|
14
|
-
*/
|
|
15
|
-
export declare const McpErrorCode: {
|
|
16
|
-
readonly InvalidParams: -32602;
|
|
17
|
-
readonly InternalError: -32603;
|
|
18
|
-
};
|
|
19
|
-
export type McpErrorCode = (typeof McpErrorCode)[keyof typeof McpErrorCode];
|
|
20
|
-
declare const HulyError_base: Schema.TaggedErrorClass<HulyError, "HulyError", {
|
|
21
|
-
readonly _tag: Schema.tag<"HulyError">;
|
|
22
|
-
} & {
|
|
23
|
-
message: typeof Schema.String;
|
|
24
|
-
cause: Schema.optional<typeof Schema.Defect>;
|
|
25
|
-
}>;
|
|
26
|
-
/**
|
|
27
|
-
* Base Huly error - generic operational error.
|
|
28
|
-
* Maps to MCP -32603 (Internal error).
|
|
29
|
-
*/
|
|
30
|
-
export declare class HulyError extends HulyError_base {
|
|
31
|
-
readonly mcpErrorCode: McpErrorCode;
|
|
32
|
-
}
|
|
33
|
-
declare const HulyConnectionError_base: Schema.TaggedErrorClass<HulyConnectionError, "HulyConnectionError", {
|
|
34
|
-
readonly _tag: Schema.tag<"HulyConnectionError">;
|
|
35
|
-
} & {
|
|
36
|
-
message: typeof Schema.String;
|
|
37
|
-
cause: Schema.optional<typeof Schema.Defect>;
|
|
38
|
-
}>;
|
|
39
|
-
/**
|
|
40
|
-
* Connection error - network/transport failures.
|
|
41
|
-
* Maps to MCP -32603 (Internal error).
|
|
42
|
-
*/
|
|
43
|
-
export declare class HulyConnectionError extends HulyConnectionError_base {
|
|
44
|
-
readonly mcpErrorCode: McpErrorCode;
|
|
45
|
-
}
|
|
46
|
-
declare const HulyAuthError_base: Schema.TaggedErrorClass<HulyAuthError, "HulyAuthError", {
|
|
47
|
-
readonly _tag: Schema.tag<"HulyAuthError">;
|
|
48
|
-
} & {
|
|
49
|
-
message: typeof Schema.String;
|
|
50
|
-
}>;
|
|
51
|
-
/**
|
|
52
|
-
* Authentication error - invalid credentials or expired session.
|
|
53
|
-
* Maps to MCP -32603 (Internal error).
|
|
54
|
-
*/
|
|
55
|
-
export declare class HulyAuthError extends HulyAuthError_base {
|
|
56
|
-
readonly mcpErrorCode: McpErrorCode;
|
|
57
|
-
}
|
|
58
|
-
declare const IssueNotFoundError_base: Schema.TaggedErrorClass<IssueNotFoundError, "IssueNotFoundError", {
|
|
59
|
-
readonly _tag: Schema.tag<"IssueNotFoundError">;
|
|
60
|
-
} & {
|
|
61
|
-
identifier: typeof Schema.String;
|
|
62
|
-
project: typeof Schema.String;
|
|
63
|
-
}>;
|
|
64
|
-
/**
|
|
65
|
-
* Issue not found in the specified project.
|
|
66
|
-
* Maps to MCP -32602 (Invalid params).
|
|
67
|
-
*/
|
|
68
|
-
export declare class IssueNotFoundError extends IssueNotFoundError_base {
|
|
69
|
-
readonly mcpErrorCode: McpErrorCode;
|
|
70
|
-
get message(): string;
|
|
71
|
-
}
|
|
72
|
-
declare const ProjectNotFoundError_base: Schema.TaggedErrorClass<ProjectNotFoundError, "ProjectNotFoundError", {
|
|
73
|
-
readonly _tag: Schema.tag<"ProjectNotFoundError">;
|
|
74
|
-
} & {
|
|
75
|
-
identifier: typeof Schema.String;
|
|
76
|
-
}>;
|
|
77
|
-
/**
|
|
78
|
-
* Project not found in the workspace.
|
|
79
|
-
* Maps to MCP -32602 (Invalid params).
|
|
80
|
-
*/
|
|
81
|
-
export declare class ProjectNotFoundError extends ProjectNotFoundError_base {
|
|
82
|
-
readonly mcpErrorCode: McpErrorCode;
|
|
83
|
-
get message(): string;
|
|
84
|
-
}
|
|
85
|
-
declare const InvalidStatusError_base: Schema.TaggedErrorClass<InvalidStatusError, "InvalidStatusError", {
|
|
86
|
-
readonly _tag: Schema.tag<"InvalidStatusError">;
|
|
87
|
-
} & {
|
|
88
|
-
status: typeof Schema.String;
|
|
89
|
-
project: typeof Schema.String;
|
|
90
|
-
}>;
|
|
91
|
-
/**
|
|
92
|
-
* Invalid status for the given project.
|
|
93
|
-
* Maps to MCP -32602 (Invalid params).
|
|
94
|
-
*/
|
|
95
|
-
export declare class InvalidStatusError extends InvalidStatusError_base {
|
|
96
|
-
readonly mcpErrorCode: McpErrorCode;
|
|
97
|
-
get message(): string;
|
|
98
|
-
}
|
|
99
|
-
declare const PersonNotFoundError_base: Schema.TaggedErrorClass<PersonNotFoundError, "PersonNotFoundError", {
|
|
100
|
-
readonly _tag: Schema.tag<"PersonNotFoundError">;
|
|
101
|
-
} & {
|
|
102
|
-
identifier: typeof Schema.String;
|
|
103
|
-
}>;
|
|
104
|
-
/**
|
|
105
|
-
* Person (assignee) not found.
|
|
106
|
-
* Maps to MCP -32602 (Invalid params).
|
|
107
|
-
*/
|
|
108
|
-
export declare class PersonNotFoundError extends PersonNotFoundError_base {
|
|
109
|
-
readonly mcpErrorCode: McpErrorCode;
|
|
110
|
-
get message(): string;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Union of all Huly domain errors.
|
|
114
|
-
*/
|
|
115
|
-
export type HulyDomainError = HulyError | HulyConnectionError | HulyAuthError | IssueNotFoundError | ProjectNotFoundError | InvalidStatusError | PersonNotFoundError;
|
|
116
|
-
/**
|
|
117
|
-
* Schema for all Huly domain errors (for serialization).
|
|
118
|
-
*/
|
|
119
|
-
export declare const HulyDomainError: Schema.Union<[
|
|
120
|
-
typeof HulyError,
|
|
121
|
-
typeof HulyConnectionError,
|
|
122
|
-
typeof HulyAuthError,
|
|
123
|
-
typeof IssueNotFoundError,
|
|
124
|
-
typeof ProjectNotFoundError,
|
|
125
|
-
typeof InvalidStatusError,
|
|
126
|
-
typeof PersonNotFoundError
|
|
127
|
-
]>;
|
|
128
|
-
/**
|
|
129
|
-
* Get MCP error code from a Huly domain error.
|
|
130
|
-
*/
|
|
131
|
-
export declare const getMcpErrorCode: (error: HulyDomainError) => McpErrorCode;
|
|
132
|
-
export {};
|
|
133
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/huly/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B;;GAEG;AACH,eAAO,MAAM,YAAY;;;CAGf,CAAA;AAEV,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAA;;;;;;;AAE3E;;;GAGG;AACH,qBAAa,SAAU,SAAQ,cAG7B;IACA,QAAQ,CAAC,YAAY,EAAE,YAAY,CAA6B;CACjE;;;;;;;AAED;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,wBAMxC;IACC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAA6B;CACjE;;;;;;AAED;;;GAGG;AACH,qBAAa,aAAc,SAAQ,kBAKlC;IACC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAA6B;CACjE;;;;;;;AAED;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,uBAMvC;IACC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAA6B;IAEhE,IAAa,OAAO,IAAI,MAAM,CAE7B;CACF;;;;;;AAED;;;G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