Pulls German and Luxembourg day-ahead electricity prices from SMARD at 15-minute resolution, but gates each API call behind a $0.001 USDC micropayment on Base mainnet using the x402 protocol. You get one tool that fetches the latest price data. Instead of an API key, you send an X-PAYMENT header generated by signing a transaction with your wallet. The MCP endpoint runs over streamable-http, so your client needs to support that transport. Useful if you're building energy trading models or smart home automations that need real-time price signals and you're comfortable with crypto wallet auth instead of traditional keys.
Paywalled SMARD day‑ahead electricity prices (DE‑LU, 15‑minute resolution) via x402 on Base mainnet. Hosted MCP (streamable‑http) + HTTP endpoint.
https://smard-energy-prices-x402.favo.workers.dev
GET https://smard-energy-prices-x402.favo.workers.dev/pricesPOST https://smard-energy-prices-x402.favo.workers.dev/mcp$0.001 per call (USDC on Base). Requires X-PAYMENT header (exact scheme).
{
"mcpServers": {
"smard-x402": {
"url": "https://smard-energy-prices-x402.favo.workers.dev/mcp",
"headers": {
"Accept": "application/json, text/event-stream"
}
}
}
}
import { createWalletClient, http } from "viem";
import { base } from "viem/chains";
import { privateKeyToAccount } from "viem/accounts";
import { createPaymentHeader, selectPaymentRequirements } from "x402/client";
const url = "https://smard-energy-prices-x402.favo.workers.dev/prices";
// 1) Get payment requirements
const res = await fetch(url);
const data = await res.json();
const req = selectPaymentRequirements(data.accepts, "base", "exact");
// 2) Create payment header
const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const client = createWalletClient({ account, chain: base, transport: http("https://mainnet.base.org") });
const xPayment = await createPaymentHeader(client, data.x402Version, req);
// 3) Call API with payment
const paid = await fetch(url, { headers: { "X-PAYMENT": xPayment } });
console.log(await paid.json());
Accept: application/json, text/event-stream.