Skip to content

Add Kokosh plugin (wallet-hygiene audit via x402)#148

Open
Kajko25 wants to merge 2 commits into
base:masterfrom
Kajko25:add-kokosh-plugin
Open

Add Kokosh plugin (wallet-hygiene audit via x402)#148
Kajko25 wants to merge 2 commits into
base:masterfrom
Kajko25:add-kokosh-plugin

Conversation

@Kajko25

@Kajko25 Kajko25 commented Jul 22, 2026

Copy link
Copy Markdown

Summary

  • Adds a Base MCP plugin for Kokosh, a wallet-hygiene sentinel agent on Base mainnet: tracks token/Permit2 allowance exposure and flags scam-airdrop tokens by name/URL/homoglyph heuristics, with a paid /audit report ($0.01 USDC via x402).
  • integration: http-api, chains: [base], risk: [irreversible].
  • Adds one net-new tag (wallet-hygiene) to the shared vocabulary in plugin-spec.md, per Contribution Scope.

Notable finding

## Submission documents a real compatibility gap rather than a happy-path-only flow: Base MCP's default wallet is a smart contract account, whose sign() returns an ERC-1271/6492-shaped signature. Standard USDC transferWithAuthorization (used by x402's exact scheme) verifies with plain ecrecover only, so it will reject that signature. The plugin was hand-verified working end-to-end (real mainnet USDC settlement) with an EOA signer, and explicitly instructs the agent to stop rather than submit a payment authorization likely to fail settlement when the active wallet is a smart contract. Flagging for maintainers in case this is relevant to other x402-paying plugins.

Self-review

Ran the plugin-review skill against the current spec before opening this PR — verdict 🟡 approve with minor changes (both addressed: file relocated to the correct path, wallet-hygiene tag flagged/added). Full report: https://github.com/Kajko25/kokosh/blob/main/docs/base-mcp-plugin/kokosh-review.md

Test plan

  • Frontmatter validated against spec enums (integration, shell, auth, risk)
  • All required body sections present in canonical order with canonical headings
  • /audit, /exposure, /drops, /healthz endpoints live-tested against the deployed agent (https://kokosh-agent.vercel.app)
  • x402 payment flow verified end-to-end on Base mainnet with a real EOA signature (not simulated)
  • Not yet verified against Base MCP's own smart-contract wallet (see Notable finding above)

Kokosh is a wallet-hygiene sentinel agent for Base mainnet: tracks
token/Permit2 allowance exposure and flags scam-airdrop tokens by
name/URL/homoglyph heuristics, with a paid /audit report ($0.01 USDC
via x402).

- integration: http-api, chains: [base], risk: [irreversible]
- Documents a real smart-account-signature incompatibility with x402's
  exact scheme (Base MCP's default smart wallet returns an ERC-1271/6492
  signature, but standard USDC transferWithAuthorization only accepts
  raw ecrecover) rather than glossing over it — hand-verified working
  end to end with an EOA signer, not yet verified with a smart wallet.
- Adds `wallet-hygiene` to the shared tag vocabulary (net-new tag).

Self-reviewed against the plugin spec with the plugin-review skill;
report at https://github.com/Kajko25/kokosh/blob/main/docs/base-mcp-plugin/kokosh-review.md
@cb-heimdall

Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

…works

Live-tested paying this plugin's own /audit endpoint from a Coinbase Smart
Wallet (Base Account) via Base MCP's native initiate_x402_request /
complete_x402_request tools. It settled successfully. Root cause: USDC's
transferWithAuthorization bytes-signature overload (selector 0xcf092995)
validates through a SignatureChecker that accepts ERC-1271/6492
contract-wallet signatures, unlike the classic (v,r,s) overload (0xe3ee160e)
this caveat originally assumed. Kokosh's facilitator (CDP-hosted, via
@coinbase/x402) uses the bytes overload, so the smart-wallet failure mode
does not apply here. Softened the blanket "will fail" language accordingly
and noted that Base MCP's native x402 tools are the better default path
when available.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Kajko25

Kajko25 commented Jul 23, 2026

Copy link
Copy Markdown
Author

Update: live-tested this plugin's smart-wallet caveat against real mainnet settlement.

Paid this exact /audit endpoint from a Coinbase Smart Wallet (Base Account) via Base MCP's native initiate_x402_request/complete_x402_request tools — it settled successfully. Root cause: the facilitator behind /audit (CDP-hosted, via @coinbase/x402) calls USDC's transferWithAuthorization(address,address,uint256,uint256,uint256,bytes32,bytes) overload (selector 0xcf092995), which validates through a signature-checker path accepting ERC-1271/6492 contract-wallet signatures — not the classic (v,r,s) overload (0xe3ee160e) that the original caveat assumed as the only option.

Updated the plugin's "Smart-wallet caveat" section to reflect this and to recommend Base MCP's native x402 tools over the plugin's manual signX-PAYMENT path when both are available, since the native path already handled this correctly with no special-casing needed.

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