Skip to content

Make x402 identity follow the public resource - #1491

Merged
asim merged 1 commit into
mainfrom
m3o-x402-identity
Sep 4, 2026
Merged

Make x402 identity follow the public resource#1491
asim merged 1 commit into
mainfrom
m3o-x402-identity

Conversation

@asim

@asim asim commented Sep 4, 2026

Copy link
Copy Markdown
Member

Why

M3O fronts the same MCP endpoint as a machine-facing public surface. The resource URL now correctly preserves m3o.com, but x402 still identified the service as the configured Mu domain and returned account-centric guidance about signing in, /token, and /tools.

What

  • derive x402 serviceName from the public resource URL, so https://m3o.com/mcp advertises m3o.com
  • replace the default 402 error with concise protocol-oriented guidance: choose an accepted payment method, submit payment, and retry
  • retain configured-domain fallback when the resource is not a parseable public URL

No M3O-specific domain is hard-coded.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-04T21:46:32.188592Z 119ee48 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@asim
asim merged commit 88590df into main Sep 4, 2026
1 of 2 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 119ee48eea

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/x402/x402.go
reason = "This tool costs credits. Sign in, or send a token from /token as " +
"'Authorization: Bearer' — see /tools. Machine callers can pay per call " +
"with an X-PAYMENT header instead; see accepts."
reason = "Payment required. Choose an entry from accepts, submit payment, and retry."

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve account access guidance on the Mu endpoint

When an anonymous or invalid-token caller reaches a metered /mcp operation on the normal Mu surface, payer supplies an empty reason, so this becomes the only guidance returned and removes the existing sign-in/Bearer-token alternatives for callers who do not want to make an x402 payment. Because the same function serves both the alternate M3O surface and the regular Mu endpoint, this also deterministically breaks TestAChallengeSaysWhyThisCallerWasRefused in internal/x402/reason_test.go; select the protocol-only wording for the alternate surface without deleting the standard Mu access paths.

Useful? React with 👍 / 👎.

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.

1 participant