setup-x402-server

setup-x402-server is a command for Claude Code from Dexter-DAO/opendexter-ide. It costs 24 tokens per session (668 once invoked), scanned A, original, MIT.

A setup command for adding x402 payment checks to an Express API endpoint. x402 is a way for users to pay for an API request with USDC, a digital dollar token.

In plain words
What is it for?
It helps install the payment SDK, add payment middleware to an Express route, and test the route with curl.
Why use it?
It prevents an endpoint from serving protected data until the required payment succeeds.

Command for Claude Code

Written for Claude Code: a Claude Code command (commands/*.md). Also seen: positional $N argument.

Good fit It helps install the payment SDK, add payment middleware to an Express route, and test the route with curl.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/dexter-dao/opendexter-ide/setup-x402-server
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/Dexter-DAO/opendexter-ide

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for setup-x402-server

README.md
[![agentmods](https://agentmods.dev/badge/commands/dexter-dao/opendexter-ide/setup-x402-server/github.svg)](https://agentmods.dev/commands/dexter-dao/opendexter-ide/setup-x402-server)
Your own site
<a href="https://agentmods.dev/commands/dexter-dao/opendexter-ide/setup-x402-server"><img src="https://agentmods.dev/badge/commands/dexter-dao/opendexter-ide/setup-x402-server/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for setup-x402-server

Your own site · 80×15
<a href="https://agentmods.dev/commands/dexter-dao/opendexter-ide/setup-x402-server"><img src="https://agentmods.dev/badge/commands/dexter-dao/opendexter-ide/setup-x402-server.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 24 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 668 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00024 $0.00668
Opus 5 $0.00012 $0.00334
Sonnet 5 $0.00005 $0.00134
Haiku 4.5 $0.00002 $0.00067

Measured 8d ago against content hash fcf7c6946d07, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

setup-x402-server scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

3. Test with curl — first request gets a 402:
packages/mcp/commands/setup-x402-server.md · 88 lines

How it starts

The opening of the file, as written. The whole thing — 88 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Add x402 Paywall to Your Server

Protect any Express endpoint with x402 payments. Users pay USDC to access your API.

The test client below is an independent @dexterai/x402 SDK integration. It is not the OpenDexter MCP runtime and does not inherit OpenDexter identity, authority, limits, or receipts. Never substitute it for a blocked OpenDexter account-bound operation.

Steps

  1. Install the SDK:
npm install @dexterai/[email protected] @dexterai/[email protected]
  1. Add the middleware to any Express route:
import express from 'express';
import { x402Middleware } from '@dexterai/x402/server';

const app = express();

app.get('/api/premium-data',
  x402Middleware({
    payTo: 'YOUR_SOLANA_ADDRESS', // Replace with your wallet address
    amount: '0.01',               // $0.01 per request
  }),
  (req, res) => {
    // This only runs after successful payment
    res.json({
      data: 'premium content',
      payer: req.x402?.payer,
      transaction: req.x402?.transaction,
    });
  }
);

app.listen(3000);
  1. Test with curl — first request gets a 402:
curl -i http://localhost:3000/api/premium-data
# HTTP/1.1 402 Payment Required
# PAYMENT-REQUIRED: eyJ4NDAy...
  1. Test with a funded x402 client:
import { createKeypairWallet, payAndFetch } from '@dexterai/x402/client';

const solana = await createKeypairWallet(process.env.SOLANA_PRIVATE_KEY!);

const paid = await payAndFetch(
  'http://localhost:3000/api/premium-data',
  { method: 'GET' },
  { solana },
  { maxAmountAtomic: '10000', solanaRpcUrl: process.env.SOLANA_RPC_URL },
);
if (!paid.ok) throw new Error(`${paid.reason}: ${paid.detail ?? ''}`);
if (!paid.response) throw new Error('Payment settled without a merchant response');
const res = paid.response;
console.log(await res.json());
// { data: "premium content", payer: "2SB3V...", transaction: "5xK9..." }

Options

  • Dynamic pricing: Use getAmount: (req) => calculatePrice(req.body) for request-dependent pricing.
  • EVM chains: Set network: 'eip155:8453' for Base instead of Solana.
  • Multi-chain: Pass a network array and a per-network payTo map.

Read the full file on GitHub · 88 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 88 lines · 24 tokens per session scan A fcf7c6946d07

Subscribe to this mod's changes

setup-x402-server is a command published in the GitHub repository Dexter-DAO/opendexter-ide (2 stars, last pushed 3d ago), licensed MIT. It adds 24 tokens to every session and 668 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other commands, from other repositories