{"_id":"@fluxa-pay/fluxa-wallet-mcp","_rev":"10-4c3b20057eb422e2f19c78f8b84a1b41","name":"@fluxa-pay/fluxa-wallet-mcp","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@fluxa-pay/fluxa-wallet-mcp","version":"0.1.0","keywords":["mcp","ai-wallet","x402","eip-3009","payment","blockchain","fluxa","model-context-protocol"],"author":{"name":"FluxA Dev","email":"dev@fluxapay.xyz"},"license":"Apache-2.0","_id":"@fluxa-pay/fluxa-wallet-mcp@0.1.0","maintainers":[{"name":"yy-fluxa","email":"jack@fluxapay.xyz"}],"dist":{"shasum":"a4953d622b3d86826476cd14fd8bca90dfcba25c","tarball":"https://registry.npmjs.org/@fluxa-pay/fluxa-wallet-mcp/-/fluxa-wallet-mcp-0.1.0.tgz","fileCount":23,"integrity":"sha512-2dpPjr5DFwPNx0DN4IP+KBtryMxX0Rv3x5HLlawzv9zKDcurmi5MAlEgwKS9uaLfxNRheDMMOSMbv+5bMJP49g==","signatures":[{"sig":"MEUCIGNvKi652dSVWpjQC8akRocLsLTsGuOxF86pblc3kx7MAiEAm2O4mtT8Ei3JRwtliSo1kGTXEgw0I54xdqyKn00YzqM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":71455},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"01adc9486d8b67afc3a46e6e85f2bdbb4c1c8ee3","scripts":{"dev":"tsx src/index.ts","build":"tsc -p tsconfig.json","start":"node dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"yy-fluxa","email":"jack@fluxapay.xyz"},"_npmVersion":"11.5.1","description":"MCP server for AI Wallet with x402 (EIP-3009 exact) support","directories":{},"_nodeVersion":"24.7.0","dependencies":{"zod":"^3.23.8","viem":"^2.21.15","express":"^4.19.2","@modelcontextprotocol/sdk":"^1.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","typescript":"^5.6.3","@types/express":"^4.17.21"},"_npmOperationalInternal":{"tmp":"tmp/fluxa-wallet-mcp_0.1.0_1762834601248_0.9007286961870191","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@fluxa-pay/fluxa-wallet-mcp","version":"0.1.1","keywords":["mcp","ai-wallet","x402","eip-3009","payment","blockchain","fluxa","model-context-protocol"],"author":{"name":"FluxA Dev","email":"dev@fluxapay.xyz"},"license":"Apache-2.0","_id":"@fluxa-pay/fluxa-wallet-mcp@0.1.1","maintainers":[{"name":"yy-fluxa","email":"jack@fluxapay.xyz"}],"bin":{"fluxa-wallet-mcp":"dist/index.js"},"dist":{"shasum":"3390970a9cd41ff486263f8461700aed99ca2775","tarball":"https://registry.npmjs.org/@fluxa-pay/fluxa-wallet-mcp/-/fluxa-wallet-mcp-0.1.1.tgz","fileCount":23,"integrity":"sha512-szbZ5pgGMn53r7ogcCJhZFJGUYcZRwL2j9seYvJz4ZX2tLnbt+W/CnU6sJcV49AiTSaST7b9NiK89+Ac4Iq23Q==","signatures":[{"sig":"MEUCIApqtcTgJccWigSYapbRh7+oVQbdpx5fB1yGYgXxwG3fAiEAymnRoHUxktM/iMZrQfq2iw/cFhDQL8U5LzT/sVJnpE0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":71551},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"01adc9486d8b67afc3a46e6e85f2bdbb4c1c8ee3","scripts":{"dev":"tsx src/index.ts","build":"tsc -p tsconfig.json","start":"node dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"yy-fluxa","email":"jack@fluxapay.xyz"},"_npmVersion":"11.5.1","description":"MCP server for AI Wallet with x402 (EIP-3009 exact) support","directories":{},"_nodeVersion":"24.7.0","dependencies":{"zod":"^3.23.8","viem":"^2.21.15","express":"^4.19.2","@modelcontextprotocol/sdk":"^1.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","typescript":"^5.6.3","@types/express":"^4.17.21"},"_npmOperationalInternal":{"tmp":"tmp/fluxa-wallet-mcp_0.1.1_1762834833973_0.1211386630368172","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@fluxa-pay/fluxa-wallet-mcp","version":"0.1.2","keywords":["mcp","ai-wallet","x402","eip-3009","payment","blockchain","fluxa","model-context-protocol"],"author":{"name":"FluxA Dev","email":"dev@fluxapay.xyz"},"license":"Apache-2.0","_id":"@fluxa-pay/fluxa-wallet-mcp@0.1.2","maintainers":[{"name":"yy-fluxa","email":"jack@fluxapay.xyz"}],"bin":{"fluxa-wallet-mcp":"dist/index.js"},"dist":{"shasum":"250e1b7f7c8543fe8354f181b816c04455cb770d","tarball":"https://registry.npmjs.org/@fluxa-pay/fluxa-wallet-mcp/-/fluxa-wallet-mcp-0.1.2.tgz","fileCount":23,"integrity":"sha512-ZMz3iFIlEtbks0HbU30uLWGD3l7GKBfY5ZrodCX1YM/EprYmH9szNBkGY6t6tsj91A9EP7aPOYpPRzCcgq77SA==","signatures":[{"sig":"MEQCIF6HAxwmVsC5C/0lV9vbqTSpIGAw3HEL7wQSLRlngQPSAiBS1bPcSmw1r8uSmeH3wCiHY/P1g8AFgkgbSTPzpFm1JA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":71577},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"01adc9486d8b67afc3a46e6e85f2bdbb4c1c8ee3","scripts":{"dev":"tsx src/index.ts","build":"tsc -p tsconfig.json && chmod +x dist/index.js","start":"node dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"yy-fluxa","email":"jack@fluxapay.xyz"},"_npmVersion":"11.5.1","description":"MCP server for AI Wallet with x402 (EIP-3009 exact) support","directories":{},"_nodeVersion":"24.7.0","dependencies":{"zod":"^3.23.8","viem":"^2.21.15","express":"^4.19.2","@modelcontextprotocol/sdk":"^1.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","typescript":"^5.6.3","@types/express":"^4.17.21"},"_npmOperationalInternal":{"tmp":"tmp/fluxa-wallet-mcp_0.1.2_1762835860756_0.9026398407778278","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@fluxa-pay/fluxa-wallet-mcp","version":"0.1.3","keywords":["mcp","ai-wallet","x402","eip-3009","payment","blockchain","fluxa","model-context-protocol"],"author":{"name":"FluxA Dev","email":"dev@fluxapay.xyz"},"license":"Apache-2.0","_id":"@fluxa-pay/fluxa-wallet-mcp@0.1.3","maintainers":[{"name":"yy-fluxa","email":"jack@fluxapay.xyz"},{"name":"sky_fluxapay","email":"sky@fluxapay.xyz"}],"bin":{"fluxa-wallet-mcp":"dist/index.js"},"dist":{"shasum":"0c4c871648738ed7afa03a43c9f2f72b2c989d92","tarball":"https://registry.npmjs.org/@fluxa-pay/fluxa-wallet-mcp/-/fluxa-wallet-mcp-0.1.3.tgz","fileCount":23,"integrity":"sha512-eGjm9xpCNrLBXPUGBsYaf/YPwoHkwkiSqsowumfsDp8tpXxOwgj0EEoNR8bxXfxw/gLjKVSm2KdyUW1e0QlTJg==","signatures":[{"sig":"MEUCIF8sLzJUSLc3ic+wR0zREjutHso3TJBjTJ/jBc6K6k5xAiEAnBHIylUeoSD1PSCzuUK+rsaF4ah1R7tbgN0RI+QsmOI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":71577},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"cd68785b21593e768d2ec9922e7967fd51cd7a71","scripts":{"dev":"tsx src/index.ts","build":"tsc -p tsconfig.json && chmod +x dist/index.js","start":"node dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"yy-fluxa","email":"jack@fluxapay.xyz"},"_npmVersion":"11.5.1","description":"MCP server for AI Wallet with x402 (EIP-3009 exact) support","directories":{},"_nodeVersion":"24.7.0","dependencies":{"zod":"^3.23.8","viem":"^2.21.15","express":"^4.19.2","@modelcontextprotocol/sdk":"^1.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","typescript":"^5.6.3","@types/express":"^4.17.21"},"_npmOperationalInternal":{"tmp":"tmp/fluxa-wallet-mcp_0.1.3_1763951329897_0.15811860649120035","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@fluxa-pay/fluxa-wallet-mcp","version":"0.1.4","keywords":["mcp","ai-wallet","x402","eip-3009","payment","blockchain","fluxa","model-context-protocol"],"author":{"name":"FluxA Dev","email":"dev@fluxapay.xyz"},"license":"Apache-2.0","_id":"@fluxa-pay/fluxa-wallet-mcp@0.1.4","maintainers":[{"name":"yy-fluxa","email":"jack@fluxapay.xyz"},{"name":"sky_fluxapay","email":"sky@fluxapay.xyz"}],"bin":{"fluxa-wallet-mcp":"dist/index.js"},"dist":{"shasum":"6fa3626e1f6dca19d1ec92906d53611bce2d064c","tarball":"https://registry.npmjs.org/@fluxa-pay/fluxa-wallet-mcp/-/fluxa-wallet-mcp-0.1.4.tgz","fileCount":27,"integrity":"sha512-ykIDCqlw7i6n6qI5lIZblNYPmxV7YS3srj7fRmc9CoqWxudyfx/Xx+xilJTVn7iSoMPG5pIVTcv+fdSgbBz/Cg==","signatures":[{"sig":"MEUCIEW83ugXiu/kcbR7YUiRcUiEMP2CdBHPYgPx0E7iYLHOAiEA1OSjzPaLmJCbQLrwxRY27buK0RS1qnv2p5rMSl03l/0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":86751},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"a93555dcced30db34de651d7e0b72911c30be945","scripts":{"dev":"tsx src/index.ts","build":"tsc -p tsconfig.json && chmod +x dist/index.js","start":"node dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"yy-fluxa","email":"jack@fluxapay.xyz"},"_npmVersion":"11.5.1","description":"MCP server for AI Wallet with x402 (EIP-3009 exact) support","directories":{},"_nodeVersion":"24.7.0","dependencies":{"zod":"^3.23.8","viem":"^2.21.15","express":"^4.19.2","@modelcontextprotocol/sdk":"^1.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","typescript":"^5.6.3","@types/express":"^4.17.21"},"_npmOperationalInternal":{"tmp":"tmp/fluxa-wallet-mcp_0.1.4_1763956095428_0.47441011396868005","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@fluxa-pay/fluxa-wallet-mcp","version":"0.1.5","keywords":["mcp","ai-wallet","x402","eip-3009","payment","blockchain","fluxa","model-context-protocol"],"author":{"name":"FluxA Dev","email":"dev@fluxapay.xyz"},"license":"Apache-2.0","_id":"@fluxa-pay/fluxa-wallet-mcp@0.1.5","maintainers":[{"name":"yy-fluxa","email":"jack@fluxapay.xyz"},{"name":"sky_fluxapay","email":"sky@fluxapay.xyz"}],"bin":{"fluxa-wallet-mcp":"dist/index.js"},"dist":{"shasum":"a13c9d393fd931e539d4f6de5e4c50f9505204df","tarball":"https://registry.npmjs.org/@fluxa-pay/fluxa-wallet-mcp/-/fluxa-wallet-mcp-0.1.5.tgz","fileCount":27,"integrity":"sha512-uIC5PQLUy01A5Mun6X/J389sK9+Jasvu2AVc4l5VBPt3TQ+zvy7CXJQtOepmRatX5iyRhU7HewLoSFoTU59Dnw==","signatures":[{"sig":"MEYCIQCAJyhDwrpAHkrN0+82K5NMDmxiti2GXEVTT2rMrx6QQQIhAI7wiMci0Y0CIyBzPB2pK0VsXcCGiiDh1Ez9jUX9q0NZ","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":86676},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"69102c46673cd45219689e00842f7e5ee86a42a1","scripts":{"dev":"tsx src/index.ts","build":"tsc -p tsconfig.json && chmod +x dist/index.js","start":"node dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"yy-fluxa","email":"jack@fluxapay.xyz"},"_npmVersion":"11.5.1","description":"MCP server for AI Wallet with x402 (EIP-3009 exact) support","directories":{},"_nodeVersion":"24.7.0","dependencies":{"zod":"^3.23.8","viem":"^2.21.15","express":"^4.19.2","@modelcontextprotocol/sdk":"^1.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","typescript":"^5.6.3","@types/express":"^4.17.21"},"_npmOperationalInternal":{"tmp":"tmp/fluxa-wallet-mcp_0.1.5_1763960213582_0.9321157916718361","host":"s3://npm-registry-packages-npm-production"}},"0.1.6":{"name":"@fluxa-pay/fluxa-wallet-mcp","version":"0.1.6","keywords":["mcp","ai-wallet","x402","eip-3009","payment","blockchain","fluxa","model-context-protocol"],"author":{"name":"FluxA Dev","email":"dev@fluxapay.xyz"},"license":"Apache-2.0","_id":"@fluxa-pay/fluxa-wallet-mcp@0.1.6","maintainers":[{"name":"yy-fluxa","email":"jack@fluxapay.xyz"},{"name":"sky_fluxapay","email":"sky@fluxapay.xyz"}],"bin":{"fluxa-wallet-mcp":"dist/index.js"},"dist":{"shasum":"c1b54368f0f090020585b6e8afd4e378df3c504f","tarball":"https://registry.npmjs.org/@fluxa-pay/fluxa-wallet-mcp/-/fluxa-wallet-mcp-0.1.6.tgz","fileCount":27,"integrity":"sha512-tB6eyFhRTqJn5MmflRPW93xpkv4KHElpQljFBqvvWTgaYQt1bxkZ5eBTOuIPj0JBjSMVOVqYEv2mC3kXGEcPZg==","signatures":[{"sig":"MEUCIAmo7G2CWOuifVeNSm3Bk5wvzvxav1p9OggFVo77fW6oAiEAytdDpv4KbBTAqJ4uo+dN0w6cqxfgaOj2HHe0c9svmxs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":86676},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"9cef9ae5cfa83fde1d2bb0487a26372c4f719d29","scripts":{"dev":"tsx src/index.ts","build":"tsc -p tsconfig.json && chmod +x dist/index.js","start":"node dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"yy-fluxa","email":"jack@fluxapay.xyz"},"_npmVersion":"11.5.1","description":"MCP server for AI Wallet with x402 (EIP-3009 exact) support","directories":{},"_nodeVersion":"24.7.0","dependencies":{"zod":"^3.23.8","viem":"^2.21.15","express":"^4.19.2","@modelcontextprotocol/sdk":"^1.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","typescript":"^5.6.3","@types/express":"^4.17.21"},"_npmOperationalInternal":{"tmp":"tmp/fluxa-wallet-mcp_0.1.6_1763962748046_0.05070150206000923","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@fluxa-pay/fluxa-wallet-mcp","version":"0.2.0","description":"MCP server for AI Wallet with x402 (EIP-3009 exact) support","type":"module","bin":{"fluxa-wallet-mcp":"dist/index.js"},"main":"dist/index.js","types":"dist/index.d.ts","scripts":{"dev":"tsx src/index.ts","dev:cli":"tsx src/cli.ts","build":"tsc -p tsconfig.json && chmod +x dist/index.js dist/cli.js","build:wallet":"esbuild src/cli.ts --bundle --platform=node --target=node18 --format=esm --outfile=packages/fluxa-wallet/bin/fluxa-wallet.js && chmod +x packages/fluxa-wallet/bin/fluxa-wallet.js","build:all":"npm run build && npm run build:wallet","start":"node dist/index.js","prepublishOnly":"npm run build"},"keywords":["mcp","ai-wallet","x402","eip-3009","payment","blockchain","fluxa","model-context-protocol"],"author":{"name":"FluxA Dev","email":"dev@fluxapay.xyz"},"license":"Apache-2.0","engines":{"node":">=18.0.0"},"dependencies":{"@modelcontextprotocol/sdk":"^1.2.0","express":"^4.19.2","viem":"^2.21.15","zod":"^3.23.8"},"devDependencies":{"@types/express":"^4.17.21","esbuild":"^0.24.0","tsx":"^4.19.0","typescript":"^5.6.3"},"_id":"@fluxa-pay/fluxa-wallet-mcp@0.2.0","gitHead":"8b851f5776bf01f797b7daf7134f81aca1999602","_nodeVersion":"23.10.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-D4kkZ9CDG8oJ3FlRaWIVqRFcSjo2ci0B5FuhLUXgIP5UJlOD7IzmOSryOzh3cblVMPry5rYwRPTD4xMTd0gs+w==","shasum":"5130245e723f66267582c94e2aa376ec00a4c477","tarball":"https://registry.npmjs.org/@fluxa-pay/fluxa-wallet-mcp/-/fluxa-wallet-mcp-0.2.0.tgz","fileCount":45,"unpackedSize":201932,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICGNILCJ9FRceSJdkMJ5cpqQH8PC/x8oC7PmU8pJi6SBAiAfX2kJT+qyHZON2IdNNdd3wc+jXJWCLyFZN2JZ3edfyw=="}]},"_npmUser":{"name":"jennyagi3000","email":"cp@fluxapay.xyz"},"directories":{},"maintainers":[{"name":"yy-fluxa","email":"jack@fluxapay.xyz"},{"name":"jennyagi3000","email":"cp@fluxapay.xyz"},{"name":"sky_fluxapay","email":"sky@fluxapay.xyz"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/fluxa-wallet-mcp_0.2.0_1772449103748_0.09635071414679253"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-11T04:16:41.052Z","modified":"2026-03-02T10:58:24.028Z","0.1.0":"2025-11-11T04:16:41.463Z","0.1.1":"2025-11-11T04:20:34.173Z","0.1.2":"2025-11-11T04:37:40.935Z","0.1.3":"2025-11-24T02:28:50.097Z","0.1.4":"2025-11-24T03:48:15.626Z","0.1.5":"2025-11-24T04:56:53.779Z","0.1.6":"2025-11-24T05:39:08.231Z","0.2.0":"2026-03-02T10:58:23.907Z"},"author":{"name":"FluxA Dev","email":"dev@fluxapay.xyz"},"license":"Apache-2.0","keywords":["mcp","ai-wallet","x402","eip-3009","payment","blockchain","fluxa","model-context-protocol"],"description":"MCP server for AI Wallet with x402 (EIP-3009 exact) support","maintainers":[{"name":"yy-fluxa","email":"jack@fluxapay.xyz"},{"name":"jennyagi3000","email":"cp@fluxapay.xyz"},{"name":"sky_fluxapay","email":"sky@fluxapay.xyz"}],"readme":"# FluxA AI Wallet MCP\n\nMCP server for FluxA AI Wallet with x402 (EIP-3009 exact) payment support.\n\n## Packages\n\nThis repository contains two packages:\n\n| Package | Description | Install |\n|---------|-------------|---------|\n| [`@fluxa-pay/fluxa-wallet-mcp`](https://www.npmjs.com/package/@fluxa-pay/fluxa-wallet-mcp) | MCP server for AI agent frameworks (Claude Desktop, etc.) | `npm install @fluxa-pay/fluxa-wallet-mcp` |\n| [`@fluxa-pay/fluxa-wallet`](./packages/fluxa-wallet/) | Standalone CLI for scripts and automation | `npm install -g @fluxa-pay/fluxa-wallet` |\n\n## Overview\n\nThis MCP server enables AI agents to make x402 payments using the FluxA Wallet API. It provides a simple interface for agents to register, authenticate, and execute blockchain payments without managing private keys locally.\n\n## Features\n\n- **Agent ID Management**: Register and manage FluxA Agent IDs\n- **x402 Payment Support**: Generate EIP-3009 payment authorizations via FluxA Wallet API\n- **Automatic JWT Refresh**: Automatically refreshes expired JWT tokens before payments\n- **No Local Key Management**: All signing is handled by FluxA Wallet (no local private keys)\n- **Policy Management**: Policies are managed remotely by FluxA Wallet\n- **Environment Variable Support**: Configure via env vars or config file\n\n## Quick Start\n\n### CLI\n\n```bash\nnpm install -g @fluxa-pay/fluxa-wallet\nfluxa-wallet status\n```\n\n### MCP Server\n\n```bash\nnpm install\nnpm run build\nnpm start\n```\n\n### Development\n\n```bash\nnpm run dev\n```\n\n### Build\n\n```bash\n# Build MCP server only\nnpm run build\n\n# Build CLI bundle only\nnpm run build:wallet\n\n# Build both\nnpm run build:all\n```\n\n### Configuration\n\nThe server stores configuration in `~/.fluxa-ai-wallet-mcp/config.json` by default.\n\nYou can override the data directory:\n\n```bash\nexport FLUXA_DATA_DIR=/path/to/custom/dir\n```\n\n#### Agent ID Configuration\n\nThere are **two methods** to configure Agent ID via environment variables:\n\n**Method 1: Use existing credentials (highest priority)**\n\nIf you already have Agent ID credentials, set these environment variables:\n\n```bash\nexport AGENT_ID=your-agent-id\nexport AGENT_TOKEN=your-token\nexport AGENT_JWT=your-jwt\n```\n\nThis method bypasses registration and uses the provided credentials directly.\n\n**Method 2: Provide registration information**\n\nIf you don't have credentials yet, configure registration information:\n\n```bash\nexport AGENT_NAME=\"Claude Desktop - John's MacBook\"\nexport CLIENT_INFO=\"Claude Desktop v1.0 on macOS 14.1\"\n```\n\nWhen these are set, calling `init_agent_id` with empty parameters `{}` will automatically register using this information.\n\n**Priority order:**\n1. Method 1 environment variables (AGENT_ID + AGENT_TOKEN + AGENT_JWT)\n2. Config file (`~/.fluxa-ai-wallet-mcp/config.json`)\n3. Method 2 environment variables (requires calling `init_agent_id`)\n4. Manual registration (requires user input)\n\n## MCP Tools\n\n### 1. `init_agent_id`\n\nRegister a new FluxA Agent ID. This must be called before making payments.\n\n**Configuration Methods:**\n\nThis tool supports two ways to provide registration information:\n\n1. **Using environment variables (Method 2 above)**: If `AGENT_NAME` and `CLIENT_INFO` are set, simply call with empty parameters:\n   ```json\n   {}\n   ```\n\n2. **Using parameters**: If environment variables are not set, provide the information directly:\n   ```json\n   {\n     \"agent_name\": \"Claude Desktop - John's MacBook\",\n     \"client_info\": \"Claude Desktop v1.0 on macOS 14.1\"\n   }\n   ```\n\n**Output:**\n```json\n{\n  \"status\": \"ok\",\n  \"agent_id\": \"uuid-string\",\n  \"message\": \"Agent ID registered successfully\"\n}\n```\n\n**Usage by Agent:**\n- If environment variables are configured (Method 2), simply call `init_agent_id` with `{}`\n- Otherwise:\n  1. Choose a meaningful agent name (e.g., \"Claude Desktop - User's Computer\")\n  2. Provide client information (e.g., \"Claude Desktop v1.0 on macOS\")\n  3. Call this tool with the collected parameters\n\n### 2. `request_x402_payment`\n\nGenerate an x402 payment authorization by calling FluxA Wallet API.\n\n**Input:**\n```json\n{\n  \"payment_required\": {\n    \"x402Version\": 1,\n    \"accepts\": [{\n      \"scheme\": \"exact\",\n      \"network\": \"base\",\n      \"maxAmountRequired\": \"10000\",\n      \"resource\": \"https://example.com/api/data\",\n      \"description\": \"API access\",\n      \"mimeType\": \"application/json\",\n      \"payTo\": \"0x...\",\n      \"maxTimeoutSeconds\": 300,\n      \"asset\": \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n      \"extra\": {\n        \"name\": \"USD Coin\",\n        \"version\": \"2\"\n      }\n    }]\n  },\n  \"intent\": {\n    \"why\": \"Access protected API endpoint\",\n    \"http_method\": \"GET\",\n    \"http_url\": \"https://example.com/api/data\",\n    \"caller\": \"user-agent-name\"\n  },\n  \"options\": {\n    \"validity_window_seconds\": 60,\n    \"approval_id\": \"apprv_123\"\n  }\n}\n```\n\n`approval_id` is optional. Supply it when the wallet instructs you to complete an external approval flow so the retry can be linked to that approval.\n\n**Output:**\n```json\n{\n  \"status\": \"ok\",\n  \"x_payment\": \"base64-encoded-payment-header\",\n  \"x_payment_object\": {\n    \"x402Version\": 1,\n    \"scheme\": \"exact\",\n    \"network\": \"base\",\n    \"payload\": { ... }\n  }\n}\n```\n\n**Error (Agent Not Registered):**\n```json\n{\n  \"status\": \"error\",\n  \"code\": \"agent_not_registered\",\n  \"message\": \"FluxA Agent ID not configured. Please register first.\",\n  \"pmc\": {\n    \"primer\": \"Please read and follow pmc.instructions...\",\n    \"instructions\": \"Agent ID is not configured. Please call init_agent_id...\"\n  }\n}\n```\n\n**Error (Approval Required):**\n```json\n{\n  \"status\": \"approval_required\",\n  \"code\": \"approval_required\",\n  \"message\": \"Approval required\",\n  \"approvalId\": \"apprv_123\",\n  \"approvalUrl\": \"https://wallet.fluxapay.xyz/approvals/apprv_123\",\n  \"pmc\": {\n    \"primer\": \"Please read and follow pmc.instructions...\",\n    \"instructions\": \"Visit the approval URL, authorize the request, then call request_x402_payment again with options.approval_id=apprv_123.\"\n  }\n}\n```\n\n### 3. `request_payout`\n\nCreate a payout via FluxA Wallet API.\n\nNotes:\n- Amount must be provided in smallest units (e.g., USDC has 6 decimals, so `10000` = 0.01 USDC)\n- Network, currency, and asset are hardcoded to Base mainnet USDC inside MCP (no need to pass them)\n- `payout_id` is required and must be provided by the caller (idempotency key)\n\n**Input:**\n```json\n{\n  \"to_address\": \"0x4eb5b229d43c30fc629d92bf7ed415d6d7f0cabe\",\n  \"amount\": \"10000\",\n  \"payout_id\": \"payout-test-017\"\n}\n```\n\n**Output (Pending Authorization):**\n```json\n{\n  \"payoutId\": \"payout-test-017\",\n  \"status\": \"pending_authorization\",\n  \"txHash\": null,\n  \"approvalUrl\": \"http://localhost:3000/authorize-payout/payout-test-017\",\n  \"expiresAt\": 1763914398\n}\n```\n\nIf the payoutId already exists, status might be `succeeded` and include `txHash`.\n\n### 4. `get_payout_status`\n\nQuery payout status from the Wallet App public endpoint. This is useful after authorizing a payout in the browser.\n\n**Input:**\n```json\n{\n  \"payout_id\": \"payout-test-017\"\n}\n```\n\n**Output:**\n```json\n{\n  \"payoutId\": \"payout-test-017\",\n  \"status\": \"succeeded\",\n  \"txHash\": \"0x...\"\n}\n```\n\n### 5. `get_agent_status`\n\nQuery the current Agent ID configuration status.\n\n**Input:** None\n\n**Output:**\n```json\n{\n  \"configured\": true,\n  \"agent_id\": \"uuid-string\",\n  \"agent_name\": \"Claude Desktop - John's MacBook\",\n  \"registered_at\": \"2024-01-01T00:00:00.000Z\"\n}\n```\n\n### 6. `create_intent_mandate`\n\nCreate an intent mandate for x402 v3 payments. This is the first step in the x402 v3 flow.\n\n**Input:**\n```json\n{\n  \"intent\": {\n    \"naturalLanguage\": \"I plan to spend up to 0.10 USDC to get Polymarket trading recommendations valid for 30 days.\",\n    \"category\": \"trading_data\",\n    \"currency\": \"USDC\",\n    \"limitAmount\": \"100000\",\n    \"validForSeconds\": 2592000,\n    \"hostAllowlist\": []\n  }\n}\n```\n\n**Output:**\n```json\n{\n  \"status\": \"ok\",\n  \"mandateId\": \"mand_xxxxxxxxxxxxx\",\n  \"authorizationUrl\": \"https://wallet.fluxapay.xyz/onboard/intent?oid=...\",\n  \"expiresAt\": \"2024-01-01T00:10:00.000Z\",\n  \"agentStatus\": \"ready\"\n}\n```\n\n**Usage by Agent:**\n1. Call this tool with the intent parameters\n2. Ask the user to open `authorizationUrl` to authorize and sign the mandate\n3. Use the `mandateId` with `request_x402_v3_payment` for payments\n\n### 7. `get_mandate_status`\n\nQuery the status of an intent mandate.\n\n**Input:**\n```json\n{\n  \"mandate_id\": \"mand_xxxxxxxxxxxxx\"\n}\n```\n\n**Output:**\n```json\n{\n  \"status\": \"ok\",\n  \"mandate\": {\n    \"mandateId\": \"mand_xxxxxxxxxxxxx\",\n    \"status\": \"signed\",\n    \"naturalLanguage\": \"I plan to spend up to 0.10 USDC...\",\n    \"currency\": \"USDC\",\n    \"limitAmount\": \"100000\",\n    \"spentAmount\": \"10000\",\n    \"remainingAmount\": \"90000\",\n    \"validFrom\": \"2024-01-01T00:00:00.000Z\",\n    \"validUntil\": \"2024-01-31T00:00:00.000Z\"\n  }\n}\n```\n\n### 8. `request_x402_v3_payment`\n\nSign an x402 v3 payment using an intent mandate. Requires a signed mandateId.\n\n**Input:**\n```json\n{\n  \"mandate_id\": \"mand_xxxxxxxxxxxxx\",\n  \"payment_required\": {\n    \"x402Version\": 1,\n    \"accepts\": [{\n      \"scheme\": \"exact\",\n      \"network\": \"base\",\n      \"maxAmountRequired\": \"10000\",\n      \"resource\": \"https://example.com/api/data\",\n      \"description\": \"API access\",\n      \"mimeType\": \"application/json\",\n      \"payTo\": \"0x...\",\n      \"maxTimeoutSeconds\": 300,\n      \"asset\": \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n      \"extra\": {\n        \"name\": \"USD Coin\",\n        \"version\": \"2\"\n      }\n    }]\n  },\n  \"intent\": {\n    \"why\": \"Access protected API endpoint\",\n    \"http_method\": \"GET\",\n    \"http_url\": \"https://example.com/api/data\",\n    \"caller\": \"user-agent-name\"\n  }\n}\n```\n\n**Output:**\n```json\n{\n  \"status\": \"ok\",\n  \"xPaymentB64\": \"eyJ4NDAyVmVyc2lvbi...\",\n  \"xPayment\": {\n    \"x402Version\": 1,\n    \"scheme\": \"exact\",\n    \"network\": \"base\",\n    \"payload\": { ... }\n  },\n  \"paymentRecordId\": 123,\n  \"expiresAt\": 1700000060\n}\n```\n\n**Error (Mandate Not Signed):**\n```json\n{\n  \"status\": \"denied\",\n  \"code\": \"mandate_not_signed\",\n  \"message\": \"Mandate does not allow this payment\",\n  \"payment_model_context\": {\n    \"primer\": \"Please read and follow...\",\n    \"instructions\": \"The mandate is not signed yet. Ask user to sign at signUrl.\"\n  }\n}\n```\n\n## Workflow\n\n### First-Time Setup\n\n1. **Agent calls `request_x402_payment` without registration**\n   - Server returns error with code `agent_not_registered`\n   - PMC instructions guide the agent to register\n\n2. **Agent collects user information**\n   - Generate meaningful agent name based on environment\n   - Prepare client info string\n\n3. **Agent calls `init_agent_id`**\n   - Server registers with FluxA Agent ID API\n   - Returns agent_id, token, and JWT\n   - Configuration is saved automatically\n\n4. **Agent retries `request_x402_payment`**\n   - Server calls FluxA Wallet API with JWT\n   - Returns signed payment authorization\n   - Agent adds X-Payment header and retries the HTTP request\n\n### Subsequent Payments\n\nOnce registered, agents can directly call `request_x402_payment` without re-registering. The JWT is used to authenticate with FluxA Wallet API.\n\n## API Endpoints\n\n### FluxA Agent ID API\n\n**Base URL:** `https://agentid.fluxapay.xyz`\n\n**POST /register**\n```bash\ncurl -X POST https://agentid.fluxapay.xyz/register \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"agent_name\": \"My Agent\",\n    \"client_info\": \"My Client v1.0\"\n  }'\n```\n\n**Response:**\n```json\n{\n  \"agent_id\": \"uuid-string\",\n  \"token\": \"token-string\",\n  \"jwt\": \"jwt-string\"\n}\n```\n\n### FluxA Wallet API\n\n**Base URL:** `https://walletapi.fluxapay.xyz`\n\n**POST /api/payment/x402V1Payment**\n```bash\ncurl -X POST https://walletapi.fluxapay.xyz/api/payment/x402V1Payment \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $JWT_TOKEN\" \\\n  -d '{\n    \"scheme\": \"exact\",\n    \"network\": \"base\",\n    \"amount\": \"10000\",\n    \"currency\": \"USDC\",\n    \"assetAddress\": \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n    \"payTo\": \"0x...\",\n    \"host\": \"example.com\",\n    \"resource\": \"https://example.com/api/data\",\n    \"description\": \"API access\",\n    \"tokenName\": \"USD Coin\",\n    \"tokenVersion\": \"2\",\n    \"validityWindowSeconds\": 60\n  }'\n```\n\n#### x402 v3 Payment (Intent Mandate)\n\nx402 v3 requires a user-signed intent mandate. The flow is:\n1. Create an intent mandate (returns `mandateId` and `authorizationUrl`)\n2. User opens `authorizationUrl` to authorize agent and sign the mandate\n3. Use `mandateId` for subsequent payments\n\n**POST /api/mandates/create-intent**\n\nCreate a new intent mandate. Can be called without JWT (returns instructions) or with JWT (creates mandate directly).\n\n```bash\ncurl -X POST https://walletapi.fluxapay.xyz/api/mandates/create-intent \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $AGENT_JWT\" \\\n  -d '{\n    \"intent\": {\n      \"naturalLanguage\": \"I plan to spend up to 0.10 USDC to get Polymarket trading recommendations valid for 30 days.\",\n      \"category\": \"trading_data\",\n      \"currency\": \"USDC\",\n      \"limitAmount\": \"100000\",\n      \"validForSeconds\": 2592000,\n      \"hostAllowlist\": []\n    }\n  }'\n```\n\n**Response:**\n```json\n{\n  \"status\": \"ok\",\n  \"mandateId\": \"mand_xxxxxxxxxxxxx\",\n  \"authorizationUrl\": \"https://wallet.fluxapay.xyz/onboard/intent?oid=...\",\n  \"expiresAt\": \"2024-01-01T00:10:00.000Z\",\n  \"agentStatus\": \"ready\"\n}\n```\n\n**POST /api/payment/x402V3Payment**\n\nExecute an x402 v3 payment using an intent mandate.\n\n```bash\ncurl -X POST https://walletapi.fluxapay.xyz/api/payment/x402V3Payment \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $AGENT_JWT\" \\\n  -d '{\n    \"mandateId\": \"mand_xxxxxxxxxxxxx\",\n    \"scheme\": \"exact\",\n    \"network\": \"base\",\n    \"amount\": \"10000\",\n    \"currency\": \"USDC\",\n    \"assetAddress\": \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n    \"payTo\": \"0xFf319473ba1a09272B37c34717f6993b3F385CD3\",\n    \"host\": \"fluxa-x402-api.gmlgtm.workers.dev\",\n    \"resource\": \"https://fluxa-x402-api.gmlgtm.workers.dev/polymarket_recommendations_last_1h\",\n    \"description\": \"Get Polymarket trading recommendations\",\n    \"tokenName\": \"USD Coin\",\n    \"tokenVersion\": \"2\",\n    \"validityWindowSeconds\": 60\n  }'\n```\n\n**Response:**\n```json\n{\n  \"status\": \"ok\",\n  \"xPaymentB64\": \"eyJ4NDAyVmVyc2lvbi...\",\n  \"xPayment\": {\n    \"x402Version\": 1,\n    \"scheme\": \"exact\",\n    \"network\": \"base\",\n    \"payload\": {\n      \"signature\": \"0x...\",\n      \"authorization\": {\n        \"from\": \"0x...\",\n        \"to\": \"0x...\",\n        \"value\": \"10000\",\n        \"validAfter\": \"1700000000\",\n        \"validBefore\": \"1700000060\",\n        \"nonce\": \"0x...\"\n      }\n    }\n  },\n  \"paymentRecordId\": 123,\n  \"expiresAt\": 1700000060\n}\n```\n\n**GET /api/mandates/agent/{mandateId}**\n\nQuery mandate status.\n\n```bash\ncurl -H \"Authorization: Bearer $AGENT_JWT\" \\\n  https://walletapi.fluxapay.xyz/api/mandates/agent/mand_xxxxxxxxxxxxx\n```\n\n**Response:**\n```json\n{\n  \"status\": \"ok\",\n  \"mandate\": {\n    \"mandateId\": \"mand_xxxxxxxxxxxxx\",\n    \"status\": \"signed\",\n    \"naturalLanguage\": \"I plan to spend up to 0.10 USDC...\",\n    \"category\": \"trading_data\",\n    \"currency\": \"USDC\",\n    \"limitAmount\": \"100000\",\n    \"spentAmount\": \"10000\",\n    \"pendingSpentAmount\": \"0\",\n    \"remainingAmount\": \"90000\",\n    \"validFrom\": \"2024-01-01T00:00:00.000Z\",\n    \"validUntil\": \"2024-01-31T00:00:00.000Z\",\n    \"hostAllowlist\": null,\n    \"mandateHash\": \"0x...\",\n    \"signedAt\": \"2024-01-01T00:05:00.000Z\",\n    \"createdAt\": \"2024-01-01T00:00:00.000Z\",\n    \"updatedAt\": \"2024-01-01T00:05:00.000Z\"\n  }\n}\n```\n\n## Architecture\n\n```\nMCP Server (stdio)\n├── Agent ID Management\n│   ├── Registration with FluxA Agent ID API\n│   └── Local config storage (agent_id, token, jwt)\n├── Wallet API Client\n│   ├── x402V1Payment calls\n│   ├── x402V3Payment calls (intent mandate)\n│   ├── Intent Mandate management\n│   └── JWT-based authentication\n└── MCP Tools\n    ├── init_agent_id\n    ├── request_x402_payment (v1)\n    ├── request_x402_v3_payment (v3 with mandate)\n    ├── create_intent_mandate\n    ├── get_mandate_status\n    ├── request_payout\n    ├── get_payout_status\n    └── get_agent_status\n```\n\n## Environment Variables\n\n| Variable | Description | Default |\n|----------|-------------|---------|\n| `FLUXA_DATA_DIR` | Data directory path | `~/.fluxa-ai-wallet-mcp` |\n| **Method 1: Existing Credentials** | | |\n| `AGENT_ID` | Agent ID (highest priority) | - |\n| `AGENT_TOKEN` | Agent token (highest priority) | - |\n| `AGENT_JWT` | Agent JWT (highest priority) | - |\n| **Method 2: Registration Info** | | |\n| `AGENT_NAME` | Agent name for registration | - |\n| `CLIENT_INFO` | Client info for registration | - |\n| **API Endpoints** | | |\n| `AGENT_ID_API` | Agent ID API base URL | `https://agentid.fluxapay.xyz` |\n| `WALLET_API` | Wallet API base URL | `https://walletapi.fluxapay.xyz` |\n\n## Configuration File\n\nLocation: `~/.fluxa-ai-wallet-mcp/config.json`\n\n```json\n{\n  \"agentId\": {\n    \"agent_id\": \"uuid-string\",\n    \"token\": \"token-string\",\n    \"jwt\": \"jwt-string\",\n    \"agent_name\": \"My Agent\",\n    \"client_info\": \"My Client v1.0\",\n    \"registered_at\": \"2024-01-01T00:00:00.000Z\"\n  }\n}\n```\n\n## JWT Token Management\n\nThe MCP server automatically manages JWT token lifecycle:\n\n**Automatic Refresh:**\n- Before each payment request, the server checks if the JWT is expired or expiring soon (within 5 minutes)\n- If expired, automatically calls the refresh endpoint to get a new JWT\n- Refresh uses the `agent_id` and `token` (which don't expire)\n\n**Storage:**\n- **Environment variables**: Refreshed JWT is stored in runtime memory (not persisted)\n- **Config file**: Refreshed JWT is automatically saved to `~/.fluxa-ai-wallet-mcp/config.json`\n\n**Manual Refresh:**\nYou can also manually refresh the JWT using curl:\n```bash\ncurl -X POST https://agentid.fluxapay.xyz/refresh \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"agent_id\": \"your-agent-id\", \"token\": \"your-token\"}'\n```\n\n## Notes\n\n- This is a stateless MCP server that delegates all payment logic to FluxA Wallet API\n- No private keys are stored or managed locally\n- Policy management (limits, approvals, etc.) is handled by FluxA Wallet\n- All payment authorizations are signed by FluxA Wallet\n- The JWT is used to authenticate all payment requests\n- JWT tokens are automatically refreshed when expired (using agent_id + token)\n- Agent ID registration is a one-time operation per agent instance\n\n## Supported Networks\n\n- Base (chainId: 8453)\n- Base Sepolia (chainId: 84532)\n\n## Supported Assets\n\n- USDC on Base: `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`\n\n## License\n\nMIT\n","readmeFilename":"README.md"}