MCP server#
Afosto has an MCP server: an endpoint that lets an AI assistant, such as Claude or ChatGPT, work with an Afosto account. A merchant connects it once and can then ask the assistant in plain language to find orders, change them, follow them, or adjust settings such as price lists and coupons.
The server speaks the Model Context Protocol over Streamable HTTP. It works with every client that supports remote MCP servers with OAuth.
Why use it#
- Ask instead of click. "Which orders for jane@example.com are still open?", "Cancel the second line of order 10293", "Give the summer coupons 15% off". The assistant finds the right calls.
- Combine with other tools. In the same conversation the assistant can read an email or a spreadsheet and act on it in Afosto, for example to process a list of returns.
- Nothing to build. There is no code or API key involved: the merchant logs in with their own Afosto account.
To build your own integration in code, use the GraphQL API instead.
Connecting#
- In the AI client, add a custom connector or remote MCP server with the URL
https://afosto.app/mcp. In Claude this is under Settings → Connectors. - The client sends you to Afosto to log in. Log in with your Afosto account and approve the access the client asks for.
- The client receives a token for your account and lists the Afosto tools. Ask your first question.
The client finds the login on its own: the server answers an unauthenticated call with a pointer to Afosto's OAuth configuration, and the client registers itself. Claude and ChatGPT are approved automatically.
The assistant acts as you: it sees and changes what your Afosto user may see and change. To disconnect, remove the connector in the client.
The client asks for all scopes the tools need when you connect. When new tools are added later, a token from before may lack their scope; connect again to grant it.
Tools#
Orders#
| Tool | What it does |
|---|---|
search_orders | Find orders, for example by email address, number or status. |
get_order, get_order_items | Read an order and its lines. |
update_order, set_order_reference | Change an order's details or set its reference. |
add_items_to_order, approve_order_items | Add lines, or approve lines that wait for approval. |
cancel_order, close_order, open_order, delete_order | Cancel, close, reopen or delete an order. |
restock_order_items | Put lines back in stock. |
prepare_refund | Prepare a refund. It never pays anything out; that stays a step in Afosto. |
Following order changes#
| Tool | What it does |
|---|---|
subscribe_orders | Follow changes to orders. |
get_order_changes | Fetch the changes since the last time, for clients that don't keep the event stream open. |
list_subscriptions, unsubscribe | See and stop what you follow. |
A client that keeps the stream open (GET /mcp) gets the changes as they happen. Repeated changes to one order within half a minute arrive as one message.
Settings#
Tools to read and change the account's setup: channels, price lists and prices, price rules, coupons, audiences, payment and shipping methods, zones, warehouses and locations, businesses, rule sets and replenishments. Each comes with tools to list and read them, and most with tools to create and update them.
Content#
When the account has Afosto CMS, the content tools of the CMS show up too, all starting with cms_.
Confirming changes#
Tools that are hard to undo, such as cancelling, closing or deleting an order, take two steps:
- The tool itself, for example
cancel_order, only shows a preview of what will happen and returns aconfirmation_token. - The assistant shows the preview to you. Only after you agree does it call
confirm_cancel_orderwith the token.
A confirmation token works once and expires after five minutes. Other changes, such as updating an order or a price list, happen straight away, so read what the assistant proposes before you agree.