Skip to content

fix: boot npx MCP server and align live AgentPay production surfaces - #247

Merged
Rumblingb merged 3 commits into
mainfrom
cursor/live-prod-fixes-bb52
Sep 6, 2026
Merged

fix: boot npx MCP server and align live AgentPay production surfaces#247
Rumblingb merged 3 commits into
mainfrom
cursor/live-prod-fixes-bb52

Conversation

@Rumblingb

@Rumblingb Rumblingb commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Product lock

AgentPay stays guardrails + payment authority for agents (one key, spend limit, card or crypto). Ace and RCM stay dark. Locked H1 is unchanged:

Your agent can pay with a card or with crypto. One key. You set the limit.

What this PR fixes

P0 — @agentpayxyz/mcp-server does not boot. Published 0.2.0 bin/agentpay-mcp.mjs only imported dist/index.js, and isMainModule used CJS require.main === module in an ESM package. The process printed the missing-key warning and exited 0 with no MCP stdio.

  • Bin now always starts the stdio server (startStdioServer()).
  • ESM-safe CLI detection lives in packages/mcp-server/src/cli-entry.ts.
  • Package bumped to 0.2.1. Publish is documented in packages/mcp-server/README.md. Not published from this PR.
  • DEFAULT_API_URL remains https://api.agentpay.so.
  • index.ts does not auto-start (Jest/CJS and the Worker import that file). The published bin is the CLI entry.

Also in this PR, in priority order:

  1. POST /api/merchants/register now returns apk_<64 hex> and mer_<uuid> when the key is returned inline (email still preferred). Rotate/recover use the same key format. Auth still accepts existing raw-hex keys.
  2. Hosted MCP Launch includedToolCalls is 50 (was 250). Public site stays at 50.
  3. MCP setup/docs URLs no longer use dead agentpay.gg. FRONTEND_URL is https://agentpay.so. Auth help links point at agentpay.so/docs and /start.
  4. POST /api/x402/verify uses in-process verify lookup instead of a public self-fetch that 502'd. Missing backend now returns 503 with a reason, not 502.
  5. HTTP 402 challenge is real at GET /api/x402, /api/x402/challenge, /api/x402/pay, /x402, and /.well-known/x402. Schema remains at /api/x402/schema.
  6. GET /api/receipt/demo returns a demo receipt instead of 500. Invalid IDs no longer crash uuid lookup.
  7. agentpay.so privacy and terms no longer mention Postizzz / TikTok / social publishing. Contact rajiv_baskaran@agentpay.so stays.
  8. /, /start, /docs, /about drop IRCTC and National Rail. UK/India stays as payment rails only (GBP/INR, UPI, Open Banking). Landing worker files come from PR 242 and are stacked here with the copy lock.

What still needs a human

Action Why
npm publish --access public of @agentpayxyz/mcp-server@0.2.1 No safe unattended publish path; documented in the package README
Deploy apps/api-edge (npx wrangler deploy) Register keys, Launch=50, x402, receipt/demo, FRONTEND_URL
Deploy workers/agentpay-landing (agentpay-landing-production) Gus deploys this Worker. Merge is not a ship
RESEND_API_KEY / verified sending domain Register still returns the key inline when email fails — that is intended

Tests / repro

Local: landing worker tests pass; Jest covers MCP boot contract, apk_/mer_* keys, Launch=50, x402 challenge/verify (not 502), receipt/demo 200. After npm run build --workspace @agentpayxyz/mcp-server, node bin/agentpay-mcp.mjs --help warns about a missing key, prints help, and stays up on stdio instead of exiting 0.

Do not merge. Do not deploy. Do not npm publish from this PR.

Open in Web Open in Cursor 

npx @agentpayxyz/mcp-server@0.2.0 never opened stdio because isMainModule
used CJS require.main in an ESM package. Start the server from the bin,
detect CLI entry in ESM, and bump the package to 0.2.1 (publish is documented,
not run).

Also align merchant register to apk_/mer_* keys, Launch tool calls to 50,
x402 challenge/verify, receipt/demo, dead agentpay.gg MCP URLs, and
agentpay.so copy so Ace rail names and Postizzz leftover stay off the
public legal and marketing pages.

Co-authored-by: Rumblingb <Rumblingb@users.noreply.github.com>
@vercel

vercel Bot commented Sep 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
agentpay-docs Ready Ready Preview Sep 6, 2026 4:42pm UTC
agentpay-host-native-restore Ready Ready Preview Sep 6, 2026 4:42pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
agentpay-dashboard Ignored Ignored Preview Sep 6, 2026 4:42pm UTC

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

The published bin starts stdio. Auto-start via import.meta.url in index.ts
broke CJS Jest when api-edge imported the tool surface.

Co-authored-by: Rumblingb <Rumblingb@users.noreply.github.com>
Unblocks Workers typecheck after the exposure-recovery page required the flag.

Co-authored-by: Rumblingb <Rumblingb@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants