MCP overview
Status: agent keys and OAuth, outside agents not yet proven
- What is there today. An MCP endpoint, a registry of shop operations served through four generic tools, agent keys that a shop administrator makes for an AI agent, and an OAuth sign-in for clients that cannot send a key header (such as ChatGPT) or prefer to sign in. This page describes them as the code stands on master after release 1.1.0.
- Off until switched on. MCP is off for every shop until a shop administrator switches it on.
- Not proven with an outside agent. As far as the repository shows, no outside agent has been connected to a running installation. Automated tests cover the endpoint, the keys, the limits, the refusals and the OAuth flows.
What MCP is
The Model Context Protocol (MCP) is a protocol that lets an AI agent call tools on a server. The agent asks the server which tools exist, and then calls them with arguments. The server decides what the caller may do. Tienda runs an MCP server so that an agent can look things up in a shop and, where the key allows it, change things.
The endpoint
- Path:
POST /mcp, on the same address as the API. Any path that starts with/mcpis handled by the MCP server. The address of your installation is shown under Settings > AI agents (MCP). - Transport: the streamable HTTP transport, stateless. Every request is a complete
JSON-RPC message answered with a JSON body, nothing is kept between two requests
and a client needs no session. There is no stream from the server:
GET /mcpis answered405. - Every request is checked for a credential first. Without one the answer is
401with a JSON body{"error": "...", "code": "missing_credentials"}and aWWW-Authenticateheader that points at the OAuth metadata (see Connect with OAuth). - Everything an agent sees and does is limited to one shop: the one the key or the OAuth token belongs to.
Four tools, many operations
The server announces four MCP tools. The shop's operations are not separate MCP tools; they are reached through these four:
| Tool | What it does |
|---|---|
search_tools | Finds operations the caller may use, by a word in the name, summary or domain, with their input schemas. Declared read only. |
fetch_tool_definitions | Returns the input schemas of operations, by name. Declared read only. |
invoke_read_tool | Runs one read operation by name. Refuses anything that changes data. Declared read only, so a client can allow it without asking. |
invoke_tool | Runs any operation the key may use, including those that change data. Declared as not read only and as destructive, so a client can ask a person before each change. |
Operations the caller may not use are hidden from search and refused when run. Every attempt, allowed or refused, is recorded in an audit log.
Connect your agent
There are two ways in: an agent key that you hand over once, or an OAuth sign-in made in the client itself. Both need MCP switched on for the shop.
With an agent key
Three things first. A shop administrator switches MCP on, makes a key, and hands it over once.
- Switch MCP on. Under Settings > AI agents (MCP) a shop administrator
switches "AI agents may connect to this shop" on. While it is off, every
request is refused with
403andmcp_disabled, whatever keys exist. If the shop's data is mirrored from a POS, the administrator must also confirm that mirrored records stay read only for agents. - Make a key. On the same page choose New key, give it a name (at most
80 characters), a preset of rights (the default is Read only), optionally
some areas such as
ordersandcustomers, and a lifetime (90 days by default, at most one year). Only shop administrators can do this. - Copy the key now. It starts with
tak_and is shown once. Only a keyed digest is stored, so it cannot be shown again; if it is lost, revoke it and make a new one. The key belongs to one shop and sees only that shop's data.
Then send it as a bearer token. Replace the address with the one shown in your
settings and tak_... with your key.
curl -s https://<your API address>/mcp \
-H "Authorization: Bearer tak_..." \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'The answer lists the four tools. Without a key, or with a key that is unknown,
revoked or expired, the answer is 401 and the body names the reason in code.
Claude Code
claude mcp add --transport http tienda https://<your API address>/mcp --header "Authorization: Bearer tak_..."Any client that reads an .mcp.json file
{
"mcpServers": {
"tienda": {
"type": "http",
"url": "https://<your API address>/mcp",
"headers": { "Authorization": "Bearer tak_..." }
}
}
}Claude Desktop reaches a server that takes a header through the mcp-remote
bridge, which needs Node.js. Add this to its configuration file:
{
"mcpServers": {
"tienda": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://<your API address>/mcp", "--header", "Authorization:${TIENDA_AUTH}"],
"env": { "TIENDA_AUTH": "Bearer tak_..." }
}
}
}The settings page shows these three snippets with your address and the new key filled in, once, right after the key is made.
Connect with OAuth
A client that supports OAuth connects without a key. Claude.ai, ChatGPT, Claude Code, Cursor and VS Code can do this. ChatGPT can only do this: it cannot send a custom key header. Claude.ai, Claude Code, Cursor and VS Code can still use an agent key instead.
Tienda is the OAuth authorization server for its MCP address. The sign-in itself is the Shiloh account, the same one the back office uses; there is no separate Tienda password for agents. The identity provider does not issue the MCP token and is not in the path of an MCP call: Tienda issues its own access and refresh tokens, bound to the person, one shop and the MCP address.
- In the client, add a remote MCP server with the address from Settings >
AI agents (
https://<your API address>/mcp). Leave any Authorization header empty. - The client opens Tienda in a browser. Sign in with your Shiloh account.
- Choose the shop the assistant may work in, read what it may do, and press Allow.
- The client is connected. The access token lasts a day and the client renews it with a rotating refresh token.
Every AI client is a public client: it has no secret. PKCE with S256 is required. A client registers itself in one of two ways: a Client ID Metadata Document (the MCP specification's preferred way; ChatGPT uses it) or dynamic client registration. The public addresses are:
| Address | What it is |
|---|---|
/.well-known/oauth-protected-resource/mcp | RFC 9728 protected-resource metadata for the MCP endpoint |
/.well-known/oauth-authorization-server | RFC 8414 authorization-server metadata |
/oauth/authorize | the consent screen (sign in, choose the shop, approve or deny) |
/oauth/token | authorization code and refresh token grants |
/oauth/revoke | token revocation (RFC 7009) |
/oauth/register | dynamic client registration (RFC 7591; public clients, rate limited) |
/oauth/login | starts the Shiloh account sign-in for the consent flow |
A request without a usable token answers 401 with the RFC 9728 pointer:
WWW-Authenticate: Bearer realm="MCP", resource_metadata="https://<your API address>/.well-known/oauth-protected-resource/mcp"A client that supports OAuth follows that address, reads the authorization-server
metadata and signs in. error="invalid_token" is added only when a credential was
sent and refused.
The token acts as the person who approved it:
- the person must still be a member of the chosen shop;
- the shop's MCP switch must be on, and the shop must not be suspended or archived;
- the token's scopes (
read,write,admin) cap what it may do, andadminoperations also require the person to be a shop administrator; - the same role and permission checks apply as for any other credential, including the rules for records mirrored from a POS.
Under Settings > AI agents you see the assistants you connected to this shop and can disconnect one at once. A shop administrator sees every connection in that shop, whose it is, and can disconnect any of them; nobody sees another shop's connections. A shop administrator does not approve each client: the person approves on the consent screen with their own account.
A connection ends when the person loses their membership, when the shop is suspended or archived, when the shop's MCP switch is off, when it is disconnected in Settings, or when the sign-in it came from is ended: a back-channel logout for that provider session, or a provider-wide logout or disabled account. Disconnecting your own connection revokes every token of that client for you in that shop; an administrator can do the same for another person. The refresh token rotates on use and has no fixed expiry, so disconnecting is what ends it.
What an agent key may do
A preset fills the key's permission list when the key is made, from the same permission names the roles use (see Roles and permissions). The key keeps its own copy: later changes to a preset do not change existing keys. An area limit narrows a key further and never widens it.
| Preset | Changes |
|---|---|
| Read only (default) | Nothing. |
| Catalogue manager | Add a product. |
| Orders clerk | Create and update orders, add a catalogue product to an order and change a line's quantity, move an order to a status the shop marked as initial or in progress, update fulfilments, create and update customers and contacts. |
| Stock keeper | Create and update stock locations, book stock movements and transfers, release reserved stock. |
| Content editor | Create and update pages, page blocks, menus, announcements and media assets. |
Every preset can also read. An agent key changes data only through the operations and arguments the code lists for these presets; any other argument is refused.
What an agent can never do
These are fixed in the program. No preset and no permission list switches them on:
- take payments, refund, or set or change prices, discounts and tax: an order line is always for a catalogue product, and the server prices it;
- delete anything, or void or cancel;
- manage staff, roles, keys or the shop's settings;
- export data in bulk;
- send mail, messages or push notifications to customers, or edit e-mail templates and newsletters;
- run an operation that needs a person's confirmation, because the endpoint cannot ask one.
An agent's write never makes the shop mail a customer. When a status change or a new order would normally send the customer a mail, the mail is not sent and the answer says so. Records that were mirrored from a POS are read only for agents.
Limits
| Calls per key | 120 a minute. Over that: 429 with Retry-After. |
| Tool calls at the same time | At most 2 per key and 3 per shop. Over that: 429 with code concurrency_limit and Retry-After. |
| Query time | A database query that runs longer than 25 seconds is cancelled. |
| Request time | A call is stopped after 30 seconds in total. |
| Time-outs | Both of the above answer 503 with request_timeout and Retry-After. Ask for less data and try again. |
| One message per request | The body must be one JSON object. A batch (a JSON array) is answered 400 with JSON-RPC error -32600. |
| Size and type | Body up to 1 MiB (413), content type application/json only (415), and an Accept header that includes application/json (406). |
The first two rows are enforced per agent key. An OAuth connection has no per-token rate limit or concurrency cap of its own; the shop's MCP switch, the person's membership and the other limits in this table still apply. The two concurrency numbers can be changed by the operator, see Configuration.
Revoke at once
A key is checked on every request. Revoke under Settings > AI agents (MCP) stops it with the next request. A key belongs to the shop, not to the person who made it: it keeps working when that person leaves, so revoke it then.
What was refused
A problem before a tool runs is an HTTP error with {"error": "...", "code": "..."}:
401 (missing_credentials, invalid_credentials, key_revoked, key_expired),
403 (mcp_disabled, and shop suspended or archived), 429, 413, 415, 406,
400 and 503. invalid_credentials also covers an OAuth token issued for another
audience, for a shop the person has left, or one that was revoked or has expired.
Every 401 carries the RFC 9728 pointer to this API's protected-resource metadata,
and error="invalid_token" only when a credential was actually sent:
WWW-Authenticate: Bearer realm="MCP", resource_metadata="https://<your API address>/.well-known/oauth-protected-resource/mcp"A client that supports OAuth follows that address and signs in (see Connect with OAuth). A client that supports a header can send an agent key instead.
A tool that is refused or fails answers normally (HTTP 200) with isError: true
and a sentence in the first text content, for example "This key can only read." or
"This operation is not available to agent keys."
Shop API keys do not work here
The shop API key (mkt_..., see API keys) is refused on this
endpoint with 401 and shop_key_not_accepted. Make an agent key instead.
Other credentials
A staff session token (see the API overview) also works as the bearer credential, for a person testing from a client that takes a header. It lasts 24 hours, acts as that person with their role and permissions, and the shop's MCP switch applies to it too. It is not meant for agents.
An OAuth access token from Connect with OAuth works the same
way: it acts as the person who approved it, in the shop they chose, with the scopes
and the permissions they have. It is opaque; send it as
Authorization: Bearer <token>. The shop and the person are re-checked on every
request.
What the registry holds
240 operations for shops in 16 domains, at commit 4914a7d. The registry also
holds three operations for platform operators; they are not listed. An agent key reaches
only part of the registry, see What an agent key may do. The
rows below add up to 240. This table was made by hand from the code; a generated
reference follows.
| Domain | Operations | Read | Ask for confirmation | What it covers |
|---|---|---|---|---|
orders | 16 | 5 | 2 | Orders, order lines, order statuses, status mail. |
catalog | 3 | 2 | 0 | Products. |
payments | 1 | 0 | 1 | Refunding a payment. |
inventory | 15 | 8 | 2 | Locations, stock movements, balances, reservations, transfers, low stock. |
customers | 19 | 9 | 3 | Customers, contacts, companies, messages. |
invoices | 15 | 5 | 3 | Invoices, items, finalizing, voiding, PDF. |
fulfillment | 18 | 6 | 4 | Fulfilments, delivery and pickup slots, route plans. |
subscriptions | 18 | 7 | 5 | Plans, subscriptions, customers' subscriptions, renewals. |
events | 19 | 10 | 2 | Events, ticket types, tickets and scanning, stalls, attendees. |
cms | 31 | 10 | 7 | Pages, blocks, menus, announcements, e-mail templates, media. |
reports | 18 | 18 | 0 | The statistics reports. |
tax | 8 | 4 | 1 | Tax rates, region profile, tax on an order. |
notifications | 12 | 4 | 4 | Notifications, push messages, webhook endpoints and deliveries. |
settings | 15 | 6 | 3 | Shop fronts, palettes, the setup steps. |
integrations | 17 | 6 | 8 | Print hubs, QuickBooks, the POS mirror, imports, search index. |
staff | 15 | 0 | 3 | Users, the shop's settings, API keys. Administrators only. |
The books, payroll and tax-return parts of the product are not in the registry.
Examples of what it holds: list and read orders, change an order's status, add a
line to an order; list and create products; record a stock movement or read a
stock balance; create a contact; read the statistics reports; list and edit pages
and menus; list webhook endpoints. The arguments of each operation come from
search_tools and fetch_tool_definitions; this page does not repeat them.
Limits, stated plainly
Each of these was read from the code and not tried against a real client:
invoke_toolis marked as a write. A client may ask a person before every call through it. Reads go throughinvoke_read_tool, which is marked read only.- No idempotency and no pagination. Operations take no idempotency key, so a
repeated call repeats the change. Lists take a
limitwith a cap and have no page or cursor. - Areas built recently have no operations yet. The registry has none for coupons, gift cards, loyalty, shifts and cash drawers, standing orders, prices or suppliers and purchases.
- Every call is audited. Each
invoke_toolattempt is recorded with the shop, the person if there is one, the operation, and whether it was allowed. - Never tested with an outside agent, as far as the repository shows.
The connection steps above have a worked request, client configurations and the OAuth flow. They were written from the code and have not been tried against an outside agent.