@myvillage/cli 1.23.2 → 1.23.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myvillage/cli",
3
- "version": "1.23.2",
3
+ "version": "1.23.3",
4
4
  "description": "MyVillageOS CLI for community developers",
5
5
  "type": "module",
6
6
  "bin": {
@@ -37,9 +37,24 @@ export async function getMCPTools(agentDir, agentConfig) {
37
37
 
38
38
  try {
39
39
  // AI SDK v6 moved the MCP client into a separate package
40
- // (`@ai-sdk/mcp`). Importing from `ai` returns undefined on v6 and
41
- // throws "createMCPClient is not a function" when called.
42
- const { experimental_createMCPClient: createMCPClient } = await import('@ai-sdk/mcp');
40
+ // (`@ai-sdk/mcp`). Walk through every plausible export shape so we
41
+ // survive ESM-vs-CJS interop quirks and future renames — and if
42
+ // none match, throw a *useful* error listing what the module
43
+ // actually exposes instead of the cryptic "X is not a function".
44
+ const mcpModule = await import('@ai-sdk/mcp');
45
+ const createMCPClient =
46
+ mcpModule.experimental_createMCPClient
47
+ ?? mcpModule.createMCPClient
48
+ ?? mcpModule.default?.experimental_createMCPClient
49
+ ?? mcpModule.default?.createMCPClient;
50
+ if (typeof createMCPClient !== 'function') {
51
+ throw new Error(
52
+ `@ai-sdk/mcp loaded but no createMCPClient export found. `
53
+ + `Module exports: [${Object.keys(mcpModule).sort().join(', ') || '(empty)'}]. `
54
+ + `If you upgraded the CLI via 'npm update', try a clean reinstall: `
55
+ + `npm uninstall -g @myvillage/cli && npm install -g @myvillage/cli`
56
+ );
57
+ }
43
58
  let client;
44
59
 
45
60
  if (server.url) {