MCP integration¶
NextIntranet exposes a warehouse MCP server at /mcp so AI agents (Claude Code,
Claude Desktop, Cursor, etc.) can query and modify warehouse data.
Generate token¶
Use the intranet UI to create a token and configuration JSON in one step:
- Go to Settings → Software (
/settings/software). - In Generate MCP config, enter a token name.
- Optionally customize the MCP server name (default
nextintranet-warehouse). - Choose Read-only or Read & Write (write requires warehouse write permission).
- Click Generate config and copy the JSON into your MCP client.
The generated JSON looks like:
{
"mcpServers": {
"nextintranet-warehouse": {
"type": "http",
"url": "https://your-instance/mcp",
"headers": {
"X-Service-Token": "<generated-token>"
}
}
}
}
Claude Code setup¶
The fastest way is the CLI — run this once in a terminal:
claude mcp add --transport http nextintranet-warehouse https://your-instance/mcp \
--header "X-Service-Token: <generated-token>"
Replace https://your-instance with your NextIntranet URL and <generated-token> with the token you copied in step 5 above.
Verify it was added:
claude mcp list
You should see nextintranet-warehouse in the list. The next time you open Claude Code, the warehouse tools are available automatically.
Alternative — edit the config file manually:
Open ~/.claude/claude_code_config.json and add the server under "mcpServers":
{
"mcpServers": {
"nextintranet-warehouse": {
"type": "http",
"url": "https://your-instance/mcp",
"headers": {
"X-Service-Token": "<generated-token>"
}
}
}
}
Create the file if it does not exist yet.
Project-scoped config: To restrict the MCP server to a specific project instead of all Claude Code sessions, pass --scope project to claude mcp add. This writes the server into .mcp.json in the current directory instead of your global config.
Other clients¶
- Claude Desktop:
~/.claude/claude_desktop_config.jsonunder"mcpServers" - Cursor: Settings → MCP Servers
Make sure the server entry includes "type": "http" (as in the examples above).
Some clients — e.g. Claude Desktop on macOS with more than one MCP server
configured — fail to recognize the NextIntranet server as a remote HTTP server
without this key.
Available tools¶
Read-only (mcp:read scope)¶
search_components— search by name, description, category, tag, locationget_component_detail— full component detail with parameters, documents, packets, suppliersget_inventory_summary— stock overview (limitdefault 200, max 500)list_categories— categories (include_nesteddefault true,limitdefault 500, max 2000)get_category— single category (include_nesteddefault true: subcategory tree)list_locations— locations (include_nesteddefault true,limitdefault 500, max 2000)get_location— single location (include_nesteddefault true; by id or legacy uuid)list_parameter_types— parameter types (limitdefault 500, max 2000)list_suppliers— supplier listget_supplier— single supplierlist_component_suppliers— supplier links for a component (limitdefault 50, max 200)list_reservations— reservation list (filter by component or search)get_reservation— single reservationget_packet— single packet (stock batch)list_component_packets— packets for a component (limitdefault 100, max 500)list_document_types— allowed document type keys and labels (use keys indoc_type)list_component_documents— documents for a componentget_component_document— single document by IDlist_print_queues— print queues available to the token (limitdefault 50, max 200)list_print_queue_items— items in a queue (print_list_idoptional; uses default queue)list_purchase_requests/get_purchase_request— purchase requests (filter byassigned, component, purchase)list_purchases/get_purchase— supplier orders, with items, deliveries and attached requestsget_purchase_export_csv— supplier import CSV (Mouser style) for a purchase
Production BOM tools (nextintranet_production) are registered on the same server:
list_boms, get_bom, get_bom_availability, list_productions, get_production (read) and
update_bom, set_bom_line_component, lock_bom, finalize_bom (write).
Write (mcp:write scope, includes all read tools)¶
update_component_description— update a component's description (alias for description-only updates)update_component— update name, description, category, tags, selling/internal pricesset_component_parameters— set/update component parameterscreate_component— create a new component (do not put URLs in description; use documents instead)create_component_document— attach a URL document (is_primaryfor image thumbnails; image URLs must be direct file links)update_component_document— update name, URL, type, oris_primaryset_component_primary_document— set an existing image as primarydelete_component_document— remove document from componentcreate_packet/update_packet/add_packet_stock_operation— packets and stock quantity changescreate_parameter_type/update_parameter_type/delete_parameter_type— parameter typescreate_category/update_category/delete_category— categoriescreate_location/update_location/delete_location— warehouse locationscreate_supplier/update_supplier/delete_supplier— supplierslink_component_supplier/update_supplier_relation/delete_supplier_relation— component–supplier linkscreate_reservation/update_reservation/delete_reservation— reservationscreate_print_queue— create a queue owned by the token's useradd_to_print_queue— add a component, packet, or location label to a queueadd_targets_to_print_queue— add multiple labels in one callremove_print_queue_item— remove an item from a queuecreate_purchase_request/update_purchase_request/delete_purchase_request— purchase requestsassign_purchase_requests— attach requests to a purchasecreate_purchase/set_purchase_items/set_purchase_item_location— build the ordertransition_purchase— move the order through its lifecyclereceive_purchase_items/stock_purchase_deliveries/complete_purchase— receiving and stocking
Purchases¶
The whole ordering flow is available over MCP, in this order:
create_purchase_request— file wishes as they come up.create_purchasefor a supplier, thenassign_purchase_requeststo cover the open wishes.set_purchase_items— add lines (component_idorsupplier_relation_id,quantity,unit_price_original, andstock_location_id). The stock location is assignable while the order is still being built;set_purchase_item_locationchanges a single line.transition_purchasethroughitems_defined→priced→closed→exported. Exporting creates a draft packet (stateexpected) for every component line at its stock location, so labels can be printed before the goods arrive. Every component line therefore needs a stock location before export, otherwise the transition is rejected.receive_purchase_items— record what arrived. Partial deliveries are supported; call it repeatedly until the line is complete. Setqueue_labelsto enqueue packet labels.stock_purchase_deliveries— book the goods into stock. The expected packets flip tostocked, and the purchase completes automatically once everything is delivered and stocked. Usecomplete_purchasefor the receiving → completed shortcut when nothing needs stocking.
Expected packets carry no stock (count 0) and derive is_active=false, so they never show up
in inventory totals or location searches until they are stocked.
Print queue¶
MCP can enqueue labels for components, packets (stock batches), and warehouse locations — the same targets as the intranet “Add to queue” actions.
target_type:component,packet, orlocationtarget_id: UUID of the target (locationalso accepts the legacy locationuuidfield)print_list_id: optional; omit to use the token owner’s default queuekind:label(default) ordocument
Tokens created in Settings → Software → Generate MCP config use the creating user’s queues (including public queues). Service tokens with allowed_print_lists configured are limited to those queues (same as print render).
create_print_queue makes a new queue owned by the token’s user (so the token must be linked to
one). When the token is restricted via allowed_print_lists, the new queue is added to that list
so the token can immediately use it.
Component documents¶
Use create_component_document (or update_component_document) to attach links to a component.
Do not put URLs in the component description field.
doc_type |
Typical url |
|---|---|
product_page, datasheet, manual, … |
Link to a web page (HTML) |
image |
Direct link to the image file (e.g. https://cdn.example.com/part.jpg) |
For doc_type image (including primary / thumbnail via is_primary):
- The
urlmust point at the image file itself (.jpg,.png,.webp, etc.), not at an HTML product page or gallery. - Wrong: product detail page where the image is embedded in HTML.
- Right: CDN or supplier URL that returns
Content-Type: image/*when opened.
The first image document on a component is set as primary automatically; use is_primary=true or set_component_primary_document for later images.
Architecture¶
- Backend:
django-mcp-serverlibrary, toolsets innextintranet_warehouse/mcp_tools.py - Auth: ServiceToken with
mcp:read/mcp:writescopes viaX-Service-Tokenheader (or theX-Application-Keyalias) - Nginx proxies
/mcpto the Django container with SSE buffering disabled
See also Service tokens for token mechanics shared with printers and other integrations.