@firfi/huly-mcp 0.52.0 → 0.52.3

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 CHANGED
@@ -10,6 +10,8 @@
10
10
 
11
11
  **Huly MCP** is a feature-complete MCP server for [Huly](https://huly.io/) integration. Published on npm as [`@firfi/huly-mcp`](https://www.npmjs.com/package/@firfi/huly-mcp).
12
12
 
13
+ It connects to any Huly Platform deployment, so it should also work with the [Platform Collective](https://github.com/Platform-Collective/platform) fork and [TraceX](https://tracex.co) — unofficial for now.
14
+
13
15
  > [!IMPORTANT]
14
16
  > **Hosted Huly is shutting down.** Huly's upstream README says shutdown is expected July 20. If you use `https://huly.app`, [export and migrate your data](https://github.com/hcengineering/platform/blob/develop/README.md) as soon as possible. See the [backup and restore guide](https://github.com/hcengineering/platform/blob/develop/docs/guides/backup-restore.en.md) and [self-hosting repository](https://github.com/hcengineering/huly-selfhost). Self-hosted deployments are not affected.
15
17
 
package/dist/index.cjs CHANGED
@@ -117849,7 +117849,7 @@ var require_lib7 = __commonJS({
117849
117849
  });
117850
117850
 
117851
117851
  // src/huly/huly-plugins.ts
117852
- var import_node_module, import_setting, load, activity, attachment, board, calendar, cardPlugin, chunter, contact, core, documentPlugin, gmailModule, gmail, hrModule, hr, inventory, love, mail, notification, preference, request3, setting, support, tags, task, templates, telegram, time3, tracker, view, workbench;
117852
+ var import_node_module, import_setting, load, activity, attachment, board, calendar, cardPlugin, chunter, contact, core, documentPlugin, gmailModule, gmail, hrModule, hr, inventory, love, mail, notification, preference, request3, isSettingPlugin, resolveSettingPlugin, setting, support, tags, task, templates, telegram, time3, tracker, view, workbench;
117853
117853
  var init_huly_plugins = __esm({
117854
117854
  "src/huly/huly-plugins.ts"() {
117855
117855
  "use strict";
@@ -117875,7 +117875,16 @@ var init_huly_plugins = __esm({
117875
117875
  notification = load("@hcengineering/notification").default;
117876
117876
  preference = load("@hcengineering/preference").default;
117877
117877
  request3 = load("@hcengineering/request").default;
117878
- setting = import_setting.default;
117878
+ isSettingPlugin = (value3) => typeof value3 === "object" && value3 !== null && "class" in value3 && typeof value3.class === "object" && value3.class !== null && "OfficeSettings" in value3.class && value3.class.OfficeSettings === "setting:class:OfficeSettings";
117879
+ resolveSettingPlugin = (candidate = import_setting.default) => {
117880
+ const direct = candidate;
117881
+ if (isSettingPlugin(direct)) return direct;
117882
+ if (typeof direct === "object" && direct !== null && "default" in direct && isSettingPlugin(direct.default)) {
117883
+ return direct.default;
117884
+ }
117885
+ throw new Error("@hcengineering/setting did not expose its declared default plugin");
117886
+ };
117887
+ setting = resolveSettingPlugin();
117879
117888
  support = load("@hcengineering/support").default;
117880
117889
  tags = load("@hcengineering/tags").default;
117881
117890
  task = load("@hcengineering/task").default;
@@ -132446,7 +132455,7 @@ var VERSION;
132446
132455
  var init_version = __esm({
132447
132456
  "src/version.ts"() {
132448
132457
  "use strict";
132449
- VERSION = true ? "0.52.0" : "0.0.0-dev";
132458
+ VERSION = true ? "0.52.3" : "0.0.0-dev";
132450
132459
  }
132451
132460
  });
132452
132461
 
@@ -233801,7 +233810,7 @@ var init_tool_call_notices = __esm({
233801
233810
  });
233802
233811
 
233803
233812
  // src/mcp/protocol-handlers.ts
233804
- var NPM_FETCH_TIMEOUT_MS, NPM_PACKAGE_NAME2, computeOutputBytes, deriveEditMode, validateHulyContextResult, validateVersionToolResult, liveNowClock, fetchLatestNpmVersion, invokeToolEditMode, resolveClientBundle, proxyClients, proxyEditMode, resolveProxyClients, responseStatus, selectNativeCallRegistry, nativeArgumentError, createMcpProtocolHandlers;
233813
+ var NPM_FETCH_TIMEOUT_MS, NPM_PACKAGE_NAME2, computeOutputBytes, deriveEditMode, validateHulyContextResult, validateVersionToolResult, liveNowClock, fetchLatestNpmVersion, proxyCallTelemetry, resolveClientBundle, proxyClients, resolveProxyClients, responseStatus, selectNativeCallRegistry, nativeArgumentError, createMcpProtocolHandlers;
233805
233814
  var init_protocol_handlers = __esm({
233806
233815
  "src/mcp/protocol-handlers.ts"() {
233807
233816
  "use strict";
@@ -233846,9 +233855,16 @@ var init_protocol_handlers = __esm({
233846
233855
  return "unknown";
233847
233856
  }
233848
233857
  };
233849
- invokeToolEditMode = (args2) => {
233858
+ proxyCallTelemetry = (toolName, args2, registry2) => {
233859
+ if (toolName !== INVOKE_TOOL_TOOL_NAME) return { toolName, callPath: "direct" };
233850
233860
  const decoded = Schema_exports.decodeUnknownResult(InvokeToolParamsSchema)(args2);
233851
- return Result_exports.isSuccess(decoded) ? deriveEditMode(decoded.success.toolName, decoded.success.arguments) : void 0;
233861
+ if (Result_exports.isFailure(decoded)) return { toolName, callPath: "invoke_tool" };
233862
+ const target = decoded.success.toolName;
233863
+ return {
233864
+ toolName: registry2.tools.has(target) ? target : toolName,
233865
+ callPath: "invoke_tool",
233866
+ editMode: deriveEditMode(target, decoded.success.arguments)
233867
+ };
233852
233868
  };
233853
233869
  resolveClientBundle = async (resolveClients) => {
233854
233870
  try {
@@ -233863,7 +233879,6 @@ var init_protocol_handlers = __esm({
233863
233879
  storageClient: clients.storageClient,
233864
233880
  ...clients.workspaceClient === void 0 ? {} : { workspaceClient: clients.workspaceClient }
233865
233881
  });
233866
- proxyEditMode = (toolName, args2) => toolName === INVOKE_TOOL_TOOL_NAME ? invokeToolEditMode(args2) : void 0;
233867
233882
  resolveProxyClients = (toolName, resolveClients) => toolName === INVOKE_TOOL_TOOL_NAME ? resolveClientBundle(resolveClients) : Promise.resolve(void 0);
233868
233883
  responseStatus = (response) => response.isError === true ? "error" : "success";
233869
233884
  selectNativeCallRegistry = (exposure, toolName) => exposure.visibleNativeRegistry.tools.has(toolName) ? exposure.visibleNativeRegistry : exposure.context.resolvedMode === "proxy" ? exposure.proxyCandidateRegistry : exposure.visibleNativeRegistry;
@@ -233918,19 +233933,18 @@ var init_protocol_handlers = __esm({
233918
233933
  noticeClaim.delivered();
233919
233934
  return responseWithNotice;
233920
233935
  };
233921
- const returnError = (errorResponse, editMode) => {
233936
+ const returnError = (errorResponse, attribution = { toolName: name, callPath: "direct" }) => {
233922
233937
  const responseWithNotice = withClaimedNotice(errorResponse);
233923
233938
  const durationMs = clock.currentTimeMillis() - start;
233924
233939
  telemetry.toolCalled({
233925
- toolName: name,
233940
+ ...attribution,
233926
233941
  status: "error",
233927
233942
  clientKind: exposure.context.clientKind,
233928
233943
  resolvedMode: exposure.context.resolvedMode,
233929
233944
  errorTag: responseWithNotice._meta?.errorTag,
233930
233945
  durationMs,
233931
233946
  inputBytes,
233932
- outputBytes: computeOutputBytes(responseWithNotice),
233933
- editMode
233947
+ outputBytes: computeOutputBytes(responseWithNotice)
233934
233948
  });
233935
233949
  return toMcpResponse(responseWithNotice);
233936
233950
  };
@@ -233981,10 +233995,10 @@ var init_protocol_handlers = __esm({
233981
233995
  };
233982
233996
  const callProxyTool = async (toolName) => {
233983
233997
  if (exposure.context.resolvedMode !== "proxy") return returnError(createUnknownToolError(toolName));
233984
- const editMode = proxyEditMode(toolName, args2);
233998
+ const attribution = proxyCallTelemetry(toolName, args2, exposure.proxyCandidateRegistry);
233985
233999
  const clientResolution = await resolveProxyClients(toolName, resolveClients);
233986
234000
  if (clientResolution?._tag === "Failure") {
233987
- return returnError(clientResolution.response, editMode);
234001
+ return returnError(clientResolution.response, attribution);
233988
234002
  }
233989
234003
  const response = await handleProxyToolCall({
233990
234004
  toolName,
@@ -233995,15 +234009,14 @@ var init_protocol_handlers = __esm({
233995
234009
  const responseWithNotice = withClaimedNotice(response);
233996
234010
  const durationMs = clock.currentTimeMillis() - start;
233997
234011
  telemetry.toolCalled({
233998
- toolName,
234012
+ ...attribution,
233999
234013
  status: responseStatus(responseWithNotice),
234000
234014
  clientKind: exposure.context.clientKind,
234001
234015
  resolvedMode: exposure.context.resolvedMode,
234002
234016
  errorTag: responseWithNotice._meta?.errorTag,
234003
234017
  durationMs,
234004
234018
  inputBytes,
234005
- outputBytes: computeOutputBytes(responseWithNotice),
234006
- editMode
234019
+ outputBytes: computeOutputBytes(responseWithNotice)
234007
234020
  });
234008
234021
  return toMcpResponse(responseWithNotice);
234009
234022
  };
@@ -234015,9 +234028,13 @@ var init_protocol_handlers = __esm({
234015
234028
  if (tool === void 0) return returnError(createUnknownToolError(name));
234016
234029
  const argumentError = nativeArgumentError(tool, args2);
234017
234030
  if (argumentError !== void 0) return returnError(argumentError);
234018
- const editMode = deriveEditMode(hulyToolName, args2);
234031
+ const attribution = {
234032
+ toolName: hulyToolName,
234033
+ callPath: "direct",
234034
+ editMode: deriveEditMode(hulyToolName, args2)
234035
+ };
234019
234036
  const clientResolution = await resolveClientBundle(resolveClients);
234020
- if (clientResolution._tag === "Failure") return returnError(clientResolution.response, editMode);
234037
+ if (clientResolution._tag === "Failure") return returnError(clientResolution.response, attribution);
234021
234038
  const { clients } = clientResolution;
234022
234039
  const response = await nativeCallRegistry.handleToolCall(
234023
234040
  hulyToolName,
@@ -234027,18 +234044,17 @@ var init_protocol_handlers = __esm({
234027
234044
  clients.workspaceClient
234028
234045
  );
234029
234046
  const durationMs = clock.currentTimeMillis() - start;
234030
- if (response === null) return returnError(createUnknownToolError(name), editMode);
234047
+ if (response === null) return returnError(createUnknownToolError(name), attribution);
234031
234048
  const responseWithNotice = withClaimedNotice(response);
234032
234049
  telemetry.toolCalled({
234033
- toolName: hulyToolName,
234050
+ ...attribution,
234034
234051
  status: responseStatus(responseWithNotice),
234035
234052
  clientKind: exposure.context.clientKind,
234036
234053
  resolvedMode: exposure.context.resolvedMode,
234037
234054
  errorTag: responseWithNotice._meta?.errorTag,
234038
234055
  durationMs,
234039
234056
  inputBytes,
234040
- outputBytes: computeOutputBytes(responseWithNotice),
234041
- editMode
234057
+ outputBytes: computeOutputBytes(responseWithNotice)
234042
234058
  });
234043
234059
  return toMcpResponse(responseWithNotice);
234044
234060
  };
@@ -238480,16 +238496,29 @@ var init_stderr = __esm({
238480
238496
  });
238481
238497
 
238482
238498
  // src/telemetry/posthog.ts
238483
- var POSTHOG_API_KEY, SHUTDOWN_TIMEOUT_MS, defaultDependencies, createPostHogTelemetry, createPostHogTelemetryWithContext;
238499
+ var POSTHOG_API_KEY, SHUTDOWN_TIMEOUT_MS, ToolCalledPropertiesSchema, defaultDependencies, createPostHogTelemetry, createPostHogTelemetryWithContext;
238484
238500
  var init_posthog = __esm({
238485
238501
  "src/telemetry/posthog.ts"() {
238486
238502
  "use strict";
238487
238503
  init_index_node();
238504
+ init_dist();
238488
238505
  init_stderr();
238489
238506
  init_version();
238490
238507
  init_context();
238491
238508
  POSTHOG_API_KEY = "phc_TGfFqCGdnF0p68wuFzd5WSw1IsBvOJW0YgoMJDyZPjm";
238492
238509
  SHUTDOWN_TIMEOUT_MS = 2e3;
238510
+ ToolCalledPropertiesSchema = Schema_exports.Struct({
238511
+ tool_name: Schema_exports.String,
238512
+ call_path: Schema_exports.Literals(["direct", "invoke_tool"]),
238513
+ status: Schema_exports.Literals(["success", "error"]),
238514
+ duration_ms: Schema_exports.Number,
238515
+ client_kind: Schema_exports.optionalKey(Schema_exports.String),
238516
+ resolved_mode: Schema_exports.optionalKey(Schema_exports.String),
238517
+ error_tag: Schema_exports.optionalKey(Schema_exports.String),
238518
+ input_bytes: Schema_exports.optionalKey(Schema_exports.Number),
238519
+ output_bytes: Schema_exports.optionalKey(Schema_exports.Number),
238520
+ edit_mode: Schema_exports.optionalKey(Schema_exports.String)
238521
+ });
238493
238522
  defaultDependencies = {
238494
238523
  createClient: () => new PostHog(POSTHOG_API_KEY, { host: "https://us.i.posthog.com", flushAt: 10, flushInterval: 6e4 }),
238495
238524
  createSessionId: () => crypto.randomUUID(),
@@ -238554,6 +238583,7 @@ var init_posthog = __esm({
238554
238583
  event: "tool_called",
238555
238584
  properties: {
238556
238585
  tool_name: props.toolName,
238586
+ call_path: props.callPath ?? "direct",
238557
238587
  status: props.status,
238558
238588
  duration_ms: props.durationMs,
238559
238589
  ...props.clientKind !== void 0 && { client_kind: props.clientKind },
@@ -239402,7 +239432,7 @@ if (unsupportedRuntime) {
239402
239432
  detectedNodeVersion: process.versions.node,
239403
239433
  executable: process.execPath,
239404
239434
  requiredNodeVersion: nodeEngineRequirement,
239405
- serverVersion: "0.52.0"
239435
+ serverVersion: "0.52.3"
239406
239436
  });
239407
239437
  startUnsupportedNodeMcp(config2);
239408
239438
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firfi/huly-mcp",
3
- "version": "0.52.0",
3
+ "version": "0.52.3",
4
4
  "description": "Huly MCP: feature-complete MCP server for Huly integration",
5
5
  "mcpName": "io.github.dearlordylord/huly-mcp",
6
6
  "type": "module",