sheettoasin-mcp-amazon-fba
README.md
# SheetToASIN MCP tools
`@sheettoasin/mcp-amazon-fba` connects an AI client to the same authenticated
quote-verification API as SheetToASIN. Node.js 20 or newer is required.
**Prepared for release, not published by this project.** No npm organization,
package ownership, registry availability, or one-click marketplace installation
is claimed. Local source builds work without publishing.
## Build and run locally
From this repository's root:
```sh
npm ci
npm run build:mcp
```
Set `SHEETTOASIN_API_KEY` privately in your local environment to a personal
`sta_live_…` key created in SheetToASIN → Plan & Billing → API keys & AI agents.
Do not paste credentials into chat, command arguments, source control, URLs,
or configuration-download links. Then:
```sh
node mcp-server/dist/cli.js
```
The default API origin is `https://sheettoasin.com`. Set
`SHEETTOASIN_BASE_URL` only to a **trusted** HTTPS origin, or HTTP loopback for
local testing. The adapter refuses URL credentials, paths, queries, fragments,
non-HTTPS remote origins, and redirects; it never forwards a key through a
redirect. Stdio stdout contains MCP protocol messages only; diagnostics use
stderr. Shut down with stdin EOF, SIGINT, or SIGTERM.
## Tools and contract
Exactly two tools are registered:
* `verify_amazon_wholesale_quote`: `{requestId, identifier, supplierCost,
supplierPackCount?, inboundPrep?}`.
* `batch_check_multipack_traps`: `{requestId, quotes:[…]}`; 1–20 quote bodies,
with at most two in flight. Results preserve input order. Every item has an
independent allowance charge and result; a partially unsuccessful batch has
`isError: true`. Retry the unchanged ordered batch with the same request ID.
`requestId` is a unique operation ID, 16–128 characters from letters, digits,
periods, underscores, colons and hyphens. Reuse it with identical normalized
inputs to recover network retries during the 24-hour idempotency window.
Do not put credentials in request IDs.
`identifier` is a 10-character ASIN or checksum-valid GTIN-8, UPC-A, EAN-13, or
GTIN-14 string. Barcodes retain leading zeroes; a nonzero case GTIN is not a
unit UPC. Ambiguous or unconfirmed barcode matches fail and ask for an ASIN.
`supplierCost` and `inboundPrep` are non-negative **USD decimal strings**, at
most two decimal places, maximum `999999.99`. They price **one supplier unit**.
`supplierPackCount` defaults to 1 and must be an integer 1–10,000.
`inboundPrep` defaults to `"0.00"` and combines inbound shipping/preparation
cost per priced supplier unit. Landed cost combines both amounts, multiplies
by Amazon pack count / supplier pack count, then rounds UP once to whole cents.
Referral cents round from the reported percentage at the observed Buy Box.
Net profit subtracts landed cost and reported FBA/closing/referral fees; ROI
includes inbound/prep in its cost denominator and is null at zero landed cost.
Break-even subtracts inbound/prep from the maximum whole-cent supplier-unit
budget and is null when no non-negative supplier cost breaks even.
Results expose USD decimal strings, pack mismatch, source observation/expiry,
fee-update timestamp, provenance, and allowance usage. Inputs and outputs are
validated. Missing fees—including a missing closing fee—are never replaced
with zero; an explicitly reported zero is valid. Both product observations
and fee timestamps must be within 24 hours. No samples, sandbox data,
historical price substitutes, or estimated fees are returned as verified quotes.
This is reported marketplace data, **not a guaranteed current Amazon quote**.
Confirm the listing identity, restrictions and final Amazon fees before buying.
## Allowance and retries
Free: **50 successful quotes/month**. Active Pro: **5,000/month**. The
America/New_York calendar-month counter is shared by all workspace keys and
both transports, and is separate from public checks, supplier rows, partner
bonuses and Audit Pass credits. Key rotation or plan changes never reset usage.
Pro remains effective through its recorded paid period; cancellation does not
remove it early. Downgrade preserves prior usage.
Successful cached checks and loss-making quotes count one each. Failed lookups,
stale/incomplete facts and upstream failures release their allowance reservation.
Each batch item counts independently. Processing attempts (including failed
lookups and same-ID retries) are separately limited to 30/minute and 200/day
Free; 120/minute and 5,000/day Pro. At most two account quotes may be in flight.
MCP HTTP transport requests also have an independent 120/minute Free,
500/minute Pro throttle, including initialization and tool listing.
Same-ID successful retries within 24 hours cost zero; a source that expires
before replay returns `idempotent_result_expired` without another charge.
Changed normalized inputs with an existing ID return `idempotency_conflict`.
Failed operation responses are also cached 24 hours: use the same ID to recover
a response, or a new ID to make a new attempt after any retry delay.
Abandoned reservations expire after 120 seconds and are reconciled on the next
account read or quote request. The original reservation month is charged even
when completion crosses a month boundary (`usage.chargedMonth`).
Revocation blocks new requests; previously accepted work may finish.
REST uses `POST /api/v1/verify-quote`, a personal Bearer key and the
`Idempotency-Key` header. Error envelope:
```json
{"ok":false,"error":{"code":"provider_busy","message":"Retry later.","retryable":true,"retryAfter":60}}
```
HTTP codes include 400 invalid input/operation ID, 401 invalid/revoked key,
403 inaccessible workspace/untrusted HTTP origin, 404 unknown product,
409 conflicting/expired idempotent result, 422 missing/stale facts or an
ambiguous/unconfirmed identifier, 429 account allowance/attempt/concurrency
limits, and 503 provider/service unavailable. REST/HTTP transport responses
include `Retry-After` where applicable; tool errors include retry timing in
their structured result. See `/developers` for the full contract.
## Claude Desktop
In Settings → Developer → Edit Config, merge the following `mcpServers`
entry. Use an **absolute local path**, replace the placeholder privately, and
restart Claude Desktop. Never commit the credential.
```json
{
"mcpServers": {
"sheettoasin": {
"command": "node",
"args": ["/ABSOLUTE/PATH/mcp-server/dist/cli.js"],
"env": {"SHEETTOASIN_API_KEY": "YOUR_PERSONAL_KEY"}
}
}
}
```
This documented Desktop setup uses local stdio; it does not pretend that a
remote OAuth-only setup screen supports arbitrary static Bearer headers.
## Cursor / hosted Streamable HTTP
The existing SheetToASIN app serves `/api/mcp`; no second deployment is needed.
Every HTTP request authenticates the caller's key. There is no ambient operator
key, shared logged-in client, or cross-user MCP session.
Merge into private `.cursor/mcp.json` (Cursor supports environment interpolation):
```json
{
"mcpServers": {
"sheettoasin": {
"url": "https://sheettoasin.com/api/mcp",
"headers": {"Authorization": "Bearer ${env:SHEETTOASIN_API_KEY}"}
}
}
}
```
Make the environment variable available to Cursor, or replace its placeholder
in your private local configuration. Native clients may omit Origin; browser
origins must exactly match a known Host. Arbitrary Host/Origin values are
rejected. Hosted API/MCP routes must first be published by the app owner.
## Test and inspect
```sh
npm run test:developers
npm run build:mcp
npm pack --workspace @sheettoasin/mcp-amazon-fba --dry-run
```
The repository tests use isolated storage and mocked market data, including
official MCP clients over spawned stdio and real Streamable HTTP requests;
they make no paid provider requests, payments or email sends.
For manual local protocol inspection, after building:
```sh
npx @modelcontextprotocol/inspector node mcp-server/dist/cli.js
```
Set your local key environment first. The Inspector is a separate optional
development tool, not a claimed installed dependency.
## Owner release checklist — no automatic publishing
1. Review the license, package contents and documentation; verify the npm
account is allowed to publish under `@sheettoasin` (obtain the scope if needed).
2. Run the tests/build and inspect `npm pack --dry-run`. The explicit files
allowlist contains only `dist`, this README and the license; no app/customer
data, tests, environment files or credentials belong in the tarball.
3. Bump the version when appropriate. **Only an authorized owner**, after
authenticating privately with npm, runs:
```sh
npm publish --workspace @sheettoasin/mcp-amazon-fba --access public
```
4. Check the actual registry entry before advertising this install command:
```sh
npx -y @sheettoasin/mcp-amazon-fba
```
That command requires the owner to publish the package first. Preparing these
files does not publish to npm, reserve the scope, or publish the SheetToASIN app.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues