@habitusnet/bc365 2.1.0 → 2.2.1
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/lib/onboard.js +9 -4
- package/package.json +1 -1
- package/skills/bc-query/SKILL.md +9 -0
package/lib/onboard.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { execFile as _execFile } from 'node:child_process';
|
|
2
|
+
import { promisify } from 'node:util';
|
|
2
3
|
import inquirer from 'inquirer';
|
|
3
4
|
import { getToken } from './auth.js';
|
|
4
5
|
import { getEnvironments, getCompanies, getPermissions } from './discovery.js';
|
|
5
6
|
import { saveProfile } from './profiles.js';
|
|
6
7
|
|
|
8
|
+
const execFile = promisify(_execFile);
|
|
7
9
|
const BC_API_BASE = 'https://api.businesscentral.dynamics.com/v2.0';
|
|
8
10
|
|
|
9
11
|
export function buildMcpConfig(ctx) {
|
|
@@ -30,7 +32,7 @@ export function buildMcpConfig(ctx) {
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
export async function onboard(options = {}) {
|
|
33
|
-
const { tenantId,
|
|
35
|
+
const { tenantId, scope = 'local', profileName } = options;
|
|
34
36
|
const token = await getToken();
|
|
35
37
|
|
|
36
38
|
const environments = await getEnvironments(token, { tenantId, type: 'Production' });
|
|
@@ -65,8 +67,11 @@ export async function onboard(options = {}) {
|
|
|
65
67
|
|
|
66
68
|
const ctx = { tenantId: selectedEnv.aadTenantId, envName, companyId };
|
|
67
69
|
const config = buildMcpConfig(ctx);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
|
|
71
|
+
for (const [name, serverConfig] of Object.entries(config.mcpServers)) {
|
|
72
|
+
await execFile('claude', ['mcp', 'add-json', '-s', scope, name, JSON.stringify(serverConfig)]);
|
|
73
|
+
}
|
|
74
|
+
console.log(`✓ Registered MCP servers (scope: ${scope})`);
|
|
70
75
|
|
|
71
76
|
const name = profileName ?? `${selectedEnv.aadTenantId}/${envName}`;
|
|
72
77
|
await saveProfile(name, ctx);
|
package/package.json
CHANGED
package/skills/bc-query/SKILL.md
CHANGED
|
@@ -78,6 +78,15 @@ Always call `get_schema` first when the user asks about a field you haven't seen
|
|
|
78
78
|
mcp__bc-data__list_items(entity="generalLedgerEntries", filter="postingDate gt 2024-01-01", orderby="postingDate desc", top=200)
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
+
### Expand sub-resources (line items, dimensions)
|
|
82
|
+
BC order/invoice headers do not include lines by default. Use `expand` to include them:
|
|
83
|
+
```
|
|
84
|
+
mcp__bc-data__list_items(entity="salesOrders", filter="number eq 'SO-0001'", expand="salesOrderLines")
|
|
85
|
+
mcp__bc-data__list_items(entity="purchaseOrders", filter="number eq 'PO-0001'", expand="purchaseOrderLines")
|
|
86
|
+
mcp__bc-data__list_items(entity="salesInvoices", expand="salesInvoiceLines")
|
|
87
|
+
```
|
|
88
|
+
Without `expand`, line items are absent from the response — this is the most common reason users think the data is incomplete.
|
|
89
|
+
|
|
81
90
|
### Paginate large result sets
|
|
82
91
|
If the response contains `@odata.nextLink`, call `list_items` again with a `skip` offset:
|
|
83
92
|
```
|