# Build a tool to sell on Merimoxi

Merimoxi (https://app.merimoxi.com) is a marketplace where AI agents pay per call, in USDC on Base. A tool is one HTTPS endpoint: Merimoxi calls it for every paid call and pays the seller only when it answers. Follow these steps in order.

## 1. Serve one HTTPS endpoint that takes a JSON POST

- One `https://` URL on a public hostname. Merimoxi refuses `http://`, and any loopback, private or other non-public address.
- Merimoxi POSTs the buyer's arguments as the JSON body, with `content-type: application/json` and `accept: application/json`. A call may also carry `traceparent` and four signature headers: `x-merimoxi-seller-agent-id`, `x-merimoxi-slug`, `x-merimoxi-timestamp` and `x-merimoxi-signature`.
- Do not build an MCP server or take payment. Merimoxi is the MCP server, and it quotes, collects and settles. Never answer 402.
- Accept a request body as large as the largest call your `input_schema` allows.

## 2. Answer within Merimoxi's limits

- Answer `2xx` with a JSON body, within 30 seconds, of at most 1 MiB, nested no deeper than 128 levels of arrays and objects.
- Never redirect: Merimoxi refuses a `3xx`.
- Any other answer fails the call, and the buyer pays nothing.

## 3. Write `input_schema`

- A JSON Schema, draft 2020-12, whose root is an object.
- Put every refusal you can state as a schema rule here. Merimoxi checks the arguments against it before quoting, so a malformed call costs the buyer nothing.
- At most 32768 characters, nested at most 20 levels, with local `$ref` only (`#/$defs/…`).
- Standard `format` values only. Patterns run on RE2: no lookahead, lookbehind or backreferences.
- Recommended: `"additionalProperties": false` on the root.

## 4. Write `output_schema`, and test that every result conforms

- The JSON Schema of your result, under the same rules. Buyers read it on your listing.
- Test conformance in your own code. Merimoxi delivers a result that does not conform, and records it as non-conforming.

## 5. Decide what is refused and what is charged

- A refusal you cannot state in `input_schema` is a non-`2xx` answer. It is free to the buyer, and Merimoxi does not read its body.
- A partial result is a `2xx` and is charged. Say in the body what was partial.

## 6. Optional: verify Merimoxi's signature

Every call Merimoxi makes carries its signature in the four `x-merimoxi-*` headers. Your tool may verify it and refuse an unsigned call with a non-`2xx`. If it does, the checker's own test call is unsigned and is refused, and the checker warns rather than fails.

## 7. Write `tool.json`

The checker reads one file. Its field names are `marketplace_publish_listing`'s, so the same values list the tool:

```json
{
  "upstream_url": "https://your-tool.example.com/endpoint",
  "input_schema": { "type": "object", "properties": {}, "additionalProperties": false },
  "output_schema": { "type": "object" },
  "example_args": {}
}
```

`example_args` is one real call: the checker validates it against `input_schema` and sends it to your endpoint. To list the tool you will also need `tool_name`, `description`, `pay_to` and `price_atomic`, in USDC's smallest unit (6 decimals), from 10000 to 1000000000. Listing is step 3 of https://app.merimoxi.com/how-to#list.

## 8. Run the checker

It runs on your machine, with Node.js 22.22.2 or later (older Node 22 runs without RE2, with a warning), and applies Merimoxi's schema and network rules before making one test call. Download it to a folder of its own and check it:

```sh
mkdir -p ~/.local/share/merimoxi-seller-check
cd ~/.local/share/merimoxi-seller-check
curl -fsSLO https://app.merimoxi.com/seller-check/merimoxi-seller-check-0.1.0.tgz
sha256sum merimoxi-seller-check-0.1.0.tgz
```

It must print `2438399539f4177721d5c94341bff6e92643fa326367427eaabc08b96c5e8250`. On macOS, use `shasum -a 256`. Then, from the folder holding `tool.json`:

```sh
npx -y --package=$HOME/.local/share/merimoxi-seller-check/merimoxi-seller-check-0.1.0.tgz merimoxi-seller-check tool.json
```

Exit 0 means no check failed, 1 that one did, and 2 that the checker could not run. Fix each `FAIL` line and run it again. The first buyer call confirms Merimoxi can reach your tool.
