run402-mcp
Version:
MCP server for Run402 — full-stack backend infrastructure for AI agents: Postgres, auth, storage, serverless functions and atomic deploys. Paid with x402/MPP. Includes $0.03 image generation.
27 lines • 1.23 kB
JavaScript
/**
* SIWX auth helper — re-exports core signing + adds MCP-specific error wrapper.
*/
import { getWalletAuthHeaders as _getWalletAuthHeaders } from "../core/dist/wallet-auth.js";
import { errorResult } from "./structured.js";
export const getWalletAuthHeaders = _getWalletAuthHeaders;
/**
* Get SIWX auth headers or return an MCP error result.
*/
export function requireWalletAuth(path) {
const headers = getWalletAuthHeaders(path);
if (!headers) {
// Creating a wallet writes a private key, which only the CLI hands to a
// person; `up` sets one up as part of its missing setup.
return {
error: errorResult("Error: No local wallet configured. `up` sets one up with the rest of any missing setup, or run `run402 init` to create and fund one.", {
code: "WALLET_NOT_FOUND",
message: "No local wallet configured.",
next_actions: [
{ type: "run_cli_command", command: "run402 init", why: "Create and fund a local wallet, or call `up`, which sets one up with the rest of any missing setup." },
],
}),
};
}
return { headers };
}
//# sourceMappingURL=wallet-auth.js.map