Developer docs
MCP server
SaleHero speaks the Model Context Protocol. Give an AI assistant one URL and one API key and it can answer questions from your real stock, orders, invoices and profit. With a full-access key it can also do work in the app, under limits you set.
Connect a client
- In Settings, API keys, create a key with the scope “AI agent, read-only” (or “AI agent, full access”, see below) and copy it.
- Add SaleHero to your MCP client with the URL and the key as a bearer header. Clients that speak Streamable HTTP connect directly:
{
"salehero": {
"url": "https://salehero.ro/api/mcp",
"headers": { "Authorization": "Bearer sbk_YOUR_KEY" }
}
}Clients that only speak stdio go through the mcp-remote bridge:
{
"salehero": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://salehero.ro/api/mcp", "--header", "Authorization: Bearer sbk_YOUR_KEY"]
}
}Then ask the assistant to call salehero_whoami: it answers with your organization, the key type and what the key may do. Where a client takes a command instead of a JSON block, the same two values (URL and Authorization header) are all it needs.
How it behaves
| Fact | Value |
|---|---|
| Endpoint | https://salehero.ro/api/mcp |
| Transport | Streamable HTTP, stateless: no sessions, every request stands alone |
| Auth | Authorization: Bearer sbk_… with an ai:read or agent key, checked before any request body is read |
| Rate limit | 120 requests per minute per key; over it, 429 with Retry-After |
| Audit | Every tool call is logged (key, tool, outcome, duration), never its arguments. Calls the generic tools make to the app are audited like any key call. |
What each key opens
| Key | Tools |
|---|---|
| AI agent, read-only (ai:read) | The read tools below, salehero_catalog and salehero_read, limited to the /api/ai/v1 routes. Nothing can change. |
| AI agent, full access (agent) | Everything: the catalog of routes as the key sees it, plus salehero_read and salehero_write on any route it lists. |
Start with read-only. A full-access key works as a colleague named after the key, with the admin role: it can do what an admin can in SaleHero, except anything that shows or takes a password or a key. It appears under Team, and what it does is attributed to it.
Narrow a full-access key
A full-access key is held to what its service user may do, and you can narrow it further. In Settings, API keys, each such key has a box of route rules: one rule per line, deny or allow, then the method and the path.
deny DELETE /api/**
deny * /api/apikeys/**
allow GET /api/orders/*** stands for any method, a single * for one path segment, ** for the rest of the path. A denied route answers 403 and disappears from the catalog; once the list has any allow rule, only the allowed routes remain.
The server asks for no approval of its own: it is the client's job to ask a person before a write tool runs (Claude Code's permission prompt, an always-ask setting in an agent platform). What SaleHero guarantees is the ceiling: role, sections and route rules on the key. Writes through salehero_write carry a fresh Idempotency-Key per call.
Tools
The read tools return the same data as the read API, in-process:
| Tool | Gives |
|---|---|
| salehero_whoami | Organization, key type, service user, sections, route rules |
| salehero_stock | One SKU's stock per warehouse, accounting vs warehouse system |
| salehero_movements | One SKU's stock ledger, paged |
| salehero_cost | One SKU's unit cost and pricing cost basis |
| salehero_product, salehero_find_products | One product sheet; products by words or by SKU list |
| salehero_orders, salehero_order | Orders across channels; one order |
| salehero_returns, salehero_return | Return cases; one case |
| salehero_invoices, salehero_invoice, salehero_receivables | Invoices, one invoice, what is owed |
| salehero_sales, salehero_profit | Sales over a period; profit per SKU |
| salehero_sync_status | How fresh each source is |
Three generic tools work on the app's own routes:
| Tool | Does |
|---|---|
| salehero_catalog | Lists the routes this key may call, by area, section, text or path, with schemas when few are found |
| salehero_read | GET (or a read-level POST) on a listed route; a file answer comes back base64 when under 1 MB |
| salehero_write | POST, PATCH, PUT or DELETE on a listed route (full-access keys only); uploads are not possible |
A route the key may not call answers 403 agent_forbidden through the tool, as an error the model can read. The generic tools go through the same HTTP routes with the caller's key, so route rules, section guards, audit and idempotency behave exactly as for a direct call.