plm-upload-mcp 1.5.1 → 1.6.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.
- package/README.md +15 -0
- package/index.mjs +61 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,6 +65,21 @@ for an empty folder: an upload makes the folder too.
|
|
|
65
65
|
|
|
66
66
|
- `skus`: array of component SKUs
|
|
67
67
|
|
|
68
|
+
### `create_drive_folder` (Lucas and Benjamin only)
|
|
69
|
+
Creates a folder path anywhere in the PLM Shared Drive, like `mkdir -p`. A new folder at
|
|
70
|
+
the drive root may not hold `[` (it would be read as a part). The PLM refuses everyone but Lucas and Benjamin.
|
|
71
|
+
|
|
72
|
+
- `path`: folder path from the drive root, e.g. `Templates/Drawing`
|
|
73
|
+
- `drive`: `main` (default) or `staging`
|
|
74
|
+
|
|
75
|
+
### `create_component` (Lucas and Benjamin only)
|
|
76
|
+
Creates a component the same as the PLM's New component form, plus its `[SKU] Name` Drive
|
|
77
|
+
folder. Without `sku` it takes the next number (staging: a T number). The PLM refuses everyone but Lucas and Benjamin.
|
|
78
|
+
|
|
79
|
+
- `name`, `category` (3 letters), `sku_type` (`component` / `assembly` / `consumable` / `other`)
|
|
80
|
+
- `staging`: default `true`
|
|
81
|
+
- `sku`: optional, the SKU to use instead of the next number (required for `other`)
|
|
82
|
+
|
|
68
83
|
### `uprev_component`
|
|
69
84
|
Uprevs a staging prototype to its next X revision (`MNT-1234-X1` → `MNT-1234-X2`), the
|
|
70
85
|
same as **Uprev** in the PLM: a new component carrying the old one's details, with its
|
package/index.mjs
CHANGED
|
@@ -291,7 +291,7 @@ const readLine = (read) => (read ? ` · ${read.text}${read.listed ? ' · now in
|
|
|
291
291
|
const issueLine = (issue) => (issue ? `\n ⚠ ${issue} Tell the user.` : '')
|
|
292
292
|
|
|
293
293
|
// --- Server ------------------------------------------------------------------
|
|
294
|
-
const server = new McpServer({ name: 'plm-upload', version: '1.
|
|
294
|
+
const server = new McpServer({ name: 'plm-upload', version: '1.6.0' })
|
|
295
295
|
|
|
296
296
|
server.registerTool(
|
|
297
297
|
'upload_files',
|
|
@@ -423,6 +423,66 @@ server.registerTool(
|
|
|
423
423
|
},
|
|
424
424
|
)
|
|
425
425
|
|
|
426
|
+
// Lucas and Benjamin only: the PLM edge refuses everyone else (access.ts mayDriveAnywhere).
|
|
427
|
+
const refusedReply = (e) => ({ content: [{ type: 'text', text: e instanceof Error ? e.message : String(e) }], isError: true })
|
|
428
|
+
|
|
429
|
+
server.registerTool(
|
|
430
|
+
'create_drive_folder',
|
|
431
|
+
{
|
|
432
|
+
title: 'Create a folder anywhere in the PLM Drive (Lucas and Benjamin only)',
|
|
433
|
+
description:
|
|
434
|
+
'Creates a folder path anywhere in the PLM Google Shared Drive, like mkdir -p: each missing folder of ' +
|
|
435
|
+
'`path` (from the drive root) is made, existing ones are reused. A new folder at the drive root may not ' +
|
|
436
|
+
'hold "[" (it would be read as a part): use create_component for a part. Only Lucas and Benjamin may call it; the PLM ' +
|
|
437
|
+
'refuses everyone else.',
|
|
438
|
+
inputSchema: {
|
|
439
|
+
path: z.string().min(1).describe('Folder path from the drive root, e.g. "Templates/Drawing".'),
|
|
440
|
+
drive: z.enum(['main', 'staging']).default('main').describe('The main drive or the staging drive.'),
|
|
441
|
+
},
|
|
442
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
443
|
+
},
|
|
444
|
+
async ({ path, drive }) => {
|
|
445
|
+
try {
|
|
446
|
+
const r = await edgeJson({ action: 'create-drive-folder', path, bucket: drive })
|
|
447
|
+
const made = r.created?.length ? `created ${r.created.join(' / ')}` : 'already there'
|
|
448
|
+
return { content: [{ type: 'text', text: `✓ ${path} (${drive}): ${made} ${r.folderUrl}` }], structuredContent: { drive, ...r } }
|
|
449
|
+
} catch (e) {
|
|
450
|
+
return refusedReply(e)
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
)
|
|
454
|
+
|
|
455
|
+
server.registerTool(
|
|
456
|
+
'create_component',
|
|
457
|
+
{
|
|
458
|
+
title: 'Create a PLM component and its Drive folder (Lucas and Benjamin only)',
|
|
459
|
+
description:
|
|
460
|
+
'Creates a component in the PLM, the same as its New component form, and its `[SKU] Name` Drive ' +
|
|
461
|
+
'folder. Leave `sku` out to take the next number: a staging part gets a T number (MNT-T000123), a main ' +
|
|
462
|
+
'component CAT-####-A0, an assembly CAT-#####-01, a consumable CAT-####. Only Lucas and Benjamin may call it; the PLM ' +
|
|
463
|
+
'refuses everyone else.',
|
|
464
|
+
inputSchema: {
|
|
465
|
+
name: z.string().min(1).describe('Part name.'),
|
|
466
|
+
category: z.string().regex(/^[A-Za-z]{3}$/).describe('Three-letter category code, e.g. MNT.'),
|
|
467
|
+
sku_type: z.enum(['component', 'assembly', 'consumable', 'other']).describe('SKU type.'),
|
|
468
|
+
staging: z.boolean().default(true).describe('true = a staging (draft) part on the staging drive.'),
|
|
469
|
+
sku: z.string().optional().describe('The SKU to use instead of the next number (required for type other).'),
|
|
470
|
+
},
|
|
471
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
472
|
+
},
|
|
473
|
+
async ({ name, category, sku_type, staging, sku }) => {
|
|
474
|
+
const row = { name: name.trim(), category: category.toUpperCase(), sku_type, staging, ...(sku ? { sku: sku.trim().toUpperCase() } : {}) }
|
|
475
|
+
try {
|
|
476
|
+
const r = await edgeJson({ action: 'create-component', row, mint: !sku })
|
|
477
|
+
const c = r.component
|
|
478
|
+
const folder = r.folder?.folderUrl ? `folder ${r.folder.folderUrl}` : `no folder: ${r.folder?.error ?? 'Drive not connected'}`
|
|
479
|
+
return { content: [{ type: 'text', text: `✓ ${c.sku} ${c.name} (${c.staging ? 'staging' : 'main'}), ${folder}` }], structuredContent: r }
|
|
480
|
+
} catch (e) {
|
|
481
|
+
return refusedReply(e)
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
)
|
|
485
|
+
|
|
426
486
|
server.registerTool(
|
|
427
487
|
'uprev_component',
|
|
428
488
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plm-upload-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
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"],
|