MCP server
An optional Model Context Protocol server for agent harnesses that speak MCP.
What it is
The Bayline MCP server is a thin wrapper over the HTTP API: typed tools instead of hand-written HTTP, with no business logic of its own. Every call goes through the API with a Bayline agent key, so the key’s person, role, scopes, propose-only setting, auto-apply policy, rate limits and audit trail apply exactly as for direct API calls.
- Transport: streamable HTTP at
/mcp(stateless, JSON responses). - Where: an optional service of your own Bayline installation (the
mcpcompose profile). By default it listens on the Bayline machine only; for a harness on another machine, use a trusted network, a VPN or an HTTPS proxy. - On this demo: there is no MCP server, and agent keys are refused.
Connect
Create an agent key first (how). Each client sends its own key:
{
"mcpServers": {
"bayline": {
"url": "https://<your-bayline-mcp>/mcp",
"headers": { "Authorization": "Bearer bk_xxxxxxxx.yyyyyyyy" }
}
}
}
Auth
- The client sends
Authorization: Bearer bk_…, its own agent key (the default). - Optionally the server holds one shared agent key. It is only used when the operator also sets a gate token and the client sends that token; otherwise it is refused.
- Every write tool needs
idempotency_key. A retry that leaves it out is refused, so it can never become a second shop write; send the same key when retrying the same change.
Tools
15 tools. Resolve names with lookup first and never invent ids.
| Tool | Kind | Arguments | What it does |
|---|---|---|---|
lookup |
read | q, kinds, limit |
Resolve what the user named (Norwegian is fine: “fres 10”, “mølle 1”, a serial, a scanned QR or barcode) to Bayline records. kinds: item, serial, tool, gage, machine, location, person. Use the top candidate only when needs_confirm is false. |
get_item |
read | item_id |
An item (tool or consumable) with stock per location, open loans and serials. |
get_gage |
read | gage_id |
A gauge (measuring instrument) with calibration status and next due date. |
get_machine |
read | machine_id |
A machine with meter reading, service plans, open flags and active faults. |
digest |
read | date |
Daily digest: low stock, calibrations due or overdue, service due, pending proposals, open faults and yesterday’s changes. |
proposal_status |
read | proposal_id |
Status of a proposal this key made: pending, applied, rejected or expired. |
propose |
write | operations, confidence, evidence, note, idempotency_key |
Propose a change set of API operations. Small low-risk changes may apply at once; otherwise a person confirms on the Pending page. |
stock_take |
write | item_id, qty, to_machine_id, location_id, note, confidence, evidence, idempotency_key |
Take (use up) a quantity of a consumable for a machine. Small takes apply at once; bigger ones wait for a person. |
stock_return |
write | issue_id, qty, condition, note, idempotency_key |
Return a loaned or issued tool. condition: ok, worn or damaged. |
meter_reading |
write | machine_id, reading, confidence, evidence, idempotency_key |
Record a machine meter (hours or cycles) reading. |
gage_use |
write | gage_id, n, note, confidence, evidence, idempotency_key |
Record uses of a gauge for usage-based calibration. A gauge that may not be used answers 409 gage_not_usable and nothing is counted. |
gage_hold |
write | gage_id, kind, comment, sent_on, expected_back_on, lab, document_ids, confidence, evidence, idempotency_key |
Put a gauge on hold: damaged, quarantined or other apply at once; out_for_calibration becomes a proposal that admin, superuser or quality confirms. |
gage_return_to_service |
write | gage_id, comment, document_ids, confidence, evidence, idempotency_key |
Ask to take a gauge off hold. This normally becomes a proposal that a person confirms. |
fault_report |
write | subject_kind, subject_id, description, severity, photo_ids, confidence, idempotency_key |
Report a fault on a machine, tool, serial, gauge or location. Always recorded at once. |
photo_upload |
write | subject_kind, subject_id, image_base64, filename, kind, caption, idempotency_key |
Attach a photo (base64 JPEG, PNG, WebP or HEIC, up to 8 MiB) to an item, serial, gauge, machine or fault. Returns photo ids to cite as evidence. |
Bold arguments are required.