Docs / Assistant and AI
Connect your own AI (MCP and REST)
Make a token, then point Claude, ChatGPT or any client at the MCP or REST address. Reads are open to the token, writes become proposals.
Built. The owner makes tokens on Connect AI. Replace the host below with the address you opened.
Make a token
- Sign in as the owner and open Connect AI.
- Name the token, for example Claude desktop, and pick its reach: Read only, or Read and propose.
- Copy the token when it appears. It shows once and cannot be shown again. Only a fingerprint is stored.
- Revoke it any time from the list. The next call with it gets a 401.
- Tokens start with
lsk_. A workspace can hold up to 20 live tokens. - A token never reaches further than the person who made it, and a read only token never writes.
- The page lists the recent calls each token made, in plain words.
MCP
The endpoint is a Model Context Protocol server over Streamable HTTP. It is stateless and answers in JSON.
| URL | POST https://<your host>/api/mcp |
| Auth | Authorization: Bearer lsk_... on every request |
| Methods | initialize, ping, tools/list, tools/call |
| Other verbs | GET and DELETE answer 405. There is no streaming and no session. |
| Batches | Up to 20 messages in one array |
claude mcp add --transport http lockstock https://<your host>/api/mcp \ --header "Authorization: Bearer YOUR_TOKEN"
{
"mcpServers": {
"lockstock": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://<your host>/api/mcp", "--header", "Authorization:${LOCKSTOCK_AUTH}"],
"env": { "LOCKSTOCK_AUTH": "Bearer YOUR_TOKEN" }
}
}
}The Connect AI page fills these in with your real address and, right after you make a token, the token itself.
REST
The same tools are plain URLs. Send the same bearer token. Success is { "data": ... }, failure is { "error": { "code", "message" } }.
| Method and path | What it does |
|---|---|
GET /api/v1/items?q=&limit=&offset= | Items with available stock by warehouse and reorder points. q searches name or SKU. |
GET /api/v1/items/{id or SKU} | One item: stock by location, quantity on open purchase orders, preferred vendor, reorder rule. |
GET /api/v1/low-stock?limit= | Items at or under their reorder point, most urgent first. |
GET /api/v1/vendors?q=&limit= | Vendors with contact details and whether each is approved for auto-applied orders. |
GET /api/v1/purchase-orders?status=&limit= | Purchase orders with lines. Open ones by default. |
GET /api/v1/work-orders?status=&limit= | Work orders with item, quantities and due date. Released and started by default. |
GET /api/v1/sales-orders?status=&limit= | Sales orders with customer, lines, allocated and shipped. Open ones by default. |
POST /api/v1/purchase-order-proposals | Suggests a purchase order. Needs a Read and propose token. |
GET /api/v1/openapi.json | The OpenAPI schema. Public, no token needed. ChatGPT Actions can import it. |
limit is 1 to 100 (25 by default). The MCP tool names are list_items, get_item, low_stock, list_vendors, list_purchase_orders, list_work_orders, list_sales_orders and propose_purchase_order.
curl -H "Authorization: Bearer YOUR_TOKEN" \ "https://<your host>/api/v1/items?q=paprika"
curl -X POST https://<your host>/api/v1/purchase-order-proposals \
-H "Authorization: Bearer YOUR_TOKEN" -H "Content-Type: application/json" \
-d '{"vendor":"Northwind Waxes","lines":[{"item":"WAX-SOY-5","quantity":100}],"request_id":"my-id-1"}'For ChatGPT: make a custom GPT, open Actions, choose Import from URL with the openapi.json address, then set Authentication to API key, Bearer, with your token.
What a write does
- The only write is the purchase order proposal. It creates a proposal in Approvals. It does not place an order.
- Prices come from Lockstock's records, not from the client. Send your own
request_idand a retry makes the same proposal once. - If the owner has set an auto-apply limit above $0 and the vendor is approved, a proposal within the limit applies itself and is logged as Auto-applied. The limit starts at $0.
- All-stop refuses every write. The refusal is logged.
- Owners and purchasers can propose. A viewer's token cannot.
Limits and errors
- 401: no token, a token Lockstock does not know, a revoked token, or the person who made it is no longer a member. The
WWW-Authenticateheader is set. - 403: the token is read only and tried to write, the person behind it may not use that tool, or a browser sent a cross-site Origin. Calls from a server send no Origin and are fine.
- 413: a request body over 100 KB.
- Production and warehouse roles never receive costs or prices in any answer.
- Every call, including refused ones, is written to the activity log as an MCP client or API call.
Related guides
- The assistant and its limitsIt answers from your live records and shows its math. It cannot change anything. Anything it suggests waits for you.
- Teams and rolesInvite people, give each one of four roles, set two dollar limits per role, and keep one rule: nobody approves their own work except the owner.
- FAQShort answers about price, leaving, moving in, the assistant and what the demo is.