@gwdn/nexus-mcp 0.10.13 → 0.10.14

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.
@@ -19,10 +19,15 @@ export declare class MissingProjectIdError extends Error {
19
19
  */
20
20
  export declare function resolveProjectId(explicit?: string | null): string;
21
21
  /**
22
- * Wrap a tool handler so that, if the incoming args object contains a
23
- * `project_id` key (i.e. the tool's schema declares one), an omitted or
24
- * empty value is resolved via NEXUS_PROJECT_ID before the handler runs.
25
- * Tools whose schema has no `project_id` field are unaffected.
22
+ * Wrap a tool handler whose schema declares an optional `project_id` field.
23
+ * Resolves the project scope via NEXUS_PROJECT_ID before the handler runs.
24
+ *
25
+ * Only wrap tools whose schema actually declares a `project_id` parameter --
26
+ * this helper always injects a resolved value, regardless of whether the
27
+ * caller's args object included the key at all. MCP clients commonly omit
28
+ * optional parameters entirely (no key present) rather than sending them as
29
+ * `undefined`, so checking for key presence would miss the common case and
30
+ * defeat the fallback.
26
31
  */
27
32
  export declare function withProjectFallback(handler: (args: any) => Promise<any>): (args: any) => Promise<any>;
28
33
  //# sourceMappingURL=project-scope.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"project-scope.d.ts","sourceRoot":"","sources":["../src/project-scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,qBAAa,qBAAsB,SAAQ,KAAK;;CAS/C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAKjE;AAED;;;;;GAKG;AAEH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,IAExD,MAAM,GAAG,kBASxB"}
1
+ {"version":3,"file":"project-scope.d.ts","sourceRoot":"","sources":["../src/project-scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,qBAAa,qBAAsB,SAAQ,KAAK;;CAS/C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAKjE;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,IAExD,MAAM,GAAG,kBAOxB"}
@@ -31,22 +31,25 @@ export function resolveProjectId(explicit) {
31
31
  throw new MissingProjectIdError();
32
32
  }
33
33
  /**
34
- * Wrap a tool handler so that, if the incoming args object contains a
35
- * `project_id` key (i.e. the tool's schema declares one), an omitted or
36
- * empty value is resolved via NEXUS_PROJECT_ID before the handler runs.
37
- * Tools whose schema has no `project_id` field are unaffected.
34
+ * Wrap a tool handler whose schema declares an optional `project_id` field.
35
+ * Resolves the project scope via NEXUS_PROJECT_ID before the handler runs.
36
+ *
37
+ * Only wrap tools whose schema actually declares a `project_id` parameter --
38
+ * this helper always injects a resolved value, regardless of whether the
39
+ * caller's args object included the key at all. MCP clients commonly omit
40
+ * optional parameters entirely (no key present) rather than sending them as
41
+ * `undefined`, so checking for key presence would miss the common case and
42
+ * defeat the fallback.
38
43
  */
39
44
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
40
45
  export function withProjectFallback(handler) {
41
46
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
42
47
  return async (args) => {
43
- if (args && typeof args === 'object' && 'project_id' in args) {
44
- return handler({
45
- ...args,
46
- project_id: resolveProjectId(args.project_id),
47
- });
48
- }
49
- return handler(args);
48
+ const base = args && typeof args === 'object' ? args : {};
49
+ return handler({
50
+ ...base,
51
+ project_id: resolveProjectId(base.project_id),
52
+ });
50
53
  };
51
54
  }
52
55
  //# sourceMappingURL=project-scope.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"project-scope.js","sourceRoot":"","sources":["../src/project-scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,OAA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,CAAC,GAAG,CAAC,gBAAgB,CAAA;IAC7C,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAA;IAC7B,MAAM,IAAI,qBAAqB,EAAE,CAAA;AACnC,CAAC;AAED;;;;;;;;;;GAUG;AACH,8DAA8D;AAC9D,MAAM,UAAU,mBAAmB,CAAC,OAAoC;IACtE,8DAA8D;IAC9D,OAAO,KAAK,EAAE,IAAS,EAAE,EAAE;QACzB,MAAM,IAAI,GAAG,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAA;QACzD,OAAO,OAAO,CAAC;YACb,GAAG,IAAI;YACP,UAAU,EAAE,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC;SAC9C,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gwdn/nexus-mcp",
3
- "version": "0.10.13",
3
+ "version": "0.10.14",
4
4
  "description": "MCP server for the Gatewarden Nexus platform — mediation layer between local agent runtimes and the Nexus HTTP API",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",