@alfe.ai/myob-mcp 0.3.14 → 0.3.16

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.
Files changed (2) hide show
  1. package/dist/server.js +35 -1
  2. package/package.json +4 -3
package/dist/server.js CHANGED
@@ -1,9 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { z } from "zod";
4
5
  import { resolveConfig } from "@alfe.ai/config";
5
6
  import { AgentApiClient } from "@alfe.ai/agent-api-client";
6
- import { z } from "zod";
7
+ import { assertPatternA } from "@alfe.ai/mcp-bundler";
7
8
  //#region src/myob-client.ts
8
9
  /**
9
10
  * MYOB Business API client — wraps fetch with required headers,
@@ -610,6 +611,28 @@ function log(msg) {
610
611
  process.stderr.write(`[myob-mcp-server] ${msg}\n`);
611
612
  }
612
613
  /**
614
+ * Convert a McpServer.registerTool Zod raw shape into the JSON-Schema-ish
615
+ * {@link ValidatableTool} the Pattern A validator inspects. Direct-MCP
616
+ * servers register Zod shapes (not JSON Schema), so the guard maps each
617
+ * property's presence / optionality / string-ness across.
618
+ */
619
+ function zodShapeToValidatable(name, shape) {
620
+ const properties = {};
621
+ const required = [];
622
+ for (const [key, schema] of Object.entries(shape ?? {})) {
623
+ properties[key] = { type: schema instanceof z.ZodString ? "string" : "non-string" };
624
+ if (!schema.safeParse(void 0).success) required.push(key);
625
+ }
626
+ return {
627
+ name,
628
+ parameters: {
629
+ type: "object",
630
+ properties,
631
+ required
632
+ }
633
+ };
634
+ }
635
+ /**
613
636
  * Resolve a `myobBusinessId` selector to its `MyobClient`. Throws if
614
637
  * unknown — the LLM should call `myob_list_businesses` to discover
615
638
  * the valid set. This is the per-call dispatch contract for Pattern A.
@@ -696,6 +719,13 @@ async function main() {
696
719
  name: "myob-mcp-server",
697
720
  version: "2.0.0"
698
721
  });
722
+ const validatableTools = [];
723
+ const originalRegisterTool = server.registerTool.bind(server);
724
+ server.registerTool = (...args) => {
725
+ const [name, config] = args;
726
+ validatableTools.push(zodShapeToValidatable(name, config?.inputSchema));
727
+ return originalRegisterTool(...args);
728
+ };
699
729
  registerContactTools(server, resolveMyobClient);
700
730
  registerSalesTools(server, resolveMyobClient);
701
731
  registerPurchaseTools(server, resolveMyobClient);
@@ -731,6 +761,10 @@ async function main() {
731
761
  };
732
762
  }
733
763
  });
764
+ assertPatternA(validatableTools, {
765
+ selector: "myobBusinessId",
766
+ exempt: ["myob_list_businesses", "myob_refresh_token"]
767
+ });
734
768
  scheduleRefresh(apiClient);
735
769
  const transport = new StdioServerTransport();
736
770
  await server.connect(transport);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfe.ai/myob-mcp",
3
- "version": "0.3.14",
3
+ "version": "0.3.16",
4
4
  "description": "MYOB Business MCP server — direct API integration with Alfe OAuth credentials and automatic token refresh",
5
5
  "type": "module",
6
6
  "main": "./dist/server.js",
@@ -19,8 +19,9 @@
19
19
  "dependencies": {
20
20
  "@modelcontextprotocol/sdk": "^1.29.0",
21
21
  "zod": "^4.0.5",
22
- "@alfe.ai/config": "0.3.0",
23
- "@alfe.ai/agent-api-client": "0.12.0"
22
+ "@alfe.ai/agent-api-client": "0.14.0",
23
+ "@alfe.ai/config": "0.4.0",
24
+ "@alfe.ai/mcp-bundler": "0.4.0"
24
25
  },
25
26
  "license": "UNLICENSED",
26
27
  "homepage": "https://alfe.ai",