node-opcua-modeler-mcp-server 1.2.0 → 1.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/dist/catalog.d.ts +81 -0
- package/dist/catalog.js +133 -0
- package/dist/catalog.js.map +1 -0
- package/dist/cloud.d.ts +41 -0
- package/dist/cloud.js +147 -0
- package/dist/cloud.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +42 -0
- package/dist/server.js +247 -0
- package/dist/server.js.map +1 -0
- package/package.json +8 -3
- package/server.json +2 -2
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==========================================================================
|
|
3
|
+
* OPC UA Modeler MCP Server — Static Catalog Loader
|
|
4
|
+
*
|
|
5
|
+
* Loads the pre-generated catalog.json that contains all public OPC UA
|
|
6
|
+
* companion spec type information. This file is generated at build time
|
|
7
|
+
* by scripts/extract-catalog.ts and committed to git.
|
|
8
|
+
*
|
|
9
|
+
* IMPORTANT: This module has ZERO dependencies on @sterfive/* packages.
|
|
10
|
+
* All data comes from the static JSON catalog.
|
|
11
|
+
* ==========================================================================
|
|
12
|
+
*/
|
|
13
|
+
export interface CompanionSpecEntry {
|
|
14
|
+
alias: string;
|
|
15
|
+
name: string;
|
|
16
|
+
uri: string;
|
|
17
|
+
deps: string[];
|
|
18
|
+
keywords: string[];
|
|
19
|
+
priority: 0 | 1 | 2;
|
|
20
|
+
}
|
|
21
|
+
export interface TypeSummary {
|
|
22
|
+
browseName: string;
|
|
23
|
+
kind: "ObjectType" | "VariableType" | "ReferenceType" | "DataType";
|
|
24
|
+
namespace: string;
|
|
25
|
+
isAbstract: boolean;
|
|
26
|
+
description?: string;
|
|
27
|
+
subtypeOf?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface MemberSummary {
|
|
30
|
+
browseName: string;
|
|
31
|
+
nodeClass: string;
|
|
32
|
+
dataType?: string;
|
|
33
|
+
typeDefinition?: string;
|
|
34
|
+
modellingRule?: string;
|
|
35
|
+
description?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface TypeDetails extends TypeSummary {
|
|
38
|
+
components: MemberSummary[];
|
|
39
|
+
properties: MemberSummary[];
|
|
40
|
+
methods: string[];
|
|
41
|
+
interfaces: string[];
|
|
42
|
+
/**
|
|
43
|
+
* Alias-prefixed browse paths of all optional children (incl. nested,
|
|
44
|
+
* dotted paths) — the valid values for the YAML `optionals:` list.
|
|
45
|
+
*/
|
|
46
|
+
availableOptionals: string[];
|
|
47
|
+
}
|
|
48
|
+
export interface EngineeringUnitsData {
|
|
49
|
+
symbols: string[];
|
|
50
|
+
aliases: Record<string, string>;
|
|
51
|
+
}
|
|
52
|
+
export interface Catalog {
|
|
53
|
+
version: string;
|
|
54
|
+
generatedAt: string;
|
|
55
|
+
registry: CompanionSpecEntry[];
|
|
56
|
+
types: Record<string, TypeSummary[]>;
|
|
57
|
+
typeDetails: Record<string, Record<string, TypeDetails>>;
|
|
58
|
+
engineeringUnits: EngineeringUnitsData;
|
|
59
|
+
}
|
|
60
|
+
/** List all companion spec namespaces */
|
|
61
|
+
export declare function listNamespaces(): CompanionSpecEntry[];
|
|
62
|
+
/**
|
|
63
|
+
* Resolve the full dependency chain for a set of spec aliases.
|
|
64
|
+
* Returns a topologically sorted list (dependencies before dependents).
|
|
65
|
+
*/
|
|
66
|
+
export declare function resolveDependencies(aliases: string[]): string[];
|
|
67
|
+
/** List all types in a companion spec namespace */
|
|
68
|
+
export declare function listTypes(alias: string): TypeSummary[];
|
|
69
|
+
/** Get detailed information about a specific type */
|
|
70
|
+
export declare function getTypeDetails(alias: string, browseName: string): TypeDetails | null;
|
|
71
|
+
/** Search for types across all companion specs by keyword */
|
|
72
|
+
export declare function searchTypes(query: string): (TypeSummary & {
|
|
73
|
+
alias: string;
|
|
74
|
+
})[];
|
|
75
|
+
export interface UnitLookupResult {
|
|
76
|
+
symbol: string;
|
|
77
|
+
matchType: "exact" | "case-insensitive" | "alias" | "fuzzy";
|
|
78
|
+
confidence: number;
|
|
79
|
+
}
|
|
80
|
+
/** Find the official engineering unit symbol for a description */
|
|
81
|
+
export declare function findEngineeringUnit(query: string): UnitLookupResult | null;
|
package/dist/catalog.js
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==========================================================================
|
|
3
|
+
* OPC UA Modeler MCP Server — Static Catalog Loader
|
|
4
|
+
*
|
|
5
|
+
* Loads the pre-generated catalog.json that contains all public OPC UA
|
|
6
|
+
* companion spec type information. This file is generated at build time
|
|
7
|
+
* by scripts/extract-catalog.ts and committed to git.
|
|
8
|
+
*
|
|
9
|
+
* IMPORTANT: This module has ZERO dependencies on @sterfive/* packages.
|
|
10
|
+
* All data comes from the static JSON catalog.
|
|
11
|
+
* ==========================================================================
|
|
12
|
+
*/
|
|
13
|
+
import fs from "node:fs";
|
|
14
|
+
import path from "node:path";
|
|
15
|
+
import { fileURLToPath } from "node:url";
|
|
16
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
const CATALOG_PATH = path.resolve(__dirname, "..", "catalog", "catalog.json");
|
|
18
|
+
// ── Lazy-loaded singleton ────────────────────────────────────────────────
|
|
19
|
+
let _catalog = null;
|
|
20
|
+
function getCatalog() {
|
|
21
|
+
if (!_catalog) {
|
|
22
|
+
const raw = fs.readFileSync(CATALOG_PATH, "utf-8");
|
|
23
|
+
_catalog = JSON.parse(raw);
|
|
24
|
+
}
|
|
25
|
+
return _catalog;
|
|
26
|
+
}
|
|
27
|
+
// ── Public Query API ─────────────────────────────────────────────────────
|
|
28
|
+
/** List all companion spec namespaces */
|
|
29
|
+
export function listNamespaces() {
|
|
30
|
+
return getCatalog().registry;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Resolve the full dependency chain for a set of spec aliases.
|
|
34
|
+
* Returns a topologically sorted list (dependencies before dependents).
|
|
35
|
+
*/
|
|
36
|
+
export function resolveDependencies(aliases) {
|
|
37
|
+
const registry = getCatalog().registry;
|
|
38
|
+
const byAlias = new Map(registry.map((s) => [s.alias, s]));
|
|
39
|
+
const resolved = new Set();
|
|
40
|
+
const result = [];
|
|
41
|
+
function visit(alias) {
|
|
42
|
+
if (resolved.has(alias))
|
|
43
|
+
return;
|
|
44
|
+
const spec = byAlias.get(alias);
|
|
45
|
+
if (!spec)
|
|
46
|
+
return;
|
|
47
|
+
for (const dep of spec.deps) {
|
|
48
|
+
visit(dep);
|
|
49
|
+
}
|
|
50
|
+
resolved.add(alias);
|
|
51
|
+
result.push(alias);
|
|
52
|
+
}
|
|
53
|
+
for (const alias of aliases) {
|
|
54
|
+
visit(alias);
|
|
55
|
+
}
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
/** List all types in a companion spec namespace */
|
|
59
|
+
export function listTypes(alias) {
|
|
60
|
+
return getCatalog().types[alias] ?? [];
|
|
61
|
+
}
|
|
62
|
+
/** Get detailed information about a specific type */
|
|
63
|
+
export function getTypeDetails(alias, browseName) {
|
|
64
|
+
const nsDetails = getCatalog().typeDetails[alias];
|
|
65
|
+
if (!nsDetails)
|
|
66
|
+
return null;
|
|
67
|
+
return nsDetails[browseName] ?? null;
|
|
68
|
+
}
|
|
69
|
+
/** Search for types across all companion specs by keyword */
|
|
70
|
+
export function searchTypes(query) {
|
|
71
|
+
const catalog = getCatalog();
|
|
72
|
+
const results = [];
|
|
73
|
+
const q = query.toLowerCase();
|
|
74
|
+
for (const [alias, types] of Object.entries(catalog.types)) {
|
|
75
|
+
for (const t of types) {
|
|
76
|
+
if (t.browseName.toLowerCase().includes(q) || (t.description && t.description.toLowerCase().includes(q))) {
|
|
77
|
+
results.push({ ...t, alias });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return results;
|
|
82
|
+
}
|
|
83
|
+
let _unitsLower = null;
|
|
84
|
+
function getUnitsLowerMap() {
|
|
85
|
+
if (!_unitsLower) {
|
|
86
|
+
_unitsLower = new Map();
|
|
87
|
+
for (const u of getCatalog().engineeringUnits.symbols) {
|
|
88
|
+
_unitsLower.set(String(u).toLowerCase(), String(u));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return _unitsLower;
|
|
92
|
+
}
|
|
93
|
+
/** Find the official engineering unit symbol for a description */
|
|
94
|
+
export function findEngineeringUnit(query) {
|
|
95
|
+
if (!query || query.trim().length === 0)
|
|
96
|
+
return null;
|
|
97
|
+
const catalog = getCatalog();
|
|
98
|
+
const units = catalog.engineeringUnits.symbols.map(String);
|
|
99
|
+
const aliases = catalog.engineeringUnits.aliases;
|
|
100
|
+
const q = query.trim();
|
|
101
|
+
// 1. Exact match
|
|
102
|
+
if (units.includes(q)) {
|
|
103
|
+
return { symbol: q, matchType: "exact", confidence: 1 };
|
|
104
|
+
}
|
|
105
|
+
// 2. Case-insensitive match
|
|
106
|
+
const lowerMap = getUnitsLowerMap();
|
|
107
|
+
const lower = q.toLowerCase();
|
|
108
|
+
const ciMatch = lowerMap.get(lower);
|
|
109
|
+
if (ciMatch) {
|
|
110
|
+
return { symbol: ciMatch, matchType: "case-insensitive", confidence: 0.95 };
|
|
111
|
+
}
|
|
112
|
+
// 3. Alias match (natural language → symbol)
|
|
113
|
+
const aliasMatch = aliases[lower];
|
|
114
|
+
if (aliasMatch) {
|
|
115
|
+
return { symbol: aliasMatch, matchType: "alias", confidence: 1 };
|
|
116
|
+
}
|
|
117
|
+
// 4. Fuzzy: strip quotes, whitespace variants
|
|
118
|
+
const normalized = q.replace(/['"]/g, "").replace(/\s+/g, " ").toLowerCase();
|
|
119
|
+
const aliasNorm = aliases[normalized];
|
|
120
|
+
if (aliasNorm) {
|
|
121
|
+
return { symbol: aliasNorm, matchType: "alias", confidence: 0.9 };
|
|
122
|
+
}
|
|
123
|
+
// 5. Fuzzy: try removing trailing 's' (plurals)
|
|
124
|
+
if (normalized.endsWith("s")) {
|
|
125
|
+
const singular = normalized.slice(0, -1);
|
|
126
|
+
const singularMatch = aliases[singular];
|
|
127
|
+
if (singularMatch) {
|
|
128
|
+
return { symbol: singularMatch, matchType: "fuzzy", confidence: 0.85 };
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;AAyD9E,4EAA4E;AAE5E,IAAI,QAAQ,GAAmB,IAAI,CAAC;AAEpC,SAAS,UAAU;IACjB,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACnD,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAY,CAAC;IACxC,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,4EAA4E;AAE5E,yCAAyC;AACzC,MAAM,UAAU,cAAc;IAC5B,OAAO,UAAU,EAAE,CAAC,QAAQ,CAAC;AAC/B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAiB;IACnD,MAAM,QAAQ,GAAG,UAAU,EAAE,CAAC,QAAQ,CAAC;IACvC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,QAAQ,CA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ChD,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACzC,MAAM,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;QACxC,IAAI,aAAa,EAAE,CAAC;YAClB,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;QACzE,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/cloud.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==========================================================================
|
|
3
|
+
* OPC UA Modeler — Cloud API Client
|
|
4
|
+
*
|
|
5
|
+
* Thin HTTP wrapper for proxying MCP tool calls to the Sterfive SaaS API.
|
|
6
|
+
* ZERO proprietary dependencies — only native fetch.
|
|
7
|
+
*
|
|
8
|
+
* Configuration via environment variables:
|
|
9
|
+
* OPCUA_MODELER_API_URL — Base URL (default: https://api.opcua-modeler.sterfive.io)
|
|
10
|
+
* OPCUA_MODELER_API_KEY — API key (stfv_...) for authenticated endpoints
|
|
11
|
+
*
|
|
12
|
+
* IMPORTANT: Never use console.log() — stdout is reserved for JSON-RPC.
|
|
13
|
+
* ==========================================================================
|
|
14
|
+
*/
|
|
15
|
+
/** Structured error from the cloud API */
|
|
16
|
+
export interface CloudError {
|
|
17
|
+
error: string;
|
|
18
|
+
status?: number;
|
|
19
|
+
hint?: string;
|
|
20
|
+
}
|
|
21
|
+
/** Result of a cloud API call — either success JSON or structured error */
|
|
22
|
+
export type CloudResult<T = unknown> = {
|
|
23
|
+
ok: true;
|
|
24
|
+
data: T;
|
|
25
|
+
} | {
|
|
26
|
+
ok: false;
|
|
27
|
+
error: CloudError;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Make an authenticated request to the Sterfive SaaS API.
|
|
31
|
+
*
|
|
32
|
+
* @param path - API path (e.g. "/v1/validate")
|
|
33
|
+
* @param body - Request body (string)
|
|
34
|
+
* @param contentType - Content-Type header (e.g. "text/yaml", "application/xml")
|
|
35
|
+
* @returns Parsed JSON response or structured error
|
|
36
|
+
*/
|
|
37
|
+
export declare function cloudFetch<T = unknown>(path: string, body: string, contentType: string): Promise<CloudResult<T>>;
|
|
38
|
+
/**
|
|
39
|
+
* Format a CloudError into a user-friendly MCP tool error response.
|
|
40
|
+
*/
|
|
41
|
+
export declare function formatCloudError(err: CloudError): string;
|
package/dist/cloud.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==========================================================================
|
|
3
|
+
* OPC UA Modeler — Cloud API Client
|
|
4
|
+
*
|
|
5
|
+
* Thin HTTP wrapper for proxying MCP tool calls to the Sterfive SaaS API.
|
|
6
|
+
* ZERO proprietary dependencies — only native fetch.
|
|
7
|
+
*
|
|
8
|
+
* Configuration via environment variables:
|
|
9
|
+
* OPCUA_MODELER_API_URL — Base URL (default: https://api.opcua-modeler.sterfive.io)
|
|
10
|
+
* OPCUA_MODELER_API_KEY — API key (stfv_...) for authenticated endpoints
|
|
11
|
+
*
|
|
12
|
+
* IMPORTANT: Never use console.log() — stdout is reserved for JSON-RPC.
|
|
13
|
+
* ==========================================================================
|
|
14
|
+
*/
|
|
15
|
+
const DEFAULT_API_URL = "https://api.opcua-modeler.sterfive.io";
|
|
16
|
+
const TIMEOUT_MS = 30_000;
|
|
17
|
+
function getApiUrl() {
|
|
18
|
+
return process.env.OPCUA_MODELER_API_URL || DEFAULT_API_URL;
|
|
19
|
+
}
|
|
20
|
+
function getApiKey() {
|
|
21
|
+
return process.env.OPCUA_MODELER_API_KEY;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Make an authenticated request to the Sterfive SaaS API.
|
|
25
|
+
*
|
|
26
|
+
* @param path - API path (e.g. "/v1/validate")
|
|
27
|
+
* @param body - Request body (string)
|
|
28
|
+
* @param contentType - Content-Type header (e.g. "text/yaml", "application/xml")
|
|
29
|
+
* @returns Parsed JSON response or structured error
|
|
30
|
+
*/
|
|
31
|
+
export async function cloudFetch(path, body, contentType) {
|
|
32
|
+
const baseUrl = getApiUrl();
|
|
33
|
+
const apiKey = getApiKey();
|
|
34
|
+
const url = `${baseUrl}${path}`;
|
|
35
|
+
const headers = {
|
|
36
|
+
"Content-Type": contentType,
|
|
37
|
+
Accept: "application/json"
|
|
38
|
+
};
|
|
39
|
+
if (apiKey) {
|
|
40
|
+
headers["Authorization"] = `Bearer ${apiKey}`;
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
const controller = new AbortController();
|
|
44
|
+
const timeout = setTimeout(() => controller.abort(), TIMEOUT_MS);
|
|
45
|
+
const response = await fetch(url, {
|
|
46
|
+
method: "POST",
|
|
47
|
+
headers,
|
|
48
|
+
body,
|
|
49
|
+
signal: controller.signal
|
|
50
|
+
});
|
|
51
|
+
clearTimeout(timeout);
|
|
52
|
+
if (response.ok) {
|
|
53
|
+
const data = (await response.json());
|
|
54
|
+
return { ok: true, data };
|
|
55
|
+
}
|
|
56
|
+
// Handle specific HTTP error codes with actionable messages
|
|
57
|
+
switch (response.status) {
|
|
58
|
+
case 401:
|
|
59
|
+
case 403:
|
|
60
|
+
return {
|
|
61
|
+
ok: false,
|
|
62
|
+
error: {
|
|
63
|
+
error: "Authentication required. Set OPCUA_MODELER_API_KEY in your MCP server config.",
|
|
64
|
+
status: response.status,
|
|
65
|
+
hint: "Get a free API key at https://opcua-modeler.sterfive.com/settings/api-keys"
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
case 429: {
|
|
69
|
+
const retryAfter = response.headers.get("Retry-After");
|
|
70
|
+
const upgradeUrl = response.headers.get("X-Upgrade-URL");
|
|
71
|
+
return {
|
|
72
|
+
ok: false,
|
|
73
|
+
error: {
|
|
74
|
+
error: `Rate limit exceeded.${retryAfter ? ` Try again in ${retryAfter}s.` : ""}`,
|
|
75
|
+
status: 429,
|
|
76
|
+
hint: upgradeUrl ? `Upgrade your plan at ${upgradeUrl}` : "Reduce request frequency or upgrade your plan."
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
case 422: {
|
|
81
|
+
// Validation error from the API (e.g. malformed YAML)
|
|
82
|
+
let detail = "";
|
|
83
|
+
try {
|
|
84
|
+
const errBody = (await response.json());
|
|
85
|
+
detail = errBody.detail || errBody.message || "";
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
detail = await response.text();
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
ok: false,
|
|
92
|
+
error: {
|
|
93
|
+
error: `Validation error: ${detail}`,
|
|
94
|
+
status: 422
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
default: {
|
|
99
|
+
let text = "";
|
|
100
|
+
try {
|
|
101
|
+
text = await response.text();
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
/* ignore */
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
ok: false,
|
|
108
|
+
error: {
|
|
109
|
+
error: `API error (HTTP ${response.status}): ${text || response.statusText}`,
|
|
110
|
+
status: response.status
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch (e) {
|
|
117
|
+
if (e instanceof DOMException && e.name === "AbortError") {
|
|
118
|
+
return {
|
|
119
|
+
ok: false,
|
|
120
|
+
error: {
|
|
121
|
+
error: `Request timed out after ${TIMEOUT_MS / 1000}s. The server may be unavailable.`,
|
|
122
|
+
hint: "Check https://opcua-modeler.sterfive.com/status for service status."
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
// Network errors (DNS, connection refused, etc.)
|
|
127
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
128
|
+
return {
|
|
129
|
+
ok: false,
|
|
130
|
+
error: {
|
|
131
|
+
error: `Cannot reach the OPC UA Modeler API: ${message}`,
|
|
132
|
+
hint: "Check your network connection or verify the API URL."
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Format a CloudError into a user-friendly MCP tool error response.
|
|
139
|
+
*/
|
|
140
|
+
export function formatCloudError(err) {
|
|
141
|
+
const parts = [err.error];
|
|
142
|
+
if (err.hint) {
|
|
143
|
+
parts.push(`Hint: ${err.hint}`);
|
|
144
|
+
}
|
|
145
|
+
return parts.join("\n");
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=cloud.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud.js","sourceRoot":"","sources":["../src/cloud.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,eAAe,GAAG,uCAAuC,CAAC;AAChE,MAAM,UAAU,GAAG,MAAM,CAAC;AAY1B,SAAS,SAAS;IAChB,OAAO,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,eAAe,CAAC;AAC9D,CAAC;AAED,SAAS,SAAS;IAChB,OAAO,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;AAC3C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAc,IAAY,EAAE,IAAY,EAAE,WAAmB;IAC3F,MAAM,OAAO,GAAG,SAAS,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,GAAG,GAAG,GAAG,OAAO,GAAG,IAAI,EAAE,CAAC;IAEhC,MAAM,OAAO,GAA2B;QACtC,cAAc,EAAE,WAAW;QAC3B,MAAM,EAAE,kBAAkB;KAC3B,CAAC;IAEF,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,MAAM,EAAE,CAAC;IAChD,CAA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AAI,mCAAmC;oBACtF,IAAI,EAAE,qEAAqE;iBAC5E;aACF,CAAC;QACJ,CAAC;QAED,iDAAiD;QACjD,MAAM,OAAO,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC3D,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE;gBACL,KAAK,EAAE,wCAAwC,OAAO,EAAE;gBACxD,IAAI,EAAE,sDAAsD;aAC7D;SACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAe;IAC9C,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC1B,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QACb,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* ==========================================================================
|
|
4
|
+
* OPC UA Modeler — MCP Server (CLI Entry Point)
|
|
5
|
+
*
|
|
6
|
+
* Thin wrapper that creates the server and connects it to stdio transport.
|
|
7
|
+
* All tool registration logic lives in server.ts.
|
|
8
|
+
*
|
|
9
|
+
* Transport: stdio (JSON-RPC over stdin/stdout)
|
|
10
|
+
* IMPORTANT: Never use console.log() — stdout is reserved for JSON-RPC.
|
|
11
|
+
* ==========================================================================
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* ==========================================================================
|
|
4
|
+
* OPC UA Modeler — MCP Server (CLI Entry Point)
|
|
5
|
+
*
|
|
6
|
+
* Thin wrapper that creates the server and connects it to stdio transport.
|
|
7
|
+
* All tool registration logic lives in server.ts.
|
|
8
|
+
*
|
|
9
|
+
* Transport: stdio (JSON-RPC over stdin/stdout)
|
|
10
|
+
* IMPORTANT: Never use console.log() — stdout is reserved for JSON-RPC.
|
|
11
|
+
* ==========================================================================
|
|
12
|
+
*/
|
|
13
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
14
|
+
import { createServer } from "./server.js";
|
|
15
|
+
async function main() {
|
|
16
|
+
const server = createServer();
|
|
17
|
+
const transport = new StdioServerTransport();
|
|
18
|
+
await server.connect(transport);
|
|
19
|
+
console.error("opcua-modeler MCP server running on stdio");
|
|
20
|
+
}
|
|
21
|
+
main().catch((err) => {
|
|
22
|
+
console.error("Fatal error starting MCP server:", err);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;AAC7D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,GAAG,CAAC,CAAC;IACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==========================================================================
|
|
3
|
+
* OPC UA Modeler — MCP Server Factory (IP-Safe Version)
|
|
4
|
+
*
|
|
5
|
+
* Creates and configures the MCP server with 10 OPC UA tools:
|
|
6
|
+
* - 6 LOCAL tools: query the static type catalog (free, offline)
|
|
7
|
+
* - 4 CLOUD tools: proxy to api.opcua-modeler.sterfive.io
|
|
8
|
+
*
|
|
9
|
+
* Architecture: "Thin Local Shell" per Project Prometheus §1.1
|
|
10
|
+
* ZERO dependencies on proprietary @sterfive/* packages.
|
|
11
|
+
*
|
|
12
|
+
* IMPORTANT: Never use console.log() — stdout may be reserved for JSON-RPC.
|
|
13
|
+
* ==========================================================================
|
|
14
|
+
*/
|
|
15
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
16
|
+
import { findEngineeringUnit, getTypeDetails, listNamespaces, listTypes, resolveDependencies, searchTypes } from "./catalog.js";
|
|
17
|
+
export { findEngineeringUnit, getTypeDetails, listNamespaces, listTypes, resolveDependencies, searchTypes };
|
|
18
|
+
/** Tool name type */
|
|
19
|
+
export type ToolName = "resolve_dependencies" | "list_namespaces" | "list_types" | "get_type_details" | "search_types" | "find_engineering_unit" | "opcua_model_validate" | "opcua_model_generate" | "opcua_model_reverse" | "opcua_model_create";
|
|
20
|
+
/**
|
|
21
|
+
* Direct tool call handler for testing (bypasses MCP protocol).
|
|
22
|
+
* Returns the same shape as MCP tool responses.
|
|
23
|
+
*/
|
|
24
|
+
export declare function handleToolCall(name: ToolName, args: Record<string, unknown>): Promise<{
|
|
25
|
+
content: {
|
|
26
|
+
type: "text";
|
|
27
|
+
text: string;
|
|
28
|
+
}[];
|
|
29
|
+
isError?: undefined;
|
|
30
|
+
} | {
|
|
31
|
+
content: {
|
|
32
|
+
type: "text";
|
|
33
|
+
text: string;
|
|
34
|
+
}[];
|
|
35
|
+
isError: boolean;
|
|
36
|
+
}>;
|
|
37
|
+
/**
|
|
38
|
+
* Create and configure the MCP server with all OPC UA tools registered.
|
|
39
|
+
* The server is NOT connected to any transport — the caller is responsible
|
|
40
|
+
* for connecting it (e.g., StdioServerTransport or InMemoryTransport).
|
|
41
|
+
*/
|
|
42
|
+
export declare function createServer(): McpServer;
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==========================================================================
|
|
3
|
+
* OPC UA Modeler — MCP Server Factory (IP-Safe Version)
|
|
4
|
+
*
|
|
5
|
+
* Creates and configures the MCP server with 10 OPC UA tools:
|
|
6
|
+
* - 6 LOCAL tools: query the static type catalog (free, offline)
|
|
7
|
+
* - 4 CLOUD tools: proxy to api.opcua-modeler.sterfive.io
|
|
8
|
+
*
|
|
9
|
+
* Architecture: "Thin Local Shell" per Project Prometheus §1.1
|
|
10
|
+
* ZERO dependencies on proprietary @sterfive/* packages.
|
|
11
|
+
*
|
|
12
|
+
* IMPORTANT: Never use console.log() — stdout may be reserved for JSON-RPC.
|
|
13
|
+
* ==========================================================================
|
|
14
|
+
*/
|
|
15
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
16
|
+
import { z } from "zod";
|
|
17
|
+
import { findEngineeringUnit, getTypeDetails, listNamespaces, listTypes, resolveDependencies, searchTypes } from "./catalog.js";
|
|
18
|
+
import { cloudFetch, formatCloudError } from "./cloud.js";
|
|
19
|
+
// Re-export for testing
|
|
20
|
+
export { findEngineeringUnit, getTypeDetails, listNamespaces, listTypes, resolveDependencies, searchTypes };
|
|
21
|
+
/**
|
|
22
|
+
* Direct tool call handler for testing (bypasses MCP protocol).
|
|
23
|
+
* Returns the same shape as MCP tool responses.
|
|
24
|
+
*/
|
|
25
|
+
export async function handleToolCall(name, args) {
|
|
26
|
+
try {
|
|
27
|
+
switch (name) {
|
|
28
|
+
case "resolve_dependencies": {
|
|
29
|
+
const aliases = args.aliases;
|
|
30
|
+
return { content: [{ type: "text", text: JSON.stringify(resolveDependencies(aliases)) }] };
|
|
31
|
+
}
|
|
32
|
+
case "list_namespaces": {
|
|
33
|
+
const specs = listNamespaces().map((s) => ({
|
|
34
|
+
alias: s.alias,
|
|
35
|
+
name: s.name,
|
|
36
|
+
uri: s.uri,
|
|
37
|
+
dependencies: s.deps
|
|
38
|
+
}));
|
|
39
|
+
return { content: [{ type: "text", text: JSON.stringify(specs) }] };
|
|
40
|
+
}
|
|
41
|
+
case "list_types": {
|
|
42
|
+
return { content: [{ type: "text", text: JSON.stringify(listTypes(args.alias)) }] };
|
|
43
|
+
}
|
|
44
|
+
case "get_type_details": {
|
|
45
|
+
const details = getTypeDetails(args.alias, args.browseName);
|
|
46
|
+
if (!details) {
|
|
47
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: `Type not found` }) }], isError: true };
|
|
48
|
+
}
|
|
49
|
+
return { content: [{ type: "text", text: JSON.stringify(details) }] };
|
|
50
|
+
}
|
|
51
|
+
case "search_types": {
|
|
52
|
+
return { content: [{ type: "text", text: JSON.stringify(searchTypes(args.query)) }] };
|
|
53
|
+
}
|
|
54
|
+
case "find_engineering_unit": {
|
|
55
|
+
const result = findEngineeringUnit(String(args.query ?? ""));
|
|
56
|
+
if (!result) {
|
|
57
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: `No unit found` }) }], isError: true };
|
|
58
|
+
}
|
|
59
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
60
|
+
}
|
|
61
|
+
default:
|
|
62
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: `Unknown tool: ${name}` }) }], isError: true };
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: String(e) }) }], isError: true };
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Create and configure the MCP server with all OPC UA tools registered.
|
|
71
|
+
* The server is NOT connected to any transport — the caller is responsible
|
|
72
|
+
* for connecting it (e.g., StdioServerTransport or InMemoryTransport).
|
|
73
|
+
*/
|
|
74
|
+
export function createServer() {
|
|
75
|
+
const server = new McpServer({
|
|
76
|
+
name: "opcua-modeler",
|
|
77
|
+
version: "1.2.0"
|
|
78
|
+
});
|
|
79
|
+
// ── 1. resolve_dependencies ──────────────────────────────────────────
|
|
80
|
+
server.tool("resolve_dependencies", "Given one or more companion spec namespace aliases, returns the full " +
|
|
81
|
+
"resolved dependency list that MUST go in the YAML `namespaces:` section. " +
|
|
82
|
+
"Always call this before generating the namespaces block.", { aliases: z.array(z.string()).describe('Companion spec aliases to resolve (e.g. ["machineTool", "robotics"])') }, async ({ aliases }) => {
|
|
83
|
+
try {
|
|
84
|
+
const resolved = resolveDependencies(aliases);
|
|
85
|
+
return {
|
|
86
|
+
content: [{ type: "text", text: JSON.stringify(resolved) }]
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
catch (e) {
|
|
90
|
+
return {
|
|
91
|
+
content: [{ type: "text", text: JSON.stringify({ error: String(e) }) }],
|
|
92
|
+
isError: true
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
// ── 2. list_namespaces ───────────────────────────────────────────────
|
|
97
|
+
server.tool("list_namespaces", "List all well-known OPC UA companion spec namespace aliases with their " +
|
|
98
|
+
"full names, URIs, and dependencies. Use this to discover what namespaces are available.", {}, async () => {
|
|
99
|
+
const specs = listNamespaces().map((s) => ({
|
|
100
|
+
alias: s.alias,
|
|
101
|
+
name: s.name,
|
|
102
|
+
uri: s.uri,
|
|
103
|
+
dependencies: s.deps
|
|
104
|
+
}));
|
|
105
|
+
return {
|
|
106
|
+
content: [{ type: "text", text: JSON.stringify(specs) }]
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
// ── 3. list_types ────────────────────────────────────────────────────
|
|
110
|
+
server.tool("list_types", "List ALL ObjectTypes, VariableTypes, and InterfaceTypes defined in a " +
|
|
111
|
+
"specific companion spec namespace. " +
|
|
112
|
+
"ALWAYS call this before using any type from a namespace — NEVER guess type names.", { alias: z.string().describe('Companion spec alias (e.g. "machinery", "di", "robotics")') }, async ({ alias }) => {
|
|
113
|
+
const types = listTypes(alias);
|
|
114
|
+
return {
|
|
115
|
+
content: [{ type: "text", text: JSON.stringify(types) }]
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
// ── 4. get_type_details ──────────────────────────────────────────────
|
|
119
|
+
server.tool("get_type_details", "Get detailed information about a specific type: its components, properties, " +
|
|
120
|
+
"methods, interfaces, and optional members. Use this to understand a type's " +
|
|
121
|
+
"structure before creating instances or subtypes.", {
|
|
122
|
+
alias: z.string().describe('Companion spec alias where the type is defined (e.g. "machinery")'),
|
|
123
|
+
browseName: z.string().describe('The type browse name (e.g. "MachineryItemIdentificationType")')
|
|
124
|
+
}, async ({ alias, browseName }) => {
|
|
125
|
+
const details = getTypeDetails(alias, browseName);
|
|
126
|
+
if (!details) {
|
|
127
|
+
return {
|
|
128
|
+
content: [{ type: "text", text: JSON.stringify({ error: `Type "${browseName}" not found in "${alias}"` }) }],
|
|
129
|
+
isError: true
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
content: [{ type: "text", text: JSON.stringify(details) }]
|
|
134
|
+
};
|
|
135
|
+
});
|
|
136
|
+
// ── 5. search_types ──────────────────────────────────────────────────
|
|
137
|
+
server.tool("search_types", "Search for types across ALL companion specs by keyword. " +
|
|
138
|
+
"Use this when you don't know which namespace defines a type. " +
|
|
139
|
+
"Returns matching types with their namespace alias.", { query: z.string().describe('Search keyword (e.g. "identification", "temperature", "motion")') }, async ({ query }) => {
|
|
140
|
+
const results = searchTypes(query);
|
|
141
|
+
return {
|
|
142
|
+
content: [{ type: "text", text: JSON.stringify(results) }]
|
|
143
|
+
};
|
|
144
|
+
});
|
|
145
|
+
// ── 6. find_engineering_unit ──────────────────────────────────────────
|
|
146
|
+
server.tool("find_engineering_unit", "Find the official UNECE Rec. 20 engineering unit symbol for a given description. " +
|
|
147
|
+
"ALWAYS call this before using any engineering unit — NEVER guess unit symbols.", {
|
|
148
|
+
query: z
|
|
149
|
+
.string()
|
|
150
|
+
.describe('Description or common name of the unit (e.g. "revolutions per minute", "celsius", "pressure bar")')
|
|
151
|
+
}, async ({ query }) => {
|
|
152
|
+
const result = findEngineeringUnit(query);
|
|
153
|
+
if (!result) {
|
|
154
|
+
return {
|
|
155
|
+
content: [{ type: "text", text: JSON.stringify({ error: `No unit found for "${query}"` }) }],
|
|
156
|
+
isError: true
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
content: [{ type: "text", text: JSON.stringify(result) }]
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
// ═══════════════════════════════════════════════════════════════════════
|
|
164
|
+
// CLOUD TOOLS — proxy to api.opcua-modeler.sterfive.io (Phase 1b)
|
|
165
|
+
// These require the SaaS API to be running. Set OPCUA_MODELER_API_KEY
|
|
166
|
+
// in env for authenticated access (generate/reverse require a key).
|
|
167
|
+
// ═══════════════════════════════════════════════════════════════════════
|
|
168
|
+
// ── 7. opcua_model_validate ───────────────────────────────────────────
|
|
169
|
+
server.tool("opcua_model_validate", "Validate an OPC UA YAML model for correctness. Returns diagnostics " +
|
|
170
|
+
"with severity (error/warning/info), codes, messages, and line numbers. " +
|
|
171
|
+
"Works without an API key (limited to 5 calls/day). " +
|
|
172
|
+
"ALWAYS validate before generating.", {
|
|
173
|
+
yaml: z.string().describe("The full YAML model source to validate")
|
|
174
|
+
}, async ({ yaml }) => {
|
|
175
|
+
const result = await cloudFetch("/api/v1/validate", yaml, "text/yaml");
|
|
176
|
+
if (!result.ok) {
|
|
177
|
+
return {
|
|
178
|
+
content: [{ type: "text", text: formatCloudError(result.error) }],
|
|
179
|
+
isError: true
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
content: [{ type: "text", text: JSON.stringify(result.data) }]
|
|
184
|
+
};
|
|
185
|
+
});
|
|
186
|
+
// ── 8. opcua_model_generate ───────────────────────────────────────────
|
|
187
|
+
server.tool("opcua_model_generate", "Generate OPC UA NodeSet2.xml and Symbols.CSV from a YAML model. " +
|
|
188
|
+
"Requires an API key (set OPCUA_MODELER_API_KEY env var). " +
|
|
189
|
+
"Returns base64-encoded artifacts if the model is valid, " +
|
|
190
|
+
"or diagnostics if validation fails. " +
|
|
191
|
+
"Optionally set include_docs=true to also generate markdown documentation.", {
|
|
192
|
+
yaml: z.string().describe("The full YAML model source to generate from"),
|
|
193
|
+
include_docs: z.boolean().optional().describe("Set to true to include markdown documentation (slower)")
|
|
194
|
+
}, async ({ yaml, include_docs }) => {
|
|
195
|
+
const path = include_docs ? "/api/v1/generate?include=docs" : "/api/v1/generate";
|
|
196
|
+
const result = await cloudFetch(path, yaml, "text/yaml");
|
|
197
|
+
if (!result.ok) {
|
|
198
|
+
return {
|
|
199
|
+
content: [{ type: "text", text: formatCloudError(result.error) }],
|
|
200
|
+
isError: true
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
content: [{ type: "text", text: JSON.stringify(result.data) }]
|
|
205
|
+
};
|
|
206
|
+
});
|
|
207
|
+
// ── 9. opcua_model_reverse ────────────────────────────────────────────
|
|
208
|
+
server.tool("opcua_model_reverse", "Reverse-engineer a NodeSet2.xml file back into the YAML DSL format. " +
|
|
209
|
+
"Requires an API key (set OPCUA_MODELER_API_KEY env var). " +
|
|
210
|
+
"Optionally specify the target namespace URI to extract.", {
|
|
211
|
+
xml: z.string().describe("The NodeSet2.xml content to reverse-engineer"),
|
|
212
|
+
namespace_uri: z.string().optional().describe("Target namespace URI to extract (auto-detected if omitted)")
|
|
213
|
+
}, async ({ xml, namespace_uri }) => {
|
|
214
|
+
const path = namespace_uri ? `/api/v1/reverse?ns=${encodeURIComponent(namespace_uri)}` : "/api/v1/reverse";
|
|
215
|
+
const result = await cloudFetch(path, xml, "application/xml");
|
|
216
|
+
if (!result.ok) {
|
|
217
|
+
return {
|
|
218
|
+
content: [{ type: "text", text: formatCloudError(result.error) }],
|
|
219
|
+
isError: true
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
content: [{ type: "text", text: JSON.stringify(result.data) }]
|
|
224
|
+
};
|
|
225
|
+
});
|
|
226
|
+
// ── 10. opcua_model_create ─────────────────────────────────────────────
|
|
227
|
+
server.tool("opcua_model_create", "Generate an OPC UA YAML model from a natural language description " +
|
|
228
|
+
"using AI. Requires an API key (set OPCUA_MODELER_API_KEY env var). " +
|
|
229
|
+
"The AI will auto-detect relevant companion specs, generate a " +
|
|
230
|
+
"validated model with documentation, and auto-correct validation errors.", {
|
|
231
|
+
prompt: z.string().describe("Natural language description of the OPC UA model to generate"),
|
|
232
|
+
forceSpecs: z.array(z.string()).optional().describe('Companion spec aliases to force (e.g. ["di", "ia"])')
|
|
233
|
+
}, async ({ prompt, forceSpecs }) => {
|
|
234
|
+
const result = await cloudFetch("/api/v1/ai/generate", JSON.stringify({ prompt, forceSpecs, stream: false }), "application/json");
|
|
235
|
+
if (!result.ok) {
|
|
236
|
+
return {
|
|
237
|
+
content: [{ type: "text", text: formatCloudError(result.error) }],
|
|
238
|
+
isError: true
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
return {
|
|
242
|
+
content: [{ type: "text", text: JSON.stringify(result.data) }]
|
|
243
|
+
};
|
|
244
|
+
});
|
|
245
|
+
return server;
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAA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,QAAQ,CAAC,qDAAqD,CAAC;KAC3G,EACD,KAAK,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE;QAC/B,MAAM,MAAM,GAAG,MAAM,UAAU,CAO5B,qBAAqB,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,kBAAkB,CAAC,CAAC;QAErG,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC1E,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QACD,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;SACxE,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-modeler-mcp-server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"mcpName": "io.github.node-opcua/node-opcua-modeler-mcp-server",
|
|
5
5
|
"description": "OPC UA Modeler MCP Server — exposes companion spec tools to AI agents",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"bin": {
|
|
10
|
-
"node-opcua-modeler-mcp": "
|
|
10
|
+
"node-opcua-modeler-mcp": "dist/index.js"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"dist/",
|
|
@@ -18,12 +18,17 @@
|
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "tsc",
|
|
21
|
+
"prepublishOnly": "npm run build",
|
|
21
22
|
"start": "node dist/index.js"
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
24
25
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
25
26
|
"zod": "^3.25.0"
|
|
26
27
|
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/node": "25.9.1",
|
|
30
|
+
"typescript": "~5.7.3"
|
|
31
|
+
},
|
|
27
32
|
"keywords": [
|
|
28
33
|
"opcua",
|
|
29
34
|
"opc-ua",
|
|
@@ -44,6 +49,6 @@
|
|
|
44
49
|
"license": "MIT",
|
|
45
50
|
"repository": {
|
|
46
51
|
"type": "git",
|
|
47
|
-
"url": "https://github.com/node-opcua/node-opcua-modeler-mcp-server.git"
|
|
52
|
+
"url": "git+https://github.com/node-opcua/node-opcua-modeler-mcp-server.git"
|
|
48
53
|
}
|
|
49
54
|
}
|
package/server.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "io.github.node-opcua/node-opcua-modeler-mcp-server",
|
|
4
4
|
"title": "OPC UA Modeler",
|
|
5
5
|
"description": "OPC UA companion spec types, namespace dependencies, and engineering units for AI agents",
|
|
6
|
-
"version": "1.2.
|
|
6
|
+
"version": "1.2.1",
|
|
7
7
|
"websiteUrl": "https://opcua-modeler.sterfive.com",
|
|
8
8
|
"repository": {
|
|
9
9
|
"url": "https://github.com/node-opcua/node-opcua-modeler-mcp-server",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
{
|
|
14
14
|
"registryType": "npm",
|
|
15
15
|
"identifier": "node-opcua-modeler-mcp-server",
|
|
16
|
-
"version": "1.2.
|
|
16
|
+
"version": "1.2.1",
|
|
17
17
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
18
18
|
"runtimeHint": "npx",
|
|
19
19
|
"transport": {
|