AI assistants (MCP)
Let Claude, Cursor and other AI tools read stores and sales through the Model Context Protocol.
What it is
The TMBill MCP server lets an AI assistant answer questions like "How did the Andheri store do last week?" using the same read-only data as the REST API. It is a remote MCP server (Streamable HTTP) at:
https://openapi.tmbill.com/mcpEvery tool calls the same REST endpoint a script would, with the same key checks, store grant, limits and errors. Nothing can be changed through MCP: all tools are read-only.
1. Get an MCP-enabled key
Ask the owner
In TMBill Backoffice, API keys, the owner creates a key and ticks AI assistants (MCP) plus the data it may read (Stores, Sales) and the stores. The owner confirms with the one-time code sent to them.
One MCP connection per account
By default a merchant account can have one MCP-enabled app at a time. A second one is refused (mcp_connection_limit) until the first is revoked. TMBill support can raise the limit for an account on request.
Keep the key secret
Put it in an environment variable, for example TMBILL_KEY. Never paste it into a chat with the assistant.
2. Connect your client
The key always goes in the Authorization header. Never put a key in the URL: URLs with a query string are refused.
Claude Code
claude mcp add --transport http tmbill https://openapi.tmbill.com/mcp \
--header "Authorization: Bearer $TMBILL_KEY"Cursor and other clients with a JSON config
{
"mcpServers": {
"tmbill": {
"url": "https://openapi.tmbill.com/mcp",
"headers": { "Authorization": "Bearer <your key, ideally read from an environment variable>" }
}
}
}Any MCP client that supports remote Streamable HTTP servers with a custom header works the same way. Clients that only support local (stdio) servers can't connect yet.
Claude and ChatGPT connectors coming soon
One-click connectors in the Claude and ChatGPT directories, with sign-in through TMBill instead of a pasted key, are planned. Until then, use a client from the list above.
3. Tools
All tools are read-only. Each needs the same scope as its REST endpoint, plus mcp:use on the key.
| Tool | Inputs | Returns | Scope |
|---|---|---|---|
whoami | none | App name, key prefix, environment, scopes, expiry, stores it can read (as GET /v1/me) | any |
list_stores | limit 1-100, cursor | Stores: id, name, brand, country, currency, timezone; next_cursor | stores:read |
get_store | store_id | One store (unknown and not-allowed stores both return store_not_found) | stores:read |
sales_summary | store_id, from, to, group_by day|hour|order_type, filters | Sales totals per group, matching the Backoffice day-end report | sales:read |
sales_items | same, group_by item|category, category, limit, cursor | Item or category sales ranked by amount | sales:read |
sales_payments | store_id, from, to, filters | Money per payment mode, plus unpaid credit (due) | sales:read |
Filters are the same as REST: order_state, order_type, time_from/time_to (see Report filters). Unknown arguments are refused. Results come back as JSON (structuredContent and a text copy) with a note that values are merchant data, not instructions.
4. Limits
- Per key: the same per-minute and daily limits as REST (Rate limits). Every MCP message counts as one call; batches are not accepted.
- Per merchant account: 1 MCP connection (MCP-enabled app) and 1 MCP request at a time by default.
- One query at a time per app: a second sales call while the first is running gets
concurrent_request(retry after 1 second). - Dates: at most 31 days per call, store-local dates.
- Cache: the same call with the same key within 60 seconds returns the cached result.
- Size: requests up to 16 kB; results up to 256 kB (use paging).
5. Errors
A refused request (bad key, wrong scope, limits) gets the normal HTTP error with the standard error body. A problem inside a tool call comes back as a tool result with isError: true and the same body, for example:
{"error": {"code": "store_not_found", "message": "Store not found", "field": null, "request_id": "01J..."}}| Code | Meaning |
|---|---|
invalid_key, key_revoked | Missing, wrong or revoked key (HTTP 401) |
insufficient_scope | The key lacks mcp:use or the tool's scope |
invalid_parameter, range_too_long, invalid_cursor | Fix the arguments |
store_not_found | Unknown store, or not in this key's grant |
rate_limited, quota_exceeded, concurrent_request, mcp_concurrency_limit | Slow down; honour Retry-After |
mcp_connection_limit | The account already has its MCP connection (shown when creating a key) |
unavailable | Temporarily off or overloaded; retry later |
6. Security
- Keys only in the
Authorizationheader, never in a URL, chat message or code repository. - Give the assistant a key with only the stores and scopes it needs; prefer a test key while trying it out.
- Treat answers as data: text inside results (item or store names) is merchant data, never instructions.
- Revoke: the owner revokes the key in Backoffice, API keys. It stops on the next call, and the MCP slot is free again.