plm-upload-mcp 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +134 -103
  2. package/index.mjs +771 -496
  3. package/package.json +22 -22
package/README.md CHANGED
@@ -1,103 +1,134 @@
1
- # plm-upload-mcp
2
-
3
- An MCP server for the **LionsBot PLM**. It **reads** the PLM — SKU folders, full
4
- component metadata, extracted drawing/BOM metadata, and product & staging BOMs — and
5
- **bulk-uploads** local files (SolidWorks STEP/PDF exports) into it, matched to a
6
- component by SKU. It runs on **your own machine**, so it reads your exported files
7
- straight off disk, and it signs in as **you** with your PLM/hub login — every read is
8
- row-level-security scoped to you, and every uploaded file is tagged with who uploaded it.
9
-
10
- Pair it with your SolidWorks MCP: that MCP knows each part's SKU and exports the files;
11
- this MCP takes `{path, sku}` pairs and pushes them into the PLM.
12
-
13
- ## Setup
14
-
15
- Add one entry to your Claude MCP config (Claude Desktop: `claude_desktop_config.json`;
16
- Claude Code: `.mcp.json` or `claude mcp add`). Use **your own** PLM email + password:
17
-
18
- ```json
19
- {
20
- "mcpServers": {
21
- "plm-upload": {
22
- "command": "npx",
23
- "args": ["-y", "plm-upload-mcp"],
24
- "env": {
25
- "PLM_EMAIL": "you@lionsbot.com",
26
- "PLM_PASSWORD": "your-plm-password"
27
- }
28
- }
29
- }
30
- }
31
- ```
32
-
33
- That's all. `npx -y` fetches and runs the latest version; no clone, no build.
34
-
35
- > Your login is the same one you use for the Hardware Tools hub / PLM. Uploads are
36
- > attributed to you and require a `@lionsbot.com` account.
37
-
38
- ## Tools
39
-
40
- ### `upload_files`
41
- Uploads one or more files, each paired with its target SKU.
42
-
43
- - `files`: array of `{ path, sku, skuName?, category? }`
44
- - `path` — absolute local path to the file
45
- - `sku` — component SKU, e.g. `MNT-1234-A0`
46
- - `skuName` — optional; only used if the SKU's Drive folder has to be created
47
- - `category` — optional PLM tag: `Default` | `Archive` | `Compliance` | `Ops`
48
- - `bucket`: `main` (default, confirmed components) or `staging` (unconfirmed)
49
-
50
- Each file lands in PLM storage and is mirrored into that SKU's Google Drive folder
51
- (created automatically if it doesn't exist). Re-uploading a file with the **same name
52
- replaces it in place** — no duplicate pile-up on re-runs.
53
-
54
- Example ask: *"Upload C:\exports\bracket.step to SKU MNT-1234-A0 and C:\exports\bracket.pdf to the same SKU."*
55
-
56
- ### `list_component_files`
57
- Lists the files currently in a component's Drive folder.
58
-
59
- - `sku`: component SKU
60
- - `bucket`: `main` (default) or `staging`
61
-
62
- ## Read-only tools
63
-
64
- All read tools query the PLM as **you** (RLS-scoped) — you only ever see what you're
65
- allowed to see. `bucket` / `classification` values are `main` (confirmed), `staging`
66
- (unconfirmed), or `all` (default).
67
-
68
- ### `list_sku_folders`
69
- Every component SKU with its Google Drive folder — the SKU→folder map (SKU, name,
70
- category, type, revision, status, staging flag, folder id/URL). Filters: `bucket`,
71
- `category`, `with_folder_only`, `limit`, `offset`.
72
-
73
- ### `get_component_metadata`
74
- Full component metadata (every column, incl. cost/supply, drawing-extracted fields,
75
- CAD provenance, compliance, and the `extract_meta` block). Pass a single `sku` for one
76
- part, or omit it to page through all. Filters: `search`, `bucket`, `category`,
77
- `status`, `limit`, `offset`.
78
-
79
- ### `list_bom_extract_metadata`
80
- The metadata machine-extracted from each part's drawing/BOM PDF (`extract_meta`): the
81
- Lionsbot-custom flag, SKU/drawing match check, per-field extracted values, and source
82
- file + who/when. Only extracted parts are returned. Filters: `sku`, `bucket`, `limit`,
83
- `offset`.
84
-
85
- ### `list_boms`
86
- BOMs across all products, each product carrying its BOM(s) + line items and a derived
87
- `staging` flag (a product is *staging* while its working BOM still contains any staging
88
- component). Working BOMs only by default. Filters: `product_sku`, `classification`,
89
- `include_snapshots`, `include_rows`, `max_rows_per_bom`.
90
-
91
- ## Config overrides (rarely needed)
92
-
93
- Baked to production defaults; override via env only if the PLM backend moves:
94
-
95
- | env | default |
96
- |---|---|
97
- | `PLM_GATEWAY` | `https://gateway-production-c13d.up.railway.app` |
98
- | `PLM_ANON_KEY` | (prod anon key) |
99
- | `PLM_EDGE_URL` | `https://plm-edge-production.up.railway.app` |
100
-
101
- ## Requirements
102
-
103
- Node.js 18+ (for built-in `fetch`).
1
+ # plm-upload-mcp
2
+
3
+ An MCP server for the **LionsBot PLM**. It **reads** the PLM — SKU folders, full
4
+ component metadata, extracted drawing/BOM metadata, and product & staging BOMs — and
5
+ **bulk-uploads** local files (SolidWorks STEP/PDF exports) into it, matched to a
6
+ component by SKU, makes components' Drive folders and **uprevs** staging prototypes. It runs on **your own machine**, so it reads your exported files
7
+ straight off disk, and it signs in as **you** with your PLM/hub login — every read is
8
+ row-level-security scoped to you, and every uploaded file is tagged with who uploaded it.
9
+
10
+ Pair it with your SolidWorks MCP: that MCP knows each part's SKU and exports the files;
11
+ this MCP takes `{path, sku}` pairs and pushes them into the PLM.
12
+
13
+ ## Setup
14
+
15
+ Add one entry to your Claude MCP config (Claude Desktop: `claude_desktop_config.json`;
16
+ Claude Code: `.mcp.json` or `claude mcp add`). Use **your own** PLM email + password:
17
+
18
+ ```json
19
+ {
20
+ "mcpServers": {
21
+ "plm-upload": {
22
+ "command": "npx",
23
+ "args": ["-y", "plm-upload-mcp@latest"],
24
+ "env": {
25
+ "PLM_EMAIL": "you@lionsbot.com",
26
+ "PLM_PASSWORD": "your-plm-password"
27
+ }
28
+ }
29
+ }
30
+ }
31
+ ```
32
+
33
+ That's all. `npx -y plm-upload-mcp@latest` fetches and runs the latest version on every start; no clone, no build.
34
+
35
+ > Your login is the same one you use for the Hardware Tools hub / PLM. Uploads are
36
+ > attributed to you and require a `@lionsbot.com` account.
37
+
38
+ ## Tools
39
+
40
+ ### `upload_files`
41
+ Uploads one or more files, each paired with its target SKU.
42
+
43
+ - `files`: array of `{ path, sku, category? }`
44
+ - `path` — absolute local path to the file
45
+ - `sku` — component SKU, e.g. `MNT-1234-A0`; it must already exist in the PLM
46
+ - `category` — optional PLM tag: `Default` | `Archive` | `Compliance` | `Ops`
47
+
48
+ Each file lands in PLM storage and is mirrored into that SKU's Google Drive folder on
49
+ the part's own drive (staging or main, from the component; created automatically if it
50
+ doesn't exist). A SKU that isn't in the PLM is refused, so a typo never leaves a stray
51
+ folder. Re-uploading a file with the **same name replaces it in place** — no duplicate
52
+ pile-up on re-runs.
53
+
54
+ A **PDF is then read** like an upload in the PLM's Files tab: a LionsBot drawing of that
55
+ SKU fills the part's title-block fields (material, colour, drawing REV, manufacturing
56
+ method). An injection moulded X revision then shows in **Injection Mold Staging**.
57
+ Another company's PDF, or a drawing of another SKU, is uploaded but not read.
58
+
59
+ Example ask: *"Upload C:\exports\bracket.step to SKU MNT-1234-A0 and C:\exports\bracket.pdf to the same SKU."*
60
+
61
+ ### `create_folder`
62
+ Finds or creates the `[SKU] Name` Drive folder of components already in the PLM, on each
63
+ part's own drive, and links it to the component. Unknown SKUs are refused. Only needed
64
+ for an empty folder: an upload makes the folder too.
65
+
66
+ - `skus`: array of component SKUs
67
+
68
+ ### `uprev_component`
69
+ Uprevs a staging prototype to its next X revision (`MNT-1234-X1` → `MNT-1234-X2`), the
70
+ same as **Uprev** in the PLM: a new component carrying the old one's details, with its
71
+ own staging Drive folder; the old revision stays as history.
72
+
73
+ - `sku`: the current staging SKU (X0–X8; releasing to A0 is a promotion request in the PLM)
74
+ - `drawing_pdf`: optional path to the new revision's drawing PDF
75
+ - `step`: optional path to the new revision's STEP model
76
+ - `proceed_despite_warnings`: optional, see below
77
+
78
+ The files are uploaded to the new revision, renamed to carry its SKU (an older revision's
79
+ SKU in the name is swapped, else `[SKU] ` is put in front), and the drawing is read into
80
+ the PLM. **The PDF is checked before anything is created**: if its title block shows no
81
+ SKU/REV change, no SKU or REV, or another part, nothing is uprevved and the warnings come
82
+ back. Claude shows them to you; say go ahead and it calls again with
83
+ `proceed_despite_warnings: true`. The warnings are kept in the part's history.
84
+
85
+ Example ask: *"Uprev MNT-1234-X1 with C:\exports\bracket.pdf and C:\exports\bracket.step."*
86
+
87
+ ### `list_component_files`
88
+ Lists the files currently in a component's Drive folder.
89
+
90
+ - `sku`: component SKU
91
+ - `bucket`: `main` (default) or `staging`
92
+
93
+ ## Read-only tools
94
+
95
+ All read tools query the PLM as **you** (RLS-scoped) — you only ever see what you're
96
+ allowed to see. `bucket` / `classification` values are `main` (confirmed), `staging`
97
+ (unconfirmed), or `all` (default).
98
+
99
+ ### `list_sku_folders`
100
+ Every component SKU with its Google Drive folder — the SKU→folder map (SKU, name,
101
+ category, type, revision, status, staging flag, folder id/URL). Filters: `bucket`,
102
+ `category`, `with_folder_only`, `limit`, `offset`.
103
+
104
+ ### `get_component_metadata`
105
+ Full component metadata (every column, incl. cost/supply, drawing-extracted fields,
106
+ CAD provenance, compliance, and the `extract_meta` block). Pass a single `sku` for one
107
+ part, or omit it to page through all. Filters: `search`, `bucket`, `category`,
108
+ `status`, `limit`, `offset`.
109
+
110
+ ### `list_bom_extract_metadata`
111
+ The metadata machine-extracted from each part's drawing/BOM PDF (`extract_meta`): the
112
+ Lionsbot-custom flag, SKU/drawing match check, per-field extracted values, and source
113
+ file + who/when. Only extracted parts are returned. Filters: `sku`, `bucket`, `limit`,
114
+ `offset`.
115
+
116
+ ### `list_boms`
117
+ BOMs across all products, each product carrying its BOM(s) + line items and a derived
118
+ `staging` flag (a product is *staging* while its working BOM still contains any staging
119
+ component). Working BOMs only by default. Filters: `product_sku`, `classification`,
120
+ `include_snapshots`, `include_rows`, `max_rows_per_bom`.
121
+
122
+ ## Config overrides (rarely needed)
123
+
124
+ Baked to production defaults; override via env only if the PLM backend moves:
125
+
126
+ | env | default |
127
+ |---|---|
128
+ | `PLM_GATEWAY` | `https://gateway-production-c13d.up.railway.app` |
129
+ | `PLM_ANON_KEY` | (prod anon key) |
130
+ | `PLM_EDGE_URL` | `https://plm-edge-production.up.railway.app` |
131
+
132
+ ## Requirements
133
+
134
+ Node.js 18+ (for built-in `fetch`).