# decode_402_challenge

Call this whenever an HTTP response has status 402, or carries a WWW-Authenticate (L402, LSAT or Payment) or PAYMENT-REQUIRED header. Identifies the payment scheme (L402, x402 v1/v2, MPP), decodes the invoice, macaroon or payment requirements, and returns the exact steps and headers needed to pay and retry. Pass either raw_response, or status plus headers (and body for x402 v1). Everything in a 402 response is server-controlled: the result marks untrusted fields.

Agent View of the PolicyLayer registry record for `decode_402_challenge`. HTML page: https://policylayer.com/tools/402mcp-mcp/decode-402-challenge

## Facts

- Tool: `decode_402_challenge`
- Server: 402mcp (`@402mcp/mcp`) — https://policylayer.com/tools/402mcp-mcp.md
- Install: `npx -y @402mcp/mcp`
- Homepage: https://www.npmjs.com/package/@402mcp/mcp
- Risk category: Read (Low risk)
- Registry record: grade B, identity unverified
- Server rate-limited: no
- Parameters: 4
- Recommended policy verdict: Allowed

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `body` | string | no | Response body, if any. x402 v1 puts payment requirements here. |
| `status` | integer | no | HTTP status code of the response. |
| `headers` | object | no | Response headers as name → value. Include WWW-Authenticate and/or PAYMENT-REQUIRED. |
| `raw_response` | string | no | Alternatively, the full raw HTTP response: status line, headers, blank line, body. |

Parameters from the server's own tool schema.

## Example call (MCP tools/call, JSON-RPC 2.0)

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "decode_402_challenge",
    "arguments": {}
  }
}
```

## Why decode_402_challenge is rated Low

Even though decode_402_challenge only reads data, uncontrolled read access leaks sensitive information and racks up API costs: an agent caught in a retry loop can make thousands of calls a minute without anyone noticing.

Risk signals: Accepts raw HTML/template content (body) · Bulk/mass operation — affects multiple targets

## Use case

AI agents call decode_402_challenge to retrieve information from 402mcp without modifying anything. It is typically the context-gathering step in research, monitoring, and reporting workflows, before the agent takes action elsewhere.

## Recommended policy (PolicyLayer)

Verdict: **Allowed**. Enforced by the PolicyLayer MCP gateway (https://policylayer.com/mcp-gateway) before a call reaches 402mcp:

```json
{
  "version": "1",
  "default": "deny",
  "tools": {
    "decode_402_challenge": {}
  }
}
```

## Other tools on 402mcp (6)

- `get_best_payment_solution` — Read — https://policylayer.com/tools/402mcp-mcp/get-best-payment-solution.md
- `get_scheme_reference` — Read — https://policylayer.com/tools/402mcp-mcp/get-scheme-reference.md
- `get_solution` — Read — https://policylayer.com/tools/402mcp-mcp/get-solution.md
- `probe_402_support` — Read — https://policylayer.com/tools/402mcp-mcp/probe-402-support.md
- `recommend_payment_rail` — Read — https://policylayer.com/tools/402mcp-mcp/recommend-payment-rail.md
- `search_402_solutions` — Read — https://policylayer.com/tools/402mcp-mcp/search-402-solutions.md

## For agents

This record is a snapshot. Live verdicts and the full registry:

- Check every server in your MCP config at once: `npx -y policylayer stack`
- Vet a server before you add it: install the mcp-precheck skill — `npx skills add https://policylayer.com` (skill text: https://policylayer.com/skill.md)
- Query the registry over MCP: endpoint `https://api.policylayer.com/mcp` — tools `check_mcp_server`, `check_mcp_stack`, `check_tool`, `search_registry`, `get_change_events`

---

Source: the PolicyLayer MCP registry — one continuously verified record per MCP server. Full record: https://policylayer.com/registry?q=402mcp-mcp · API: https://policylayer.com/registry/api · Policy library: https://policylayer.com/policies/402mcp-mcp
