@assetlab/mcp-server 1.28.0 → 2.0.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/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/tools-write.js +26 -23
- package/dist/tools-write.js.map +1 -1
- package/dist/tools.d.ts +1 -1
- package/dist/tools.js +17 -16
- package/dist/tools.js.map +1 -1
- package/dist/version.d.ts +14 -0
- package/dist/version.js +15 -0
- package/dist/version.js.map +1 -0
- package/dist/worker.js +2 -1
- package/dist/worker.js.map +1 -1
- package/package.json +5 -2
package/dist/index.js
CHANGED
|
@@ -13,12 +13,13 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
|
13
13
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
14
14
|
import { AssetLabClient, loadConfig } from './client.js';
|
|
15
15
|
import { registerTools, SERVER_INSTRUCTIONS } from './tools.js';
|
|
16
|
+
import { VERSION } from './version.js';
|
|
16
17
|
async function main() {
|
|
17
18
|
const config = loadConfig();
|
|
18
19
|
const client = new AssetLabClient(config);
|
|
19
20
|
const server = new McpServer({
|
|
20
21
|
name: 'assetlab',
|
|
21
|
-
version:
|
|
22
|
+
version: VERSION,
|
|
22
23
|
}, {
|
|
23
24
|
instructions: SERVER_INSTRUCTIONS,
|
|
24
25
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,UAAU,EAAE,CAAA;IAC3B,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,CAAA;IAEzC,MAAM,MAAM,GAAG,IAAI,SAAS,CAC1B;QACE,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,OAAO;KACjB,EACD;QACE,YAAY,EAAE,mBAAmB;KAClC,CACF,CAAA;IAED,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAE7B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAA;IAC5C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;AACjC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;IACjB,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,CAAA;IAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
package/dist/tools-write.js
CHANGED
|
@@ -2315,9 +2315,10 @@ export function registerWriteTools(server, client) {
|
|
|
2315
2315
|
user_id: z.string().min(1).describe('User ID (required)'),
|
|
2316
2316
|
start_time: z.string().describe('Start time (ISO 8601 datetime, required)'),
|
|
2317
2317
|
end_time: z.string().optional().describe('End time (ISO 8601 datetime)'),
|
|
2318
|
-
|
|
2318
|
+
duration_minutes: z.number().min(0).optional().describe('Duration worked, in minutes'),
|
|
2319
2319
|
description: z.string().optional().describe('Description'),
|
|
2320
|
-
|
|
2320
|
+
user_name: z.string().max(200).optional().describe('Display name of the user'),
|
|
2321
|
+
is_billable: z.boolean().optional().describe('Whether the time is billable'),
|
|
2321
2322
|
}, async (params) => {
|
|
2322
2323
|
try {
|
|
2323
2324
|
const result = await client.create('project-time-entries', buildBody(params));
|
|
@@ -2334,9 +2335,10 @@ export function registerWriteTools(server, client) {
|
|
|
2334
2335
|
user_id: z.string().optional().describe('User ID'),
|
|
2335
2336
|
start_time: z.string().optional().describe('Start time (ISO 8601 datetime)'),
|
|
2336
2337
|
end_time: z.string().optional().describe('End time (ISO 8601 datetime)'),
|
|
2337
|
-
|
|
2338
|
+
duration_minutes: z.number().min(0).optional().describe('Duration worked, in minutes'),
|
|
2338
2339
|
description: z.string().optional().describe('Description'),
|
|
2339
|
-
|
|
2340
|
+
user_name: z.string().max(200).optional().describe('Display name of the user'),
|
|
2341
|
+
is_billable: z.boolean().optional().describe('Whether the time is billable'),
|
|
2340
2342
|
}, async ({ id, ...rest }) => {
|
|
2341
2343
|
try {
|
|
2342
2344
|
const result = await client.update('project-time-entries', id, buildBody(rest));
|
|
@@ -4577,44 +4579,45 @@ export function registerWriteTools(server, client) {
|
|
|
4577
4579
|
}
|
|
4578
4580
|
});
|
|
4579
4581
|
// ============================================================
|
|
4580
|
-
// Infrastructure
|
|
4582
|
+
// Infrastructure Feature Classes (scope: infrastructure_feature_classes)
|
|
4581
4583
|
// ============================================================
|
|
4582
4584
|
const INFRA_ASSET_CLASS_CATEGORIES = [
|
|
4583
|
-
'
|
|
4584
|
-
'sewer',
|
|
4585
|
+
'transportation',
|
|
4585
4586
|
'water',
|
|
4586
|
-
'
|
|
4587
|
+
'wastewater',
|
|
4588
|
+
'stormwater',
|
|
4589
|
+
'structures',
|
|
4587
4590
|
'electrical',
|
|
4588
4591
|
'telecom',
|
|
4589
|
-
'
|
|
4590
|
-
'
|
|
4592
|
+
'gas',
|
|
4593
|
+
'roadside',
|
|
4591
4594
|
'other',
|
|
4592
4595
|
];
|
|
4593
|
-
const
|
|
4596
|
+
const featureClassCode = z
|
|
4594
4597
|
.string()
|
|
4595
4598
|
.regex(/^[a-z][a-z0-9_]{0,49}$/)
|
|
4596
4599
|
.describe('Asset class code (lowercase snake_case, 1-50 chars)');
|
|
4597
|
-
server.tool('
|
|
4598
|
-
code:
|
|
4600
|
+
server.tool('create_infrastructure_feature_class', 'Create a tenant-defined infrastructure feature class. Builtin classes are managed by AssetLab and cannot be created via API (is_builtin is always forced to false). Requires infrastructure_feature_classes:write scope.', {
|
|
4601
|
+
code: featureClassCode,
|
|
4599
4602
|
name: z.string().max(200).describe('Display name (required)'),
|
|
4600
4603
|
category: z
|
|
4601
4604
|
.enum(INFRA_ASSET_CLASS_CATEGORIES)
|
|
4602
|
-
.describe('Category (
|
|
4605
|
+
.describe('Category — municipal service family (transportation, water, wastewater, stormwater, structures, electrical, telecom, gas, roadside, other)'),
|
|
4603
4606
|
description: z.string().optional().describe('Description'),
|
|
4604
4607
|
icon: z.string().max(50).optional().describe('Icon name'),
|
|
4605
4608
|
color: z.string().max(20).optional().describe('Display color (CSS color or hex)'),
|
|
4606
4609
|
sort_order: z.number().int().optional().describe('Sort order'),
|
|
4607
4610
|
}, async (params) => {
|
|
4608
4611
|
try {
|
|
4609
|
-
const result = await client.create('infrastructure-
|
|
4612
|
+
const result = await client.create('infrastructure-feature-classes', buildBody(params));
|
|
4610
4613
|
return formatResult(result);
|
|
4611
4614
|
}
|
|
4612
4615
|
catch (err) {
|
|
4613
4616
|
return formatError(err);
|
|
4614
4617
|
}
|
|
4615
4618
|
});
|
|
4616
|
-
server.tool('
|
|
4617
|
-
code:
|
|
4619
|
+
server.tool('update_infrastructure_feature_class', 'Update a tenant-defined infrastructure feature class (addressed by code). The `code`, `category`, and `is_builtin` fields are immutable; attempts to change them on a builtin class return 409. Requires infrastructure_feature_classes:write scope.', {
|
|
4620
|
+
code: featureClassCode,
|
|
4618
4621
|
name: z.string().max(200).optional().describe('Display name'),
|
|
4619
4622
|
description: z.string().optional().describe('Description'),
|
|
4620
4623
|
icon: z.string().max(50).optional().describe('Icon name'),
|
|
@@ -4622,16 +4625,16 @@ export function registerWriteTools(server, client) {
|
|
|
4622
4625
|
sort_order: z.number().int().optional().describe('Sort order'),
|
|
4623
4626
|
}, async ({ code, ...rest }) => {
|
|
4624
4627
|
try {
|
|
4625
|
-
const result = await client.update('infrastructure-
|
|
4628
|
+
const result = await client.update('infrastructure-feature-classes', code, buildBody(rest));
|
|
4626
4629
|
return formatResult(result);
|
|
4627
4630
|
}
|
|
4628
4631
|
catch (err) {
|
|
4629
4632
|
return formatError(err);
|
|
4630
4633
|
}
|
|
4631
4634
|
});
|
|
4632
|
-
server.tool('
|
|
4635
|
+
server.tool('delete_infrastructure_feature_class', 'Delete a tenant-defined infrastructure feature class by code. Builtin classes cannot be deleted. Classes referenced by any infrastructure network are protected by FK and cannot be deleted until those networks are reassigned. Requires infrastructure_feature_classes:write scope.', { code: featureClassCode }, async ({ code }) => {
|
|
4633
4636
|
try {
|
|
4634
|
-
const result = await client.remove('infrastructure-
|
|
4637
|
+
const result = await client.remove('infrastructure-feature-classes', code);
|
|
4635
4638
|
return formatResult(result);
|
|
4636
4639
|
}
|
|
4637
4640
|
catch (err) {
|
|
@@ -4641,9 +4644,9 @@ export function registerWriteTools(server, client) {
|
|
|
4641
4644
|
// ============================================================
|
|
4642
4645
|
// Infrastructure Networks (scope: infrastructure_networks)
|
|
4643
4646
|
// ============================================================
|
|
4644
|
-
server.tool('create_infrastructure_network', 'Create an infrastructure network — a named grouping of features bound to one
|
|
4647
|
+
server.tool('create_infrastructure_network', 'Create an infrastructure network — a named grouping of features bound to one feature class. Requires infrastructure_networks:write scope.', {
|
|
4645
4648
|
name: z.string().max(200).describe('Network name (required)'),
|
|
4646
|
-
|
|
4649
|
+
feature_class: featureClassCode.describe('Asset class code (must exist; resolve via list_infrastructure_feature_classes)'),
|
|
4647
4650
|
description: z.string().optional().describe('Description'),
|
|
4648
4651
|
color_scheme: z.string().max(50).optional().describe('Display color scheme'),
|
|
4649
4652
|
metadata: z.record(z.unknown()).optional().describe('Free-form JSON metadata'),
|
|
@@ -4659,7 +4662,7 @@ export function registerWriteTools(server, client) {
|
|
|
4659
4662
|
server.tool('update_infrastructure_network', 'Update an existing infrastructure network by ID. Requires infrastructure_networks:write scope.', {
|
|
4660
4663
|
id: z.string().uuid().describe('Infrastructure network ID'),
|
|
4661
4664
|
name: z.string().max(200).optional().describe('Network name'),
|
|
4662
|
-
|
|
4665
|
+
feature_class: featureClassCode.optional().describe('Asset class code'),
|
|
4663
4666
|
description: z.string().optional().describe('Description'),
|
|
4664
4667
|
color_scheme: z.string().max(50).optional().describe('Display color scheme'),
|
|
4665
4668
|
metadata: z.record(z.unknown()).optional().describe('Free-form JSON metadata'),
|