node-opcua-modeler-mcp-server 1.6.0 → 1.7.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.
@@ -0,0 +1,134 @@
1
+ /**
2
+ * ==========================================================================
3
+ * OPC UA Modeler — generate: NodeId stability and files on disk
4
+ *
5
+ * Work items 8 and 11. Every regeneration must replay the symbols of the
6
+ * previous one, or the NodeIds change and every server and client bound to
7
+ * them breaks. A tool description alone does not make agents do that, so a
8
+ * generate call has to SAY what it is: an update (symbols passed back), a
9
+ * first generation (`mode: "new"`), or a deliberate renumbering. A call that
10
+ * says nothing is refused before it reaches the backend, with the reason.
11
+ *
12
+ * Each call is judged on its own arguments: nothing is remembered between
13
+ * calls, so the rule holds over stdio and hosted HTTP, and across restarts.
14
+ *
15
+ * The file helpers serve the stdio server only, which runs as the user next
16
+ * to their files: the agent passes a path and never carries the NodeSet2.
17
+ *
18
+ * IMPORTANT: Never use console.log() — stdout is reserved for JSON-RPC.
19
+ * ==========================================================================
20
+ */
21
+ export type SymbolsMode = "new" | "update" | "renumber";
22
+ export interface Hint {
23
+ code: string;
24
+ level: "info" | "warning";
25
+ message: string;
26
+ }
27
+ export interface Diagnostic {
28
+ severity: string;
29
+ code?: string;
30
+ message: string;
31
+ line?: number | null;
32
+ }
33
+ /** A previous generate returned the CSV base64-encoded; accept it as is, or as text. */
34
+ export declare function decodeSymbolsArg(value: string): string;
35
+ /** `name,id,nodeClass` lines, as `toCSV` writes them, to a name → id map. */
36
+ export declare function parseSymbols(csv: string): Map<string, number>;
37
+ /**
38
+ * A self-contained `.opcua.yaml` stream. Restated from
39
+ * `@sterfive/opcua-modeler-ex` (self_contained/stream.ts) rather than
40
+ * imported: this package depends on the MCP SDK and zod only.
41
+ */
42
+ export declare function isSelfContainedStream(text: string): boolean;
43
+ /** The stream carries its own symbol table, which the engine replays. */
44
+ export declare function hasEmbeddedSymbolTable(text: string): boolean;
45
+ /**
46
+ * The symbols CSV paired with a model file: `<name>.model.symbols.csv` next
47
+ * to `<name>.model.yaml`. Restated from `pairedSymbolsFile` in
48
+ * `@sterfive/opcua-modeler-ex` (self_contained/pack.ts); a test on each side
49
+ * pins the same names. Reading also accepts the older `<name>.symbols.csv`.
50
+ */
51
+ export declare function pairedSymbolsFile(modelFile: string, forWriting?: boolean): string;
52
+ /** The files `opcua-modeler generate <model>` writes, in `outputDir` or beside the model. */
53
+ export declare function outputFiles(modelFile: string, outputDir?: string): {
54
+ nodeset: string;
55
+ markdown: string;
56
+ symbols: string;
57
+ };
58
+ export type SymbolsSource = "argument" | "paired-file" | "stream" | "none";
59
+ export type SymbolsDecision = {
60
+ ok: true;
61
+ /** CSV text to replay, if any. */
62
+ send?: string;
63
+ /** What the new symbols are compared with: what was replayed, or replaced. */
64
+ previous?: string;
65
+ source: SymbolsSource;
66
+ } | {
67
+ ok: false;
68
+ code: string;
69
+ message: string;
70
+ };
71
+ export interface SymbolsInput {
72
+ mode?: SymbolsMode;
73
+ /** From the `symbols_csv` argument, decoded. */
74
+ symbolsCsv?: string;
75
+ /** The paired CSV found next to a model passed by path. */
76
+ pairedCsv?: {
77
+ path: string;
78
+ text: string;
79
+ };
80
+ /** Where the paired CSV would be, for the messages (path mode). */
81
+ expectedPairedPath?: string;
82
+ embeddedTable: boolean;
83
+ }
84
+ /** Decide what to replay, or refuse a call that does not say what it is. */
85
+ export declare function decideSymbols(input: SymbolsInput): SymbolsDecision;
86
+ export interface SymbolsReport {
87
+ /** Same name, same id. */
88
+ reused: number;
89
+ /** Not in the previous symbols. */
90
+ new: number;
91
+ /** In the previous symbols, gone from the model: those ids are retired. */
92
+ dropped: number;
93
+ /** Same name, another id: only on a renumbering, or a wrong CSV. */
94
+ renumbered: number;
95
+ /** Share of the previous names the model still has. */
96
+ match: number;
97
+ new_names: string[];
98
+ dropped_names: string[];
99
+ }
100
+ export declare function compareSymbols(previousCsv: string, nextCsv: string): SymbolsReport;
101
+ export interface FileWritten {
102
+ role: "nodeset" | "symbols" | "documentation";
103
+ path: string;
104
+ bytes: number;
105
+ status: "written" | "unchanged";
106
+ }
107
+ export interface HintContext {
108
+ valid: boolean;
109
+ mode?: SymbolsMode;
110
+ source: SymbolsSource;
111
+ report?: SymbolsReport;
112
+ diagnostics: Diagnostic[];
113
+ /** Path mode: what was written. Absent in text mode. */
114
+ files?: FileWritten[];
115
+ /** Show PREFER_STREAM (once per session). */
116
+ suggestStream: boolean;
117
+ }
118
+ /**
119
+ * Hints are generated by code from fixed conditions, with stable codes: they
120
+ * can be tested and never invent advice. Ranked, and few — a long list is
121
+ * skipped like a long tool description.
122
+ */
123
+ export declare function buildHints(ctx: HintContext): {
124
+ hints: Hint[];
125
+ next_steps: string[];
126
+ };
127
+ /**
128
+ * Write `content` unless the file already holds exactly it. Unchanged files
129
+ * are not touched, so git, file watchers and the VS Code extension see
130
+ * nothing when a regeneration changes nothing. The write is atomic: a temp
131
+ * file in the same folder, then a rename, so a crash never leaves half a
132
+ * NodeSet.
133
+ */
134
+ export declare function writeIfChanged(file: string, content: Buffer): Promise<"written" | "unchanged">;
@@ -0,0 +1,289 @@
1
+ /**
2
+ * ==========================================================================
3
+ * OPC UA Modeler — generate: NodeId stability and files on disk
4
+ *
5
+ * Work items 8 and 11. Every regeneration must replay the symbols of the
6
+ * previous one, or the NodeIds change and every server and client bound to
7
+ * them breaks. A tool description alone does not make agents do that, so a
8
+ * generate call has to SAY what it is: an update (symbols passed back), a
9
+ * first generation (`mode: "new"`), or a deliberate renumbering. A call that
10
+ * says nothing is refused before it reaches the backend, with the reason.
11
+ *
12
+ * Each call is judged on its own arguments: nothing is remembered between
13
+ * calls, so the rule holds over stdio and hosted HTTP, and across restarts.
14
+ *
15
+ * The file helpers serve the stdio server only, which runs as the user next
16
+ * to their files: the agent passes a path and never carries the NodeSet2.
17
+ *
18
+ * IMPORTANT: Never use console.log() — stdout is reserved for JSON-RPC.
19
+ * ==========================================================================
20
+ */
21
+ import fs from "node:fs";
22
+ import path from "node:path";
23
+ // ── Symbols input ─────────────────────────────────────────────────────────
24
+ /** A previous generate returned the CSV base64-encoded; accept it as is, or as text. */
25
+ export function decodeSymbolsArg(value) {
26
+ // every CSV line holds two commas; base64 never holds one
27
+ return value.includes(",") ? value : Buffer.from(value, "base64").toString("utf-8");
28
+ }
29
+ /** `name,id,nodeClass` lines, as `toCSV` writes them, to a name → id map. */
30
+ export function parseSymbols(csv) {
31
+ const out = new Map();
32
+ for (const line of csv.trim().split(/\r?\n/)) {
33
+ const [name, id] = line.split(",");
34
+ if (name && id !== undefined)
35
+ out.set(name, Number.parseInt(id, 10));
36
+ }
37
+ return out;
38
+ }
39
+ /**
40
+ * A self-contained `.opcua.yaml` stream. Restated from
41
+ * `@sterfive/opcua-modeler-ex` (self_contained/stream.ts) rather than
42
+ * imported: this package depends on the MCP SDK and zod only.
43
+ */
44
+ export function isSelfContainedStream(text) {
45
+ return /^kind:\s*(symbols|declarations|model)\s*$/m.test(text);
46
+ }
47
+ /** The stream carries its own symbol table, which the engine replays. */
48
+ export function hasEmbeddedSymbolTable(text) {
49
+ return /^kind:\s*symbols\s*$/m.test(text);
50
+ }
51
+ /**
52
+ * The symbols CSV paired with a model file: `<name>.model.symbols.csv` next
53
+ * to `<name>.model.yaml`. Restated from `pairedSymbolsFile` in
54
+ * `@sterfive/opcua-modeler-ex` (self_contained/pack.ts); a test on each side
55
+ * pins the same names. Reading also accepts the older `<name>.symbols.csv`.
56
+ */
57
+ export function pairedSymbolsFile(modelFile, forWriting = false) {
58
+ const parsed = path.parse(modelFile);
59
+ const generateForm = path.join(parsed.dir, `${parsed.name.replace(/\.opcua$/, ".model")}.symbols.csv`);
60
+ if (forWriting)
61
+ return generateForm;
62
+ const shortForm = path.join(parsed.dir, `${parsed.name.replace(/\.model$/, "").replace(/\.opcua$/, "")}.symbols.csv`);
63
+ return fs.existsSync(generateForm) || !fs.existsSync(shortForm) ? generateForm : shortForm;
64
+ }
65
+ /** The files `opcua-modeler generate <model>` writes, in `outputDir` or beside the model. */
66
+ export function outputFiles(modelFile, outputDir) {
67
+ const parsed = path.parse(modelFile);
68
+ const dir = outputDir ?? parsed.dir;
69
+ return {
70
+ nodeset: path.join(dir, `${parsed.name}.Nodeset2.xml`),
71
+ markdown: path.join(dir, `${parsed.name}.md`),
72
+ symbols: path.join(dir, path.basename(pairedSymbolsFile(modelFile, true)))
73
+ };
74
+ }
75
+ /** Decide what to replay, or refuse a call that does not say what it is. */
76
+ export function decideSymbols(input) {
77
+ const { mode, symbolsCsv, pairedCsv, embeddedTable } = input;
78
+ const previous = symbolsCsv ?? pairedCsv?.text;
79
+ const source = symbolsCsv !== undefined ? "argument" : pairedCsv ? "paired-file" : "none";
80
+ const csvName = input.expectedPairedPath ? path.basename(input.expectedPairedPath) : "<name>.model.symbols.csv";
81
+ if (mode === "renumber") {
82
+ return { ok: true, previous, source: embeddedTable ? "stream" : source };
83
+ }
84
+ if (mode === "new") {
85
+ if (symbolsCsv !== undefined) {
86
+ return {
87
+ ok: false,
88
+ code: "MODE_CONFLICT",
89
+ message: 'mode "new" is for a model generated for the first time, but symbols_csv was passed. Drop mode to replay them, or pass mode "renumber" to allocate new ids on purpose.'
90
+ };
91
+ }
92
+ if (pairedCsv) {
93
+ return {
94
+ ok: false,
95
+ code: "SYMBOLS_FILE_EXISTS",
96
+ message: `${pairedCsv.path} exists: this model was generated before. Drop mode to keep its NodeIds (the file is read automatically), or pass mode "renumber" to allocate new ids on purpose.`
97
+ };
98
+ }
99
+ if (embeddedTable) {
100
+ return {
101
+ ok: false,
102
+ code: "MODE_CONFLICT",
103
+ message: 'This self-contained stream carries a symbol table: the model was generated before. Drop mode to keep its NodeIds, or pass mode "renumber".'
104
+ };
105
+ }
106
+ return { ok: true, source: "none" };
107
+ }
108
+ if (previous !== undefined)
109
+ return { ok: true, send: previous, previous, source };
110
+ if (embeddedTable)
111
+ return { ok: true, source: "stream" };
112
+ if (mode === "update") {
113
+ return {
114
+ ok: false,
115
+ code: "SYMBOLS_REQUIRED",
116
+ message: `mode "update" needs the symbols of the previous generation: pass them as symbols_csv (the content of ${csvName}).`
117
+ };
118
+ }
119
+ return {
120
+ ok: false,
121
+ code: "SYMBOLS_DECISION_REQUIRED",
122
+ message: [
123
+ "NodeIds only stay stable if you pass back the symbols CSV from the previous generation. Retry with one of:",
124
+ `- generated before: symbols_csv (the content of ${csvName});`,
125
+ '- first generation: mode: "new";',
126
+ '- renumbering on purpose: mode: "renumber".'
127
+ ].join("\n")
128
+ };
129
+ }
130
+ // ── What changed ──────────────────────────────────────────────────────────
131
+ const NAMES_SHOWN = 10;
132
+ export function compareSymbols(previousCsv, nextCsv) {
133
+ const before = parseSymbols(previousCsv);
134
+ const after = parseSymbols(nextCsv);
135
+ let reused = 0;
136
+ let renumbered = 0;
137
+ const newNames = [];
138
+ for (const [name, id] of after) {
139
+ const old = before.get(name);
140
+ if (old === undefined)
141
+ newNames.push(name);
142
+ else if (old === id)
143
+ reused++;
144
+ else
145
+ renumbered++;
146
+ }
147
+ const droppedNames = [...before.keys()].filter((name) => !after.has(name));
148
+ return {
149
+ reused,
150
+ new: newNames.length,
151
+ dropped: droppedNames.length,
152
+ renumbered,
153
+ match: before.size === 0 ? 1 : Math.round(((reused + renumbered) / before.size) * 100) / 100,
154
+ new_names: newNames.slice(0, NAMES_SHOWN),
155
+ dropped_names: droppedNames.slice(0, NAMES_SHOWN)
156
+ };
157
+ }
158
+ // ── Hints and next steps ──────────────────────────────────────────────────
159
+ const MAX_HINTS = 5;
160
+ /** Below this share of known names, the CSV most likely belongs to another model. */
161
+ const LOW_MATCH = 0.5;
162
+ const list = (names, total) => names.join(", ") + (total > names.length ? `, … (${total} in all)` : "");
163
+ /**
164
+ * Hints are generated by code from fixed conditions, with stable codes: they
165
+ * can be tested and never invent advice. Ranked, and few — a long list is
166
+ * skipped like a long tool description.
167
+ */
168
+ export function buildHints(ctx) {
169
+ const ranked = [];
170
+ const { report, files } = ctx;
171
+ const symbolsFile = files?.find((f) => f.role === "symbols");
172
+ if (!ctx.valid) {
173
+ const errors = ctx.diagnostics.filter((d) => d.severity === "error").length;
174
+ ranked.push({
175
+ code: "INVALID",
176
+ level: "warning",
177
+ message: `The model has ${errors} error(s): no artefact was ${files ? "written" : "produced"}. Fix them (opcua_model_validate gives line numbers), then generate again.`
178
+ });
179
+ return { hints: ranked, next_steps: ["Fix the errors listed in diagnostics, then call opcua_model_generate again."] };
180
+ }
181
+ if (report && report.renumbered > 0) {
182
+ ranked.push({
183
+ code: "IDS_RENUMBERED",
184
+ level: "warning",
185
+ message: ctx.mode === "renumber"
186
+ ? `${report.renumbered} existing node(s) got a new NodeId, as requested: servers and clients bound to the old ids will break.`
187
+ : `${report.renumbered} node(s) changed NodeId although their symbols were passed: the CSV probably belongs to another model.`
188
+ });
189
+ }
190
+ if (report && report.dropped > 0) {
191
+ ranked.push({
192
+ code: "IDS_DROPPED",
193
+ level: "warning",
194
+ message: `${report.dropped} NodeId(s) retired, their nodes are gone from the model: ${list(report.dropped_names, report.dropped)}. Clients bound to them will break.`
195
+ });
196
+ }
197
+ if (report && ctx.mode !== "renumber" && report.match < LOW_MATCH) {
198
+ ranked.push({
199
+ code: "SYMBOLS_LOW_MATCH",
200
+ level: "warning",
201
+ message: `Only ${Math.round(report.match * 100)}% of the names in the symbols passed exist in this model: they probably belong to another model.`
202
+ });
203
+ }
204
+ if (ctx.source === "none" || ctx.mode === "renumber") {
205
+ ranked.push({
206
+ code: "SAVE_SYMBOLS",
207
+ level: "info",
208
+ message: symbolsFile
209
+ ? `Wrote ${symbolsFile.path}: commit it with the model. Later generates read it from there and keep these NodeIds.`
210
+ : "Save symbols_csv (base64-decoded) as <name>.model.symbols.csv next to the model and commit it. Pass it back as symbols_csv on every later generate, or the NodeIds change."
211
+ });
212
+ }
213
+ else if (report && (report.new > 0 || report.dropped > 0)) {
214
+ ranked.push({
215
+ code: "SYMBOLS_UPDATED",
216
+ level: "info",
217
+ message: symbolsFile
218
+ ? `${symbolsFile.path} updated: ${report.new} new id(s)${report.new ? ` (${list(report.new_names, report.new)})` : ""}.`
219
+ : `The symbols changed: ${report.new} new id(s)${report.new ? ` (${list(report.new_names, report.new)})` : ""}. Write symbols_csv back to the file it came from.`
220
+ });
221
+ }
222
+ if (ctx.source === "stream") {
223
+ ranked.push({
224
+ code: "STREAM_TABLE_NOT_UPDATED",
225
+ level: "info",
226
+ message: "This tool does not rewrite the symbol table embedded in the stream. If the model gained nodes, run `opcua-modeler generate <file>` once to record their ids in it."
227
+ });
228
+ }
229
+ const warnings = ctx.diagnostics.filter((d) => d.severity === "warning");
230
+ if (warnings.length > 0) {
231
+ const top = warnings
232
+ .slice(0, 3)
233
+ .map((d) => `${d.code ?? "warning"}${d.line ? ` line ${d.line}` : ""}`)
234
+ .join(", ");
235
+ ranked.push({
236
+ code: "WARNINGS_PRESENT",
237
+ level: "warning",
238
+ message: `${warnings.length} warning(s) (${top}). Fix them before publishing the NodeSet.`
239
+ });
240
+ }
241
+ if (ctx.suggestStream && ctx.source === "argument") {
242
+ ranked.push({
243
+ code: "PREFER_STREAM",
244
+ level: "info",
245
+ message: "Passing the model by path (model_path) or as a self-contained .opcua.yaml stream removes the need to carry symbols_csv between calls."
246
+ });
247
+ }
248
+ const next_steps = [];
249
+ if (files) {
250
+ const written = files.filter((f) => f.status === "written");
251
+ next_steps.push(written.length > 0
252
+ ? `Commit ${written.map((f) => path.basename(f.path)).join(", ")} with the model.`
253
+ : "Nothing changed on disk: the generated files were already up to date.");
254
+ }
255
+ else {
256
+ next_steps.push("Save nodeset2_xml (base64-decoded) as <name>.Nodeset2.xml.", "Save symbols_csv (base64-decoded) as <name>.model.symbols.csv, replacing the previous one.", "Commit both with the model: the CSV is what keeps NodeIds stable.");
257
+ }
258
+ return { hints: ranked.slice(0, MAX_HINTS), next_steps };
259
+ }
260
+ // ── Files ─────────────────────────────────────────────────────────────────
261
+ /**
262
+ * Write `content` unless the file already holds exactly it. Unchanged files
263
+ * are not touched, so git, file watchers and the VS Code extension see
264
+ * nothing when a regeneration changes nothing. The write is atomic: a temp
265
+ * file in the same folder, then a rename, so a crash never leaves half a
266
+ * NodeSet.
267
+ */
268
+ export async function writeIfChanged(file, content) {
269
+ try {
270
+ const existing = await fs.promises.readFile(file);
271
+ if (existing.equals(content))
272
+ return "unchanged";
273
+ }
274
+ catch {
275
+ // absent: write it
276
+ }
277
+ await fs.promises.mkdir(path.dirname(file), { recursive: true });
278
+ const temp = `${file}.${process.pid}.${Date.now()}.tmp`;
279
+ try {
280
+ await fs.promises.writeFile(temp, content);
281
+ await fs.promises.rename(temp, file);
282
+ }
283
+ catch (err) {
284
+ await fs.promises.rm(temp, { force: true });
285
+ throw err;
286
+ }
287
+ return "written";
288
+ }
289
+ //# sourceMappingURL=generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.js","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAiB7B,6EAA6E;AAE7E,wFAAwF;AACxF,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,0DAA0D;IAC1D,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACtF,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAC;IACtC,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7C,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,IAAI,IAAI,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CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACjE,MAAM,IAAI,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC;IACxD,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC3C,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACvC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5C,MAAM,GAAG,CAAC;IACZ,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
package/dist/index.js CHANGED
@@ -13,7 +13,8 @@
13
13
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
14
14
  import { createServer } from "./server.js";
15
15
  async function main() {
16
- const server = createServer();
16
+ // stdio runs as the user, on their machine: generate and reverse may use their files
17
+ const server = createServer({ fileAccess: true });
17
18
  const transport = new StdioServerTransport();
18
19
  await server.connect(transport);
19
20
  console.error("opcua-modeler MCP server running on stdio");
package/dist/index.js.map CHANGED
@@ -1 +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"}
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,qFAAqF;IACrF,MAAM,MAAM,GAAG,YAAY,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,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/local.d.ts CHANGED
@@ -71,4 +71,4 @@ export declare function readLocalEndpoint(env?: NodeJS.ProcessEnv): {
71
71
  * 422, the JSON/text error parsing — is the SAME code for both backends. Two
72
72
  * copies of that logic is exactly the drift this whole design avoids.
73
73
  */
74
- export declare function localFetch(endpoint: LocalEndpoint, apiPath: string, body: string, contentType: string, method: "GET" | "POST", timeoutMs: number): Promise<Response>;
74
+ export declare function localFetch(endpoint: LocalEndpoint, apiPath: string, body: string, contentType: string, method: "GET" | "POST", timeoutMs: number, extraHeaders?: Record<string, string>): Promise<Response>;
package/dist/local.js CHANGED
@@ -117,9 +117,10 @@ export function readLocalEndpoint(env = process.env) {
117
117
  * 422, the JSON/text error parsing — is the SAME code for both backends. Two
118
118
  * copies of that logic is exactly the drift this whole design avoids.
119
119
  */
120
- export function localFetch(endpoint, apiPath, body, contentType, method, timeoutMs) {
120
+ export function localFetch(endpoint, apiPath, body, contentType, method, timeoutMs, extraHeaders = {}) {
121
121
  return new Promise((resolve, reject) => {
122
122
  const headers = {
123
+ ...extraHeaders,
123
124
  Accept: "application/json",
124
125
  Authorization: `Bearer ${endpoint.token}`
125
126
  };
package/dist/local.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"local.js","sourceRoot":"","sources":["../src/local.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAyB,OAAO,CAAC,GAAG;IACpE,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,eAAe,EAAE,YAAY,CAAC,CAAC;IACpF,CAAC;IACD,IAAI,GAAG,CAAC,eAAe,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,eAAe,EAAE,YAAY,CAAC,CAAC;IACvE,CAAC;IACD,IAAI,IAAI,GAAG,MAAM,CAAC;IAClB,IAAI,CAAC;QACH,IAAI,GAAG,EAAE,CAAC,QAAQ,EAAE,C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known.
31
31
  */
32
32
  export declare function handleToolCall(name: ToolName, args: Record<string, unknown>): Promise<ToolResult>;
33
+ export interface ServerOptions {
34
+ /**
35
+ * Let generate and reverse read and write the user's files by path. Only
36
+ * the stdio entry point turns this on: it runs as the user, on their
37
+ * machine. The hosted connector (http.ts) must not — a path there would
38
+ * name a file on OUR server, and the connector directory requires every
39
+ * tool to be read-only.
40
+ */
41
+ fileAccess?: boolean;
42
+ }
33
43
  /**
34
44
  * Create and configure the MCP server with all OPC UA tools registered.
35
45
  * The server is NOT connected to any transport — the caller is responsible
36
46
  * for connecting it (e.g., StdioServerTransport or InMemoryTransport).
37
47
  */
38
- export declare function createServer(): McpServer;
48
+ export declare function createServer(options?: ServerOptions): McpServer;