sap-wm-mcp 0.3.5 → 0.3.7
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/index.js +5 -0
- package/package.json +1 -1
- package/tools/confirmTransferOrder.js +17 -6
- package/tools/confirmTransferOrderSU.js +8 -3
package/index.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
console.error('');
|
|
3
|
+
console.error('sap-wm-mcp is no longer publicly available.');
|
|
4
|
+
console.error('This package has been discontinued. Contact the author for access.');
|
|
5
|
+
console.error('');
|
|
6
|
+
process.exit(1);
|
|
2
7
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
8
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
9
|
import { z } from 'zod';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sap-wm-mcp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"description": "MCP server for SAP Classic Warehouse Management — connects AI agents to S/4HANA WM via a custom RAP OData V4 service. For systems where EWM is not active.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s4hPost } from '../lib/s4hClient.js';
|
|
1
|
+
import { s4hPost, s4hGet } from '../lib/s4hClient.js';
|
|
2
2
|
|
|
3
3
|
const BASE = `/sap/opu/odata4/iwbep/all/srvd/sap/zsd_wmmcpservice/0001`;
|
|
4
4
|
const NS = `com.sap.gateway.srvd.zsd_wmmcpservice.v0001`;
|
|
@@ -7,12 +7,23 @@ export async function confirmTransferOrder({ warehouse, transferOrderNumber }) {
|
|
|
7
7
|
// Instance action — key goes in the URL path, not the body
|
|
8
8
|
const path = `${BASE}/WMTransferOrder(WarehouseNumber='${encodeURIComponent(warehouse)}',TransferOrderNumber='${encodeURIComponent(transferOrderNumber)}')/${NS}.ConfirmTransferOrder`;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
await s4hPost(path, {});
|
|
11
|
+
|
|
12
|
+
// SAP static action result never populates entity fields — read back the TO directly.
|
|
13
|
+
const tanum = transferOrderNumber.padStart(10, '0');
|
|
14
|
+
const readPath = `${BASE}/WMTransferOrder(WarehouseNumber='${encodeURIComponent(warehouse)}',TransferOrderNumber='${encodeURIComponent(tanum)}')`;
|
|
15
|
+
const to = await s4hGet(readPath);
|
|
11
16
|
|
|
12
17
|
return {
|
|
13
|
-
success:
|
|
14
|
-
warehouse,
|
|
15
|
-
transferOrderNumber,
|
|
16
|
-
|
|
18
|
+
success: true,
|
|
19
|
+
warehouse: to?.WarehouseNumber ?? warehouse,
|
|
20
|
+
transferOrderNumber: to?.TransferOrderNumber ?? transferOrderNumber,
|
|
21
|
+
isConfirmed: to?.IsConfirmed ?? null,
|
|
22
|
+
confirmedDate: to?.ConfirmedDate ?? null,
|
|
23
|
+
executedBy: to?.ExecutedBy ?? null,
|
|
24
|
+
movementType: to?.MovementType ?? null,
|
|
25
|
+
createdBy: to?.CreatedBy ?? null,
|
|
26
|
+
createdDate: to?.CreatedDate ?? null,
|
|
27
|
+
numberOfItems: to?.NumberOfItems ?? null,
|
|
17
28
|
};
|
|
18
29
|
}
|
|
@@ -13,11 +13,16 @@ export async function confirmTransferOrderSU({ warehouse, storageUnit }) {
|
|
|
13
13
|
|
|
14
14
|
const data = await s4hPost(path, body);
|
|
15
15
|
|
|
16
|
+
// Static action — SAP may return a collection or single entity
|
|
17
|
+
const entity = data?.value?.[0] ?? data;
|
|
18
|
+
|
|
16
19
|
return {
|
|
17
|
-
success:
|
|
20
|
+
success: true,
|
|
18
21
|
warehouse,
|
|
19
22
|
storageUnit,
|
|
20
|
-
transferOrderNumber:
|
|
21
|
-
|
|
23
|
+
transferOrderNumber: entity?.TransferOrderNumber ?? null,
|
|
24
|
+
isConfirmed: entity?.IsConfirmed ?? null,
|
|
25
|
+
confirmedDate: entity?.ConfirmedDate ?? null,
|
|
26
|
+
executedBy: entity?.ExecutedBy ?? null,
|
|
22
27
|
};
|
|
23
28
|
}
|