[Agents] Improve MPP payment guides#32185
Conversation
2dc338a to
41a7db0
Compare
Review
👉 Fix in your agent 👈Fix the following review findings in PR #32185 (https://github.com/cloudflare/cloudflare-docs/pull/32185).
Before making changes, review each finding and present a brief summary table:
- For each finding, state whether you agree, disagree, or need clarification
- If you disagree (e.g. the fix requires disproportionate effort for minimal benefit,
or the finding is factually incorrect), explain why
- If you need clarification before deciding, ask those questions
- Then share your plan for which issues to tackle and in what order
After triaging, follow this order:
1. Post a comment on this PR for any findings you are skipping, with the finding ID and your reasoning.
2. Then commit the fixes for the legitimate findings.
The comment must come before the commit — the bot reads PR comments when a new
push triggers a review, so skip comments posted after the push will be missed.
---
## Code Review
### Warnings (2)
#### CR-1f8e17216981 · Unhandled MCP OAuth state
- **File:** `src/content/docs/agents/tools/payments/mpp/pay-from-agents-sdk.mdx` line 116
- **Issue:** `const { id } = await this.addMcpServer(...)` only destructures `id` and ignores the returned `state` field. The Agents MCP client API returns either `{ id, state: "ready" }` or `{ id, state: "authenticating", authUrl }`; for OAuth-required servers the connection is not usable until the user authorizes via `authUrl`.
- **Fix:** Check the returned `state` and, when it is `"authenticating"`, redirect the user to `authUrl` (or handle OAuth) before calling `waitForConnections()` and accessing `this.mcp.mcpConnections[id].client`.
#### CR-0c9fbccbd032 · Unvalidated MCP connection lookup
- **File:** `src/content/docs/agents/tools/payments/mpp/pay-from-agents-sdk.mdx` line 122
- **Issue:** `this.mcp.mcpConnections[id].client` is dereferenced without first checking that the connection exists and is ready. If `addMcpServer()` fails, the connection is still authenticating, or `waitForConnections()` did not succeed, `this.mcp.mcpConnections[id]` may be undefined or missing a usable `client`.
- **Fix:** Verify the connection state using `this.getMcpServers()` or a null check on `this.mcp.mcpConnections[id]` before wrapping the client with `McpClient.wrap`.
Code ReviewThis code review is in beta and may not always be helpful — use your judgment. Warnings (2)
ConventionsNo convention issues found. Style Guide ReviewNo style-guide issues found. CommandsOnly codeowners can run commands. Post a comment with the command to trigger it.
|
|
/bonk please review |
There was a problem hiding this comment.
This is a clear, well-structured restructure. The new how-to guides fill meaningful gaps in the MPP docs.
I agree with the three warnings from the bot review (bold link text, unhandled MCP OAuth state, and unvalidated connection lookup) and have two additional minor style notes below.
Please address the bot findings before merging.
|
Review submitted successfully at cloudflare/cloudflare-docs/pull/32185. Summary of findings:
|
3c237bf to
f07cb78
Compare
be285b7 to
0566dd2
Compare
Summary
Restructures the Machine Payments Protocol (MPP) documentation around Cloudflare tasks while keeping the protocol overview close to the original page.
mpp-proxyis referenced.McpAgenttool.mppx.The implementation pages remain
how-tocontent. The examples use imperative steps, Cloudflare components, root-relative internal links, TOML Wrangler configuration, and scoped automatic-payment policies.Depends on cloudflare/mpp-proxy#30, which restores the proxy's advertised charge-only flow.
payments/mpp.mdxpayments/mpp/index.mdxpayments/mpp/accept-payments.mdxpayments/mpp/pay-from-agents-sdk.mdxRedirects preserve the existing MPP URLs.
Validation
402 Payment RequiredandWWW-Authenticate: Payment.Payment-Receipt.McpAgenttools from an Agent; the paid call completed a nonzero testnet payment and returned an MPP Receipt.mpp-proxyreturns200from/__mpp/healthand a charge challenge from unpaid/__mpp/protected.pnpm run checkpnpm run format:core:checkpnpm exec tsm bin/validate-redirects.tsRUN_LINK_CHECK=true pnpm run build(8,695 pages; all internal links valid)Documentation checklist