Connect Your AI Agents (MCP)
Overview
Your own AI agents can work with your Haltless data over the Model Context Protocol (MCP): ask Claude which machines need attention this morning, have an agent in Cursor pull last week's critical alerts into a report, give a support assistant your downtime history, or let an agent open the work order for the fault it just found.
It connects with a service-account key, and what the agent may do is up to that key. Its role decides what the agent sees, exactly as in the portal: the pages the role can open decide which tools the agent is offered, and its machine groups decide which records come back. Its access, read only or read and write, decides whether it may also change things: acknowledge alerts, open and update work orders, log stops, schedule maintenance, as far as its role allows.
The setup below is also in the portal: on Settings → API Keys, select AI agents (MCP) beside Docs and Status, and the section opens with the configuration filled in for your server.
1. Choose a role
Decide what the agent should be able to read, and use (or make, under Settings → Roles) a role that sees only that. If it should also act, the role needs to be allowed that action too (below).
| The agent should read | The role needs the page |
|---|---|
| The fleet overview | Dashboard |
| Machines, their readings and OEE | Machines |
| Alerts | Alerts |
| Work orders | Work Orders |
| Downtime | Downtime Log |
| Maintenance | Maintenance |
The built-in Viewer role sees the dashboard, machines and alerts. To keep an agent to one site or line, give the role (or the service account) a machine scope.
An agent can change things only as far as its role could in the portal. Acknowledging alerts, opening and updating work orders, logging stops and scheduling maintenance take the Admin or Operator tier (or a custom role based on one), and logging stops and scheduling maintenance also stop working if you revoke downtime.write or maintenance.write from the role. A Viewer key never changes anything.
2. Create a service-account key
On Settings → API Keys, open AI agents (MCP) and select Create a service-account key (or select Generate New Key and choose Service Account), name it after the agent, pick the role, choose Access, and set an expiry. Copy the key: it is shown once.
- Read only for an agent that answers questions. It is offered only the reading tools, and nothing it does can change a record, through MCP or the rest of the API.
- Read and write for an agent that should act. It is offered the writing tools its role allows as well.
Give each agent its own key. Revoking it cuts that agent off, and its activity is told apart from the others': every change an agent makes is recorded in the audit log as its service account's.
3. Add the server to your agent
The server address is your API's, followed by /api/v1/mcp, for example https://api.haltless.io/api/v1/mcp. Replace YOUR_KEY below with the key.
Claude Code, in a terminal:
claude mcp add --transport http haltless https://api.haltless.io/api/v1/mcp \
--header "X-API-Key: YOUR_KEY"
Claude Desktop, in claude_desktop_config.json (Settings → Developer → Edit Config), then restart Claude. It connects through mcp-remote, which needs Node.js:
{
"mcpServers": {
"haltless": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://api.haltless.io/api/v1/mcp", "--header", "X-API-Key:${HALTLESS_API_KEY}"],
"env": { "HALTLESS_API_KEY": "YOUR_KEY" }
}
}
}
Codex: set the key in the environment Codex runs in, and add the server to ~/.codex/config.toml (or .codex/config.toml in a trusted project). Codex sends the key as a bearer token, so the file holds no secret:
export HALTLESS_API_KEY="YOUR_KEY"
[mcp_servers.haltless]
url = "https://api.haltless.io/api/v1/mcp"
bearer_token_env_var = "HALTLESS_API_KEY"
Cursor, in ~/.cursor/mcp.json (or .cursor/mcp.json in a project):
{
"mcpServers": {
"haltless": {
"url": "https://api.haltless.io/api/v1/mcp",
"headers": { "X-API-Key": "YOUR_KEY" }
}
}
}
VS Code, in .vscode/mcp.json. VS Code asks for the key once and keeps it in its secret storage, so the file can be committed:
{
"servers": {
"haltless": {
"type": "http",
"url": "https://api.haltless.io/api/v1/mcp",
"headers": { "X-API-Key": "${input:haltless-key}" }
}
},
"inputs": [
{ "type": "promptString", "id": "haltless-key", "description": "Haltless service-account key", "password": true }
]
}
Any other client that speaks MCP over Streamable HTTP: the URL above, with the key in an X-API-Key header, or as Authorization: Bearer YOUR_KEY if it can only send a bearer token.
What the agent can read
| Tool | What it answers |
|---|---|
get_fleet_overview | How many machines are healthy, in warning, critical or offline; active alerts; MTTR, MTBF, OEE and downtime; which machines need attention |
list_machines | Machines with their status, active alerts and last reading |
get_machine | One machine's status and the latest value of every metric it reports |
get_readings | A machine's metrics over 1 hour to 90 days |
get_oee | OEE per machine and shift day, and the period's averages |
list_alerts | Alerts raised in a period |
list_work_orders | Work orders created in a period |
list_downtime | Stops in a period, with reasons |
list_maintenance | Maintenance done or planned |
What the agent can do
With a read-and-write key, and a role allowed each action:
| Tool | What it does |
|---|---|
acknowledge_alert | Acknowledges an open alert |
create_work_order | Opens a work order on a machine, optionally for one of its alerts |
update_work_order | Changes a work order's status, priority, details, due date or completion notes |
log_downtime | Records a stop, running or ended, with its category and a note |
end_downtime | Ends a stop still going on |
schedule_maintenance | Puts maintenance on a machine's calendar |
update_maintenance | Changes a maintenance event's status, details or times |
Each is the portal's own action, with the same effects as a person taking it there. None deletes anything. The list tools give each record's id, which these take.
Arguments, limits and responses are in the MCP server reference.
Good to know
- Access follows the key. The key's role decides what the agent reads and which actions it may take, and its access whether it may take any. Give an agent the narrowest that does its job: a read-only key unless it should act, since a leaked read-and-write key could write through the rest of the API as well.
- Agents act on what you ask. The server tells agents to make a change only when the person they work for has asked for it, and every writing tool is marked as one that changes data, which many clients use to ask you before running it. Where your client lets you approve tool calls, keep that on for the writing tools.
- Your agent's model provider sees what the agent reads. The data an agent fetches goes to whichever AI service runs it, under your agreement with that provider, not Haltless's. Choose the role with that in mind.
- Lists are capped. A list returns up to 100 records (25 unless the agent asks for more), and machines up to 200 (100 unless it asks for more). Each says when there were more; there is no paging, so agents narrow the period or the filters instead.
- Requests count against the key's write limit (120 per minute for each key, within a ceiling for the company), since MCP requests are POSTs.