Connect AI Tools (MCP)
Let Claude, Cursor, or any MCP-compatible assistant read your SpireStock workspace, so you can ask questions in plain language instead of building a report for each one.
@spirestock/mcp-server is a Model Context Protocol server. Your AI tool runs it locally, it authenticates with a workspace API key you issue yourself, and it exposes eight read-only tools the assistant can call while answering you.
Read-only
This connection can look at your data. It cannot place orders, edit records, change settings, manage API keys, or touch billing. Those route groups are unreachable with an API key regardless of scope.
Setup
1. Create a connection key
In the SpireStock dashboard, open Developer → AI Tools and choose Generate connection key. This issues a read-only API key scoped to your workspace, valid for one year.
The key is shown once — only a hash is stored, so it cannot be retrieved later. It looks like df_ followed by 64 characters.
2a. Claude Code
Run this in your terminal:
claude mcp add --env SPIRESTOCK_API_KEY=df_your_key_here --transport stdio spirestock -- npx -y @spirestock/mcp-server2b. Claude Desktop, Cursor, and other clients
Add the server to the app’s MCP configuration file, then restart it:
{
"mcpServers": {
"spirestock": {
"command": "npx",
"args": ["-y", "@spirestock/mcp-server"],
"env": {
"SPIRESTOCK_API_KEY": "df_your_key_here"
}
}
}
}3. Check it works
Ask your assistant something only your workspace could answer — “what were yesterday’s orders?” or “which SKU sold best last week?” If it answers with real figures, the connection is live.
Available tools
| Tool | What it reads |
|---|---|
list_orders | Orders, filtered by date range, status, town, route, or a search over order code and customer name. |
get_order | One order with its line items. |
list_accounts | Customers and retailers, with name search. |
get_account | One account, plus its outstanding ledger balance. |
list_products | The SKU catalogue, with pricing and packaging. |
run_report | Any of 34 built-in reports — sales, SKU sales, attendance, expenses, distributor activity, beat productivity. |
dashboard_summary | Headline KPIs, monthly sales trend, recent orders, activity feed, crate balances. |
list_masters | Reference data — territories, routes, towns, brands, product classes, rate cards, shifts. |
run_report and list_masters take a slug rather than being split into one tool each. That keeps 89 endpoints from crowding out the rest of the list — an assistant given a hundred near-identical tools picks badly between them.
Configuration
| Variable | Default | Meaning |
|---|---|---|
SPIRESTOCK_API_KEY | required | Your workspace connection key. |
SPIRESTOCK_API_URL | https://api.spirestock.com | API host. Must be HTTPS unless it is localhost. |
SPIRESTOCK_TIMEOUT_MS | 30000 | Per-request timeout. Raise it for very large reports. |
Security
- Scoped to one workspace. The key carries its organization, and every request runs inside that tenant scope. It cannot read another organization’s data.
- Read-only. Issued with the
readscope, so writes are refused by the API as well as being absent from the package. - Cannot manage itself. API keys can never reach the developer, billing, auth, or admin route groups, so a leaked key cannot mint more keys, repoint a webhook, or start a purchase.
- Revocable. Delete the key under Developer → API Keys and it stops working immediately.
- Separately rate-limited. Each key gets its own bucket, so a busy assistant will not rate-limit you out of the dashboard.
- Plan-aware. On a paid plan, reads keep working even through a billing lapse — a failed card retry never breaks your integrations. On the free trial, API and AI-tool access ends with the trial and resumes on upgrade; your data stays viewable and exportable from the dashboard throughout.
Where your data goes
When you connect this server, the AI tool you are using reads your workspace data and sends it to whichever AI provider that tool runs on. That is your tool and your provider relationship, not SpireStock’s — but it is worth being deliberate about, particularly for customer, pricing, and margin data. Check your organisation’s policy before connecting.
Your key is also stored in a config file in plaintext, as with any CLI credential. Treat it like a password: do not commit it, and revoke it if the machine is shared or lost.
Troubleshooting
“SPIRESTOCK_API_KEY is not set”
The variable did not reach the process. In Claude Desktop and Cursor it belongs in the env block of the MCP config, not your shell profile — those apps do not inherit your terminal environment.
“SpireStock rejected the API key”
The key was revoked or has expired. Issue a new one from Developer → AI Tools.
“API key is not scoped for /reports”
The key was created with narrower scopes than the tool needs. Keys made through the AI Tools tab always carry read; a key created by hand may not.
It answered about today when I asked about last month
The orders endpoint returns today’s orders when no date range is given, so the assistant may have fetched a single day. The tool flags this in its output; if it happens, state the date range explicitly.
A report timed out
Large reports can exceed the 30-second default. Narrow the date range, or raise SPIRESTOCK_TIMEOUT_MS.
Frequently asked questions
What does the MCP server let an assistant do?
Why is it read-only?
Do I need a separate credential?
Can it read another organisation's data?
Where does my data actually go?
How do I revoke access?
Does it keep working if my trial ends?
Will an assistant flood my API or run up a bill?
Which clients does it work with?
Is this different from the AI assistant already in the app?
Next steps
- API keys and scopes — how keys authenticate and what they can reach.
- API reference — the endpoints behind these tools, if you would rather call them directly.
- Webhooks — for pushing events out to your systems instead of pulling data in.