agentic-payments 0.1.6 → 0.1.7

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/bin/mcp.js +30 -0
  2. package/package.json +2 -1
package/bin/mcp.js CHANGED
@@ -4,6 +4,36 @@
4
4
  * Launches the Agentic Payments MCP server
5
5
  */
6
6
 
7
+ // Clean up npx cache on startup to prevent ENOTEMPTY errors
8
+ if (process.env.npm_execpath && process.env.npm_execpath.includes('npx')) {
9
+ try {
10
+ const { existsSync, rmSync, readdirSync } = await import('fs');
11
+ const { homedir } = await import('os');
12
+ const { join } = await import('path');
13
+
14
+ const npmHome = process.env.NPM_CONFIG_CACHE || join(homedir(), '.npm');
15
+ const npxCacheDir = join(npmHome, '_npx');
16
+
17
+ if (existsSync(npxCacheDir)) {
18
+ const cacheEntries = readdirSync(npxCacheDir);
19
+
20
+ // Find and remove stale agentic-payments cache
21
+ for (const entry of cacheEntries) {
22
+ const pkgPath = join(npxCacheDir, entry, 'node_modules', 'agentic-payments');
23
+ if (existsSync(pkgPath)) {
24
+ try {
25
+ rmSync(join(npxCacheDir, entry), { recursive: true, force: true, maxRetries: 3 });
26
+ } catch (e) {
27
+ // Ignore cleanup errors
28
+ }
29
+ }
30
+ }
31
+ }
32
+ } catch (error) {
33
+ // Silently fail - don't block server startup
34
+ }
35
+ }
36
+
7
37
  import('../dist/mcp/index.js').catch(err => {
8
38
  console.error('[MCP] Failed to start server:', err);
9
39
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-payments",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Dual-protocol payment infrastructure for autonomous AI commerce (AP2 + ACP)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -45,6 +45,7 @@
45
45
  "LICENSE-APACHE"
46
46
  ],
47
47
  "scripts": {
48
+ "preinstall": "node scripts/cleanup-npx-cache.js || true",
48
49
  "prebuild": "npm run clean",
49
50
  "build": "npm run build:ts",
50
51
  "build:wasm": "echo 'WASM build skipped - using native TypeScript implementation'",