{"_id":"@andesmountain/gatepay-local-mcp-test","_rev":"2-dd472e6e9f60794099bace5b29cc652b","name":"@andesmountain/gatepay-local-mcp-test","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@andesmountain/gatepay-local-mcp-test","version":"0.0.1","keywords":["x402","mcp","payment","stdio","model-context-protocol"],"license":"MIT","_id":"@andesmountain/gatepay-local-mcp-test@0.0.1","maintainers":[{"name":"andesmountain","email":"443889956@qq.com"}],"homepage":"https://github.com/gate/gatepay-local-mcp","bugs":{"url":"https://github.com/gate/gatepay-local-mcp/issues"},"bin":{"gatepay-mcp":"dist/src/index.js"},"dist":{"shasum":"151bae3bf71188a0877ef0b3373bc3d10f4aead5","tarball":"https://registry.npmjs.org/@andesmountain/gatepay-local-mcp-test/-/gatepay-local-mcp-test-0.0.1.tgz","fileCount":82,"integrity":"sha512-ed24nPVZwRwg4559H+4fY9ruNvVxj9eptjUXXktq1MYeor8BVn07h5iZ+bmTMhgS07Nc/Ac0XmXQxajFH2Cg1g==","signatures":[{"sig":"MEUCIQDLteg5Gv6R+1EednzcTjPrzZ7h/OLX1m5D690lXnLX6gIgAv2HqLJEImmlJMVSVznxUblwb5vOl+8Bt90+EkHfxx4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":290713},"main":"dist/src/index.js","type":"module","_from":"file:andesmountain-gatepay-local-mcp-test-0.0.1.tgz","types":"dist/src/index.d.ts","scripts":{"dev":"tsx src/index.ts","lint":"eslint . --fix","build":"tsc","start":"tsx src/index.ts","format":"prettier -c .prettierrc --write \"**/*.{ts,js,cjs,json,md}\"","test:unit":"node --import tsx --test test/**/*.test.ts","lint:check":"eslint .","format:check":"prettier -c .prettierrc --check \"**/*.{ts,js,cjs,json,md}\"","test:getTools":"tsx test/mcpclient.ts","test:mcp-tool":"tsx test/mcp-x402-request-tool.ts","test:privateKey":"tsx test/privateKey.ts","test:signer-mcp":"tsx test/signer-mcp-wallet.ts","test:wallet-mcp":"tsx test/wallet-mcp-auth.ts","test:split-tools":"tsx test/split-tools.test.ts","test:pluginWallet":"tsx test/pluginWallet.ts","test:device-flow-login":"tsx test/device-flow-login.ts"},"_npmUser":{"name":"andesmountain","email":"443889956@qq.com"},"_resolved":"/private/var/folders/4q/h6mhwgt91clgy90x2067llvh0000gn/T/24d3fad22afafaedc9373bf219c04134/andesmountain-gatepay-local-mcp-test-0.0.1.tgz","_integrity":"sha512-ed24nPVZwRwg4559H+4fY9ruNvVxj9eptjUXXktq1MYeor8BVn07h5iZ+bmTMhgS07Nc/Ac0XmXQxajFH2Cg1g==","repository":{"url":"git+https://github.com/gate/gatepay-local-mcp.git","type":"git"},"_npmVersion":"10.9.4","description":"Gatepay Local (stdio) MCP server","directories":{},"_nodeVersion":"22.22.0","dependencies":{"viem":"^2.39.0","dotenv":"^16.4.7","@noble/secp256k1":"^2.2.0","@modelcontextprotocol/sdk":"^1.12.1"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.7.0","eslint":"^9.24.0","globals":"^15.14.0","prettier":"3.5.2","@eslint/js":"^9.24.0","typescript":"^5.3.0","@types/node":"^22.0.0","eslint-plugin-jsdoc":"^50.6.9","eslint-plugin-import":"^2.31.0","eslint-plugin-prettier":"^5.2.6","@typescript-eslint/parser":"^8.29.1","@typescript-eslint/eslint-plugin":"^8.29.1"},"_npmOperationalInternal":{"tmp":"tmp/gatepay-local-mcp-test_0.0.1_1774244784137_0.29640324723332245","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@andesmountain/gatepay-local-mcp-test","version":"0.0.2","description":"Gatepay Local (stdio) MCP server","type":"module","main":"dist/src/index.js","types":"dist/src/index.d.ts","bin":{"gatepay-mcp":"dist/src/index.js"},"dependencies":{"@noble/secp256k1":"^2.2.0","@modelcontextprotocol/sdk":"^1.12.1","dotenv":"^16.4.7","viem":"^2.39.0"},"keywords":["x402","mcp","payment","stdio","model-context-protocol"],"license":"MIT","devDependencies":{"globals":"^15.14.0","@types/node":"^22.0.0","@eslint/js":"^9.24.0","@typescript-eslint/eslint-plugin":"^8.29.1","@typescript-eslint/parser":"^8.29.1","eslint":"^9.24.0","eslint-plugin-import":"^2.31.0","eslint-plugin-jsdoc":"^50.6.9","eslint-plugin-prettier":"^5.2.6","prettier":"3.5.2","tsx":"^4.7.0","typescript":"^5.3.0"},"homepage":"https://github.com/gate/gatepay-local-mcp","repository":{"type":"git","url":"git+https://github.com/gate/gatepay-local-mcp.git"},"scripts":{"build":"tsc","start":"tsx src/index.ts","dev":"tsx src/index.ts","test:unit":"node --import tsx --test test/**/*.test.ts","test:privateKey":"tsx test/privateKey.ts","test:getTools":"tsx test/mcpclient.ts","test:pluginWallet":"tsx test/pluginWallet.ts","test:mcp-tool":"tsx test/mcp-x402-request-tool.ts","test:split-tools":"tsx test/split-tools.test.ts","test:split-tools-v2":"tsx test/split-tools-v2.test.ts","test:wallet-mcp":"tsx test/wallet-mcp-auth.ts","test:device-flow-login":"tsx test/device-flow-login.ts","test:signer-mcp":"tsx test/signer-mcp-wallet.ts","format":"prettier -c .prettierrc --write \"**/*.{ts,js,cjs,json,md}\"","format:check":"prettier -c .prettierrc --check \"**/*.{ts,js,cjs,json,md}\"","lint":"eslint . --fix","lint:check":"eslint ."},"_id":"@andesmountain/gatepay-local-mcp-test@0.0.2","bugs":{"url":"https://github.com/gate/gatepay-local-mcp/issues"},"_integrity":"sha512-MhVHQy0JHjh7ScMoD7Cenze9EA16z5N9q3rcs2duf3+OmPjOdwTOjBrVfyE1W9WJHm8HmOjVd15Kn2A0iOVSfg==","_resolved":"/private/var/folders/4q/h6mhwgt91clgy90x2067llvh0000gn/T/bdf19c6d94e34c383b69d3ceb2fb0f80/andesmountain-gatepay-local-mcp-test-0.0.2.tgz","_from":"file:andesmountain-gatepay-local-mcp-test-0.0.2.tgz","_nodeVersion":"22.22.0","_npmVersion":"10.9.4","dist":{"integrity":"sha512-MhVHQy0JHjh7ScMoD7Cenze9EA16z5N9q3rcs2duf3+OmPjOdwTOjBrVfyE1W9WJHm8HmOjVd15Kn2A0iOVSfg==","shasum":"40b2cee4a823b58f31c1b55c7ced556ebfa5a892","tarball":"https://registry.npmjs.org/@andesmountain/gatepay-local-mcp-test/-/gatepay-local-mcp-test-0.0.2.tgz","fileCount":82,"unpackedSize":308772,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCHh1baO2W5pA6jczvaqoH+l+o/2s2ciZFbWk71gL5O6gIhAMXnrXllMYak3/xP7tLrzy2/Lk2wUpAkZCdBmsHJL61c"}]},"_npmUser":{"name":"andesmountain","email":"443889956@qq.com"},"directories":{},"maintainers":[{"name":"andesmountain","email":"443889956@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/gatepay-local-mcp-test_0.0.2_1774260741484_0.10783914316910903"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-23T05:46:23.752Z","modified":"2026-03-23T10:12:21.748Z","0.0.1":"2026-03-23T05:46:24.271Z","0.0.2":"2026-03-23T10:12:21.629Z"},"bugs":{"url":"https://github.com/gate/gatepay-local-mcp/issues"},"license":"MIT","homepage":"https://github.com/gate/gatepay-local-mcp","keywords":["x402","mcp","payment","stdio","model-context-protocol"],"repository":{"type":"git","url":"git+https://github.com/gate/gatepay-local-mcp.git"},"description":"Gatepay Local (stdio) MCP server","maintainers":[{"name":"andesmountain","email":"443889956@qq.com"}],"readme":"# gatepay-local-mcp\n\n`gatepay-local-mcp` is a local `stdio` MCP server for calling **x402 payment-protected** HTTP endpoints. It exposes a single MCP tool, `x402_request`. When the upstream service returns `402 Payment Required`, the server parses the payment requirements, prepares the payment payload, signs it with the selected signer, and retries the request automatically.\n\n## Features\n\n- One MCP tool: `x402_request`\n- Built-in x402 payment flow under `src/x402-standalone/`\n- Multiple signing modes via `sign_mode`\n- Works with Cursor, Claude Desktop, and other MCP clients\n- Supports auto-selecting the first ready signing mode\n\n## Signing Modes\n\nThe server currently registers these signing modes:\n\n| `sign_mode`         | Status                              | Description                                                              |\n| ------------------- | ----------------------------------- | ------------------------------------------------------------------------ |\n| `local_private_key` | Ready when `EVM_PRIVATE_KEY` is set | Signs locally with your EVM private key                                  |\n| `quick_wallet`      | Ready after login                   | Uses the remote MCP wallet and can trigger device-flow login when needed |\n| `plugin_wallet`     | Placeholder                         | Reserved for future extension, not implemented yet                       |\n\nIf `sign_mode` is omitted, the server auto-selects the highest-priority ready mode.\n\n## Quick Start\n\n### Cursor / Claude Desktop with local private key\n\nThis is the simplest setup if you want local signing:\n\n```json\n{\n  \"mcpServers\": {\n    \"gatepay-mcp\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"gatepay-local-mcp\"],\n      \"env\": {\n        \"EVM_PRIVATE_KEY\": \"your-evm-private-key-hex-with-or-without-0x-prefix\"\n      }\n    }\n  }\n}\n```\n\nPut this into your MCP config such as `~/.cursor/mcp.json`, then restart the client or reload MCP.\n\n### Cursor / Claude Desktop with quick wallet\n\nIf you prefer remote wallet signing, you can omit `EVM_PRIVATE_KEY` and let the tool use `quick_wallet`. Note that you need to obtain API credentials from the wallet service provider.\n\n```json\n{\n  \"mcpServers\": {\n    \"gatepay-mcp\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"gatepay-local-mcp\"]\n    }\n  }\n}\n```\n\nWhen `quick_wallet` has no saved token, the server can start a device-flow login and persist the token at `~/.gate-pay/auth.json`.\n\n## Environment Variables\n\nThe server loads `.env` from the repository or package root at startup.\n\n### Runtime variables\n\n| Variable          | Required | Default | Description                                                                 |\n| ----------------- | -------- | ------- | --------------------------------------------------------------------------- |\n| `EVM_PRIVATE_KEY` | No       | —       | Local EVM private key used by `local_private_key`; hex with or without `0x` |\n\n### Test and script variables\n\n| Variable                      | Used By                         | Default                 | Description                                     |\n| ----------------------------- | ------------------------------- | ----------------------- | ----------------------------------------------- |\n| `RESOURCE_SERVER_URL`         | `test/privateKey.ts`            | `http://localhost:8080` | Base URL for the local private-key flow test    |\n| `ENDPOINT_PATH`               | `test/privateKey.ts`            | `/flight/order`         | Endpoint path appended to `RESOURCE_SERVER_URL` |\n| `GATEPAY_MCP_TEST_TIMEOUT_MS` | `test/mcp-x402-request-tool.ts` | `180000`                | Timeout for the MCP tool integration test       |\n\n## Available Tool\n\n### `x402_request`\n\nExecutes a single HTTP request to an x402-protected endpoint. If the response is `402 Payment Required`, the server completes the payment flow and retries automatically.\n\nUse this tool only for endpoints that are expected to require x402 payment.\n\n| Argument                | Type   | Required | Description                                                                     |\n| ----------------------- | ------ | -------- | ------------------------------------------------------------------------------- |\n| `url`                   | string | Yes      | Full `http` or `https` URL                                                      |\n| `method`                | string | No       | `GET`, `POST`, `PUT`, or `PATCH`; default is `POST`                             |\n| `body`                  | string | No       | JSON string request body; omit for `GET`                                        |\n| `sign_mode`             | string | No       | Preferred signing mode: `local_private_key`, `quick_wallet`, or `plugin_wallet` |\n| `wallet_login_provider` | string | No       | Login provider for `quick_wallet`: `google` or `gate`; default is `gate`        |\n\n### Tool examples\n\nGET request with automatic mode selection:\n\n```json\n{\n  \"url\": \"https://api.example.com/resource\"\n}\n```\n\nPOST request with explicit local signing:\n\n```json\n{\n  \"url\": \"https://api.example.com/order\",\n  \"method\": \"POST\",\n  \"body\": \"{\\\"flightId\\\":\\\"FL001\\\",\\\"uid\\\":\\\"100\\\"}\",\n  \"sign_mode\": \"local_private_key\"\n}\n```\n\nPOST request with quick wallet login through Gate:\n\n```json\n{\n  \"url\": \"https://api.example.com/order\",\n  \"method\": \"POST\",\n  \"body\": \"{\\\"flightId\\\":\\\"FL001\\\",\\\"uid\\\":\\\"100\\\"}\",\n  \"sign_mode\": \"quick_wallet\",\n  \"wallet_login_provider\": \"gate\"\n}\n```\n\n## Development\n\n```bash\n# install dependencies\nnpm install\n\n# build TypeScript output into dist/\nnpm run build\n\n# start the MCP server from source\nnpm run dev\n\n# run the built entrypoint through the package start script\nnpm start\n\n# run unit tests\nnpm run test:unit\n\n# run the local private key flow test\nnpm run test:privateKey\n\n# run the MCP tool integration test\nnpm run test:mcp-tool\n```\n\n### Integration test notes\n\n`npm run test:mcp-tool` starts `dist/src/index.js` and calls `x402_request` against the configured remote wallet flow. The test requires proper wallet credentials to be configured.\n\n```bash\nnpm run build\nnpm run test:mcp-tool\n```\n\nIf you already logged in before, the saved token in `~/.gate-pay/auth.json` will be reused. Otherwise the quick wallet flow may require interactive device login. You can increase the timeout with `GATEPAY_MCP_TEST_TIMEOUT_MS`.\n\n## How It Works\n\n1. The MCP client calls `x402_request`.\n2. The server normalizes the input and selects a ready `sign_mode`.\n3. The first request is sent to the target URL.\n4. If the upstream returns `402 Payment Required`, the server parses the payment requirements.\n5. The selected signer signs the payment payload.\n6. The server retries the request with the payment header and returns the final response.\n\n## License\n\nMIT\n","readmeFilename":"Readme.md"}