plm-upload-mcp 1.3.1 → 1.3.3

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 -134
  2. package/index.mjs +5 -5
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,134 +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, 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 still
81
- shows the old SKU, 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`).
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: `Compliance` | `Datasheets` | `Software` | `Drawings` | `3D files` (left out = the PLM guesses from the file name)
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 still
81
+ shows the old SKU, 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`).
package/index.mjs CHANGED
@@ -226,7 +226,7 @@ async function uploadOne({ path, sku, skuName, category, bucket, filename = base
226
226
  })
227
227
  if (synced?.error) throw new Error(synced.error)
228
228
 
229
- if (category && category !== 'Default' && synced?.driveFileId) {
229
+ if (category && synced?.driveFileId) {
230
230
  await edgeJson({ action: 'set-category', fileId: synced.driveFileId, category }).catch(() => {})
231
231
  }
232
232
 
@@ -237,7 +237,7 @@ async function uploadOne({ path, sku, skuName, category, bucket, filename = base
237
237
  driveFileId: synced.driveFileId,
238
238
  driveWebViewLink: synced.driveWebViewLink,
239
239
  replaced: !!synced.replaced,
240
- category: category && category !== 'Default' ? category : undefined,
240
+ category: category || undefined,
241
241
  }
242
242
  }
243
243
 
@@ -276,7 +276,7 @@ const readLine = (read) => (read ? ` · ${read.text}${read.listed ? ' · now in
276
276
  const issueLine = (issue) => (issue ? `\n ⚠ ${issue} Tell the user.` : '')
277
277
 
278
278
  // --- Server ------------------------------------------------------------------
279
- const server = new McpServer({ name: 'plm-upload', version: '1.3.1' })
279
+ const server = new McpServer({ name: 'plm-upload', version: '1.3.2' })
280
280
 
281
281
  server.registerTool(
282
282
  'upload_files',
@@ -301,9 +301,9 @@ server.registerTool(
301
301
  path: z.string().describe('Absolute local path to the file to upload.'),
302
302
  sku: z.string().describe('Component SKU this file belongs to, e.g. MNT-1234-A0.'),
303
303
  category: z
304
- .enum(['Default', 'Archive', 'Compliance', 'Ops'])
304
+ .enum(['Compliance', 'Datasheets', 'Software', 'Drawings', '3D files'])
305
305
  .optional()
306
- .describe('PLM file category tag. Defaults to Default.'),
306
+ .describe('PLM file category. Leave it out and the PLM guesses one from the file name.'),
307
307
  }),
308
308
  )
309
309
  .min(1)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plm-upload-mcp",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "MCP server to read the LionsBot PLM (SKU folders, component metadata, extracted drawing metadata, product & staging BOMs) bulk-upload SolidWorks exports (STEP/PDF) into it by SKU, create components' Drive folders and uprev staging prototypes.",
5
5
  "license": "UNLICENSED",
6
6
  "keywords": ["mcp", "modelcontextprotocol", "lionsbot", "plm", "solidworks"],