Skip to content

MangroveTechnologies/x402-plugin-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

x402 Plugin Template

Template for building Claude Code + OpenClaw plugins that consume x402-enabled MCP servers. The client-side companion to x402-app-template.

Quick Start

  1. Clone this template
  2. Run ./init.sh my-plugin-name https://my-server.com/mcp
  3. Replace example skills in .claude/skills/ with your tool interactions
  4. Replace example tools in openclaw-plugin/ with your MCP tool definitions
  5. Update shared/config.ts with any custom configuration

Directory Structure

.claude/           Claude Code plugin
  settings.json    MCP server connection
  skills/          One markdown file per tool interaction
  commands/        Slash commands
  hooks/           Lifecycle hooks (session start, etc.)
openclaw-plugin/   OpenClaw plugin
  src/index.ts     register() with hooks and tool proxies
  openclaw.plugin.json  Tool definitions
shared/            Shared between both platforms
  config.ts        Server URL and auth config
  types.ts         Common TypeScript types

x402 Payment Flow

Paid tools use the x402 micropayment protocol:

  1. Call the tool without a payment parameter
  2. Server returns PAYMENT_REQUIRED with price and network details
  3. Present the cost to the user
  4. If confirmed, sign the payment with the user's wallet
  5. Call the tool with the payment parameter (base64 signature)
  6. Server verifies payment, settles on-chain, returns data

Related

About

Template for building Claude Code + OpenClaw plugins that consume x402 MCP servers

Resources

License

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors