Tutorial: Natural Language Inventory Management with Claude Code and Flash Warehouse MCP
A hands-on tutorial showing how to configure the Flash Warehouse MCP Server and use Claude Code to perform daily warehouse operations -- querying inventory, checking alerts, creating purchase orders, and approving bills -- all through natural language conversations.
Why Manage a Warehouse with Natural Language
Traditional WMS operations require jumping between multiple screens: check inventory on one page, view alerts on another, create a purchase order on a third. Each step involves filling forms, selecting dropdowns, and clicking buttons.
Flash Warehouse provides an MCP (Model Context Protocol) Server that gives AI coding assistants direct access to the full WMS feature set. Combined with Claude Code, you can accomplish in a single sentence what would otherwise take a dozen clicks.
This article is a complete hands-on tutorial, from configuration to completing a real restocking workflow.
Step 1: Install and Log In with fwh
fwh is the Flash Warehouse CLI tool and MCP Server -- a single static binary with no runtime dependencies.
Build from source (requires Go 1.22+):
cd flash_warehouse_cli
go build -o ./bin/fwh ./cmd/fwh
ln -sf $(pwd)/bin/fwh ~/.local/bin/fwh
Log in to your Flash Warehouse account:
fwh login --user 13800138000
# Password: ********
# logged in as 13800138000 (user_id=1)
Important: The MCP Server requires an active terminal login first. This is by design -- login credentials never appear in AI conversation history.
Step 2: Configure mcp.json for Claude Code
Add the Flash Warehouse MCP Server to ~/.claude/mcp.json:
{
"mcpServers": {
"flash-warehouse": {
"command": "/absolute/path/to/fwh",
"args": ["mcp", "--enable-writes"]
}
}
}
For read-only access, remove --enable-writes. Without it, the MCP Server registers only 44 read-only tools. With it, the count expands to 106 tools covering all write operations.
Every write tool description starts with WARNING:, ensuring Claude Code prompts for confirmation before executing destructive actions.
Step 3: Real Workflow -- From Checking Stock to Completing a Purchase
The following demonstrates a realistic workflow using natural language for daily warehouse management.
Conversation 1: View Warehouse and Inventory Overview
You: Show me what is in the warehouse and the total inventory value.
Claude Code calls warehouse_list to get warehouse information, goods_list to query products, and bi_total_value to fetch the total inventory value. You will see output like:
You have 1 warehouse (Xigu District Factory Warehouse, ID: 2) with 47 product types. Total inventory value is 128,450 CNY. Top three by quantity: Coca-Cola 330ml cans (500 units), Dongpeng Energy Drink (300 units), Master Kong Instant Noodles (200 units).
Conversation 2: Check Stock Alerts
You: Are any products running low?
Claude Code calls alert_overview:
Three products have triggered stock alerts:
- Coca-Cola 330ml cans (6954767410388): current stock 45, threshold 50
- Nongfu Spring 550ml: current stock 20, threshold 30
- Pepsi 600ml: current stock 15, threshold 25
I recommend restocking soon. Want me to create a purchase order?
Conversation 3: Create a Purchase Input Bill
You: Restock 500 units each for Coca-Cola and Nongfu Spring. Create a purchase input bill.
Claude Code calls purchase_input_create with the goods list:
Created purchase input bill PUR-20260604-001 containing:
- Coca-Cola 330ml cans x 500, unit price 2.5 CNY
- Nongfu Spring 550ml x 500, unit price 1.8 CNY
- Total: 2,150 CNY
The bill status is "pending review." Would you like me to approve it now?
Conversation 4: Approve the Bill
You: Approve it.
Claude Code calls bill_audit with the bill ID. Since this is an irreversible operation, Claude Code prompts for confirmation first:
Warning: Approving this bill will commit inventory changes. This action cannot be undone. Confirm approval for bill PUR-20260604-001?
After confirmation:
Bill PUR-20260604-001 has been approved. Inventory updated:
- Coca-Cola 330ml cans: 45 -> 545
- Nongfu Spring 550ml: 20 -> 520
Conversation 5: Verify the Result
You: Check the alert status again.
Claude Code calls alert_overview once more:
Only 1 product remains in alert state: Pepsi 600ml (stock 15, threshold 25). Coca-Cola and Nongfu Spring have cleared their alerts.
Security Model
The Flash Warehouse MCP Server is built on three core safety principles.
Login-first. The MCP Server checks for a local session file at startup and refuses to start without one. The AI cannot perform login through tool calls, so passwords never appear in conversation history.
Tenant-locked. The binding_user_id is written once at login time into an unexported Go struct field. No CLI flag, environment variable, or MCP tool argument can override it. Automated tests verify this invariant on every build.
Writes are opt-in. Without --enable-writes, write tools are not registered in the MCP Server at all -- the tool symbols do not exist, so the AI literally cannot call them. When enabled, every write tool description begins with WARNING: to trigger the AI's safety reasoning.
More Operations You Can Express in Natural Language
Beyond the purchase workflow demonstrated above, you can say things like:
- "Show me today's sales revenue and order count" -- calls
bi_today_sales_revenue - "Create a stocktake task for the Xigu warehouse" -- calls
check_task_create - "Set a stock alert for Coca-Cola: notify me when stock drops below 100" -- calls
alert_set_config - "Convert this sales quotation to a sales order" -- calls
convert_quotation_to_order - "How much do we owe our suppliers?" -- calls
bi_should_pay - "Sell two bottles of Coke using barcode 6954767410388" -- calls
pos_sell
The Flash Warehouse MCP Server provides 44 read-only tools and 62 write tools, covering the full feature set of the PC management frontend. The complete tool inventory and operation manual are available in the fwh project's MANUAL.md documentation.