@voltro/mcp 0.32.0 → 0.34.0
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/CHANGELOG.md +2006 -0
- package/dist/http-BGeW8WkP.js +104 -0
- package/dist/httpServer.js +3 -3
- package/dist/index.d.ts +207 -5
- package/dist/index.js +3 -3
- package/dist/mcp-CZJe2Frv.js +542 -0
- package/dist/serve-ZSmqUcRM.js +47 -0
- package/dist/server.js +1 -1
- package/package.json +3 -2
- package/dist/http-CtkNxu9A.js +0 -103
- package/dist/mcp-DrI72Mwz.js +0 -338
- package/dist/serve-CRW_Na4H.js +0 -47
package/dist/http-CtkNxu9A.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { i as e } from "./mcp-DrI72Mwz.js";
|
|
2
|
-
import { randomUUID as t } from "node:crypto";
|
|
3
|
-
//#region src/http.ts
|
|
4
|
-
var n = "mcp-session-id", r = "application/json", i = "text/event-stream", a = (e) => e.some((e) => e.method === "initialize"), o = (r) => {
|
|
5
|
-
let i = r.newSessionId ?? t;
|
|
6
|
-
if (r.method === "DELETE") return {
|
|
7
|
-
kind: "empty",
|
|
8
|
-
status: 204
|
|
9
|
-
};
|
|
10
|
-
if (r.method === "GET") return r.acceptsSse ? {
|
|
11
|
-
kind: "sse",
|
|
12
|
-
events: [],
|
|
13
|
-
keepOpen: !0
|
|
14
|
-
} : {
|
|
15
|
-
kind: "json",
|
|
16
|
-
status: 405,
|
|
17
|
-
body: c(null, "GET requires Accept: text/event-stream")
|
|
18
|
-
};
|
|
19
|
-
if (r.method !== "POST") return {
|
|
20
|
-
kind: "json",
|
|
21
|
-
status: 405,
|
|
22
|
-
body: c(null, `method ${r.method} not allowed`)
|
|
23
|
-
};
|
|
24
|
-
if (r.body === void 0 || r.body === null) return {
|
|
25
|
-
kind: "json",
|
|
26
|
-
status: 400,
|
|
27
|
-
body: s("empty POST body")
|
|
28
|
-
};
|
|
29
|
-
let o = Array.isArray(r.body) ? r.body : [r.body], l = a(o), u = r.headers[n];
|
|
30
|
-
if (!l && u === void 0) return {
|
|
31
|
-
kind: "json",
|
|
32
|
-
status: 400,
|
|
33
|
-
body: s("missing Mcp-Session-Id header")
|
|
34
|
-
};
|
|
35
|
-
let d = l ? u ?? i() : u, f = o.map((t) => e(r.snapshot, t, r.serverInfo)).filter((e) => e !== null);
|
|
36
|
-
return f.length === 0 ? {
|
|
37
|
-
kind: "empty",
|
|
38
|
-
status: 202
|
|
39
|
-
} : r.acceptsSse ? {
|
|
40
|
-
kind: "sse",
|
|
41
|
-
events: f,
|
|
42
|
-
keepOpen: !1,
|
|
43
|
-
...d === void 0 ? {} : { sessionId: d }
|
|
44
|
-
} : {
|
|
45
|
-
kind: "json",
|
|
46
|
-
status: 200,
|
|
47
|
-
body: f.length === 1 ? f[0] : f,
|
|
48
|
-
...d === void 0 ? {} : { sessionId: d }
|
|
49
|
-
};
|
|
50
|
-
}, s = (e) => ({
|
|
51
|
-
jsonrpc: "2.0",
|
|
52
|
-
id: null,
|
|
53
|
-
error: {
|
|
54
|
-
code: -32700,
|
|
55
|
-
message: e
|
|
56
|
-
}
|
|
57
|
-
}), c = (e, t) => ({
|
|
58
|
-
jsonrpc: "2.0",
|
|
59
|
-
id: e,
|
|
60
|
-
error: {
|
|
61
|
-
code: -32601,
|
|
62
|
-
message: t
|
|
63
|
-
}
|
|
64
|
-
}), l = (e) => `event: message\ndata: ${JSON.stringify(e)}\n\n`, u = (e) => e !== void 0 && e.split(",").some((e) => e.trim().startsWith(i)), d = async (e) => {
|
|
65
|
-
let t = "";
|
|
66
|
-
for await (let n of e) t += String(n);
|
|
67
|
-
if (t.trim() !== "") try {
|
|
68
|
-
return JSON.parse(t);
|
|
69
|
-
} catch {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
}, f = (e) => async (t, a) => {
|
|
73
|
-
let s = t.method ?? "GET", c = s === "POST" ? await d(t) : void 0, f = await e.source.get(), p = {};
|
|
74
|
-
for (let [e, n] of Object.entries(t.headers)) p[e.toLowerCase()] = Array.isArray(n) ? n[0] : n;
|
|
75
|
-
let m = o({
|
|
76
|
-
method: s,
|
|
77
|
-
headers: p,
|
|
78
|
-
body: c,
|
|
79
|
-
snapshot: f,
|
|
80
|
-
serverInfo: e.serverInfo,
|
|
81
|
-
acceptsSse: u(p.accept),
|
|
82
|
-
...e.newSessionId === void 0 ? {} : { newSessionId: e.newSessionId }
|
|
83
|
-
});
|
|
84
|
-
if (m.kind === "empty") {
|
|
85
|
-
a.writeHead(m.status), a.end();
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
if (m.kind === "json") {
|
|
89
|
-
let e = { "content-type": r };
|
|
90
|
-
m.sessionId !== void 0 && (e[n] = m.sessionId), a.writeHead(m.status, e), a.end(JSON.stringify(m.body));
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
let h = {
|
|
94
|
-
"content-type": i,
|
|
95
|
-
"cache-control": "no-cache",
|
|
96
|
-
connection: "keep-alive"
|
|
97
|
-
};
|
|
98
|
-
m.sessionId !== void 0 && (h[n] = m.sessionId), a.writeHead(200, h);
|
|
99
|
-
for (let e of m.events) a.write(l(e));
|
|
100
|
-
m.keepOpen || a.end();
|
|
101
|
-
};
|
|
102
|
-
//#endregion
|
|
103
|
-
export { o as n, l as r, f as t };
|
package/dist/mcp-DrI72Mwz.js
DELETED
|
@@ -1,338 +0,0 @@
|
|
|
1
|
-
//#region src/manifest.ts
|
|
2
|
-
var e = {
|
|
3
|
-
version: 2,
|
|
4
|
-
procedures: [],
|
|
5
|
-
workflows: [],
|
|
6
|
-
widgets: [],
|
|
7
|
-
tables: [],
|
|
8
|
-
scopes: []
|
|
9
|
-
}, t = async (e, t, n = 5e3) => {
|
|
10
|
-
let r = new URL("/_voltro/inspect/manifest", e), i = await fetch(r, {
|
|
11
|
-
headers: t === void 0 ? {} : { authorization: `Bearer ${t}` },
|
|
12
|
-
signal: AbortSignal.timeout(n)
|
|
13
|
-
});
|
|
14
|
-
if (!i.ok) throw Error(`manifest fetch failed: HTTP ${i.status}`);
|
|
15
|
-
return await i.json();
|
|
16
|
-
}, n = (n) => {
|
|
17
|
-
let r = n.ttlMs ?? 1e4, i = n.now ?? Date.now, a, o = -Infinity;
|
|
18
|
-
return { get: async () => {
|
|
19
|
-
if (a !== void 0 && i() - o < r) return a;
|
|
20
|
-
try {
|
|
21
|
-
a = { manifest: await t(n.baseUrl, n.token) };
|
|
22
|
-
} catch (t) {
|
|
23
|
-
a = {
|
|
24
|
-
manifest: a?.manifest ?? e,
|
|
25
|
-
error: String(t)
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
return o = i(), a;
|
|
29
|
-
} };
|
|
30
|
-
}, r = {
|
|
31
|
-
type: "object",
|
|
32
|
-
properties: {},
|
|
33
|
-
additionalProperties: !1
|
|
34
|
-
}, i = [
|
|
35
|
-
{
|
|
36
|
-
name: "voltro_list_procedures",
|
|
37
|
-
description: "List every rpc procedure (queries, mutations, actions, streams) in the app with its kind. Markers: [public-rest] = also served as a public REST endpoint, [agent-tool] = exposed as an in-app agent tool. Use this to discover what the backend exposes before writing UI or agent code.",
|
|
38
|
-
inputSchema: r
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
name: "voltro_get_procedure",
|
|
42
|
-
description: "Get one procedure's full metadata by its tag (e.g. 'todos.create'): kind, input/output JSON Schema, source file(s), the tables it reads/writes (targets), and its public-REST / agent-tool projection when present. Use the input schema to drive a form / a tool call; the output schema to type the result.",
|
|
43
|
-
inputSchema: {
|
|
44
|
-
type: "object",
|
|
45
|
-
properties: { tag: {
|
|
46
|
-
type: "string",
|
|
47
|
-
description: "The rpc tag, e.g. \"todos.create\"."
|
|
48
|
-
} },
|
|
49
|
-
required: ["tag"],
|
|
50
|
-
additionalProperties: !1
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
name: "voltro_search_procedures",
|
|
55
|
-
description: "Find procedures whose tag contains the query substring (case-insensitive).",
|
|
56
|
-
inputSchema: {
|
|
57
|
-
type: "object",
|
|
58
|
-
properties: { query: { type: "string" } },
|
|
59
|
-
required: ["query"],
|
|
60
|
-
additionalProperties: !1
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
name: "voltro_list_tables",
|
|
65
|
-
description: "List the app's USER tables (framework-internal tables excluded) with column count and reactivity. Use voltro_get_table for the full column list of one table.",
|
|
66
|
-
inputSchema: r
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: "voltro_get_table",
|
|
70
|
-
description: "Get one table's full column list (name, type, nullability, foreign-key target, enum values) by table name.",
|
|
71
|
-
inputSchema: {
|
|
72
|
-
type: "object",
|
|
73
|
-
properties: { name: {
|
|
74
|
-
type: "string",
|
|
75
|
-
description: "The table name, e.g. \"todos\"."
|
|
76
|
-
} },
|
|
77
|
-
required: ["name"],
|
|
78
|
-
additionalProperties: !1
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
name: "voltro_list_workflows",
|
|
83
|
-
description: "List the durable workflows registered in the app.",
|
|
84
|
-
inputSchema: r
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
name: "voltro_list_widgets",
|
|
88
|
-
description: "List the schema-driven-UI widget kinds the app supports — the enumerable set a generated UI binds to.",
|
|
89
|
-
inputSchema: r
|
|
90
|
-
}
|
|
91
|
-
], a = (e) => {
|
|
92
|
-
let t = [...e.publicApi === void 0 ? [] : [" [public-rest]"], ...e.exposeAsTool === void 0 ? [] : [" [agent-tool]"]].join("");
|
|
93
|
-
return `${e.tag} (${e.kind})${t}`;
|
|
94
|
-
}, o = (e) => `${e.name} (${e.columns.length} column${e.columns.length === 1 ? "" : "s"}${e.reactive ? ", reactive" : ""})`, s = (e, t) => t.error === void 0 ? `(no ${e})` : `(no ${e} — manifest unavailable: ${t.error}. Is the api running at VOLTRO_INSPECT_URL, and is VOLTRO_INSPECT_TOKEN set if the inspect surface is gated?)`, c = (e, t, n) => {
|
|
95
|
-
let r = e.manifest;
|
|
96
|
-
switch (t) {
|
|
97
|
-
case "voltro_list_procedures": return r.procedures.length === 0 ? s("procedures", e) : r.procedures.map(a).join("\n");
|
|
98
|
-
case "voltro_get_procedure": {
|
|
99
|
-
let e = String(n.tag ?? ""), t = r.procedures.find((t) => t.tag === e);
|
|
100
|
-
return t === void 0 ? `No procedure with tag "${e}". Call voltro_list_procedures to see available tags.` : JSON.stringify({
|
|
101
|
-
tag: t.tag,
|
|
102
|
-
kind: t.kind,
|
|
103
|
-
input: t.input,
|
|
104
|
-
output: t.output,
|
|
105
|
-
...t.source === void 0 ? {} : { source: t.source },
|
|
106
|
-
...t.targets === void 0 ? {} : { targets: t.targets },
|
|
107
|
-
...t.publicApi === void 0 ? {} : { publicApi: t.publicApi },
|
|
108
|
-
...t.exposeAsTool === void 0 ? {} : { exposeAsTool: t.exposeAsTool }
|
|
109
|
-
}, null, 2);
|
|
110
|
-
}
|
|
111
|
-
case "voltro_search_procedures": {
|
|
112
|
-
let e = String(n.query ?? "").toLowerCase(), t = r.procedures.filter((t) => t.tag.toLowerCase().includes(e));
|
|
113
|
-
return t.length === 0 ? `(no procedures matching "${e}")` : t.map(a).join("\n");
|
|
114
|
-
}
|
|
115
|
-
case "voltro_list_tables": {
|
|
116
|
-
let t = r.tables ?? [];
|
|
117
|
-
return t.length === 0 ? s("tables", e) : t.map(o).join("\n");
|
|
118
|
-
}
|
|
119
|
-
case "voltro_get_table": {
|
|
120
|
-
let e = String(n.name ?? ""), t = (r.tables ?? []).find((t) => t.name === e);
|
|
121
|
-
return t === void 0 ? `No table named "${e}". Call voltro_list_tables to see available tables.` : JSON.stringify(t, null, 2);
|
|
122
|
-
}
|
|
123
|
-
case "voltro_list_workflows": return r.workflows.length === 0 ? s("workflows", e) : r.workflows.map((e) => e.name).join("\n");
|
|
124
|
-
case "voltro_list_widgets": {
|
|
125
|
-
let t = r.widgets ?? [];
|
|
126
|
-
return t.length === 0 ? s("widgets", e) : t.join("\n");
|
|
127
|
-
}
|
|
128
|
-
default: throw Error(`unknown tool: ${t}`);
|
|
129
|
-
}
|
|
130
|
-
}, l = "application/json", u = "voltro://manifest", d = (e) => `voltro://procedure/${e}`, f = (e) => `voltro://table/${e}`, p = (e) => {
|
|
131
|
-
let t = e.manifest;
|
|
132
|
-
return [
|
|
133
|
-
{
|
|
134
|
-
uri: u,
|
|
135
|
-
name: "Capability manifest",
|
|
136
|
-
description: "The full app capability manifest: every procedure, table, workflow and widget kind as JSON.",
|
|
137
|
-
mimeType: l
|
|
138
|
-
},
|
|
139
|
-
...t.procedures.map((e) => ({
|
|
140
|
-
uri: d(e.tag),
|
|
141
|
-
name: e.tag,
|
|
142
|
-
description: `The ${e.kind} "${e.tag}" — its input/output JSON Schema, source, and table targets.`,
|
|
143
|
-
mimeType: l
|
|
144
|
-
})),
|
|
145
|
-
...(t.tables ?? []).map((e) => ({
|
|
146
|
-
uri: f(e.name),
|
|
147
|
-
name: e.name,
|
|
148
|
-
description: `The "${e.name}" table — its full column list (types, nullability, foreign keys, enums).`,
|
|
149
|
-
mimeType: l
|
|
150
|
-
}))
|
|
151
|
-
];
|
|
152
|
-
}, m = class extends Error {
|
|
153
|
-
uri;
|
|
154
|
-
_tag = "UnknownResourceError";
|
|
155
|
-
constructor(e) {
|
|
156
|
-
super(`no resource at "${e}"`), this.uri = e, this.name = "UnknownResourceError";
|
|
157
|
-
}
|
|
158
|
-
}, h = (e, t) => {
|
|
159
|
-
let n = e.manifest, r = (e) => [{
|
|
160
|
-
uri: t,
|
|
161
|
-
mimeType: l,
|
|
162
|
-
text: JSON.stringify(e, null, 2)
|
|
163
|
-
}];
|
|
164
|
-
if (t === "voltro://manifest") return r(n);
|
|
165
|
-
let i = t.startsWith("voltro://procedure/") ? t.slice(19) : void 0;
|
|
166
|
-
if (i !== void 0) {
|
|
167
|
-
let e = n.procedures.find((e) => e.tag === i);
|
|
168
|
-
if (e === void 0) throw new m(t);
|
|
169
|
-
return r(e);
|
|
170
|
-
}
|
|
171
|
-
let a = t.startsWith("voltro://table/") ? t.slice(15) : void 0;
|
|
172
|
-
if (a !== void 0) {
|
|
173
|
-
let e = (n.tables ?? []).find((e) => e.name === a);
|
|
174
|
-
if (e === void 0) throw new m(t);
|
|
175
|
-
return r(e);
|
|
176
|
-
}
|
|
177
|
-
throw new m(t);
|
|
178
|
-
}, g = [
|
|
179
|
-
{
|
|
180
|
-
name: "scaffold_procedure",
|
|
181
|
-
description: "Draft a new Voltro rpc procedure (query/mutation/action) following the app's existing conventions, grounded in the current manifest so it references real tables and matches the shape of siblings.",
|
|
182
|
-
arguments: [{
|
|
183
|
-
name: "kind",
|
|
184
|
-
description: "query | mutation | action",
|
|
185
|
-
required: !0
|
|
186
|
-
}, {
|
|
187
|
-
name: "purpose",
|
|
188
|
-
description: "What the procedure should do, in one sentence.",
|
|
189
|
-
required: !0
|
|
190
|
-
}]
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
name: "explain_table",
|
|
194
|
-
description: "Explain one table's schema and how the app's procedures read/write it, from the live manifest.",
|
|
195
|
-
arguments: [{
|
|
196
|
-
name: "table",
|
|
197
|
-
description: "The table name, e.g. \"todos\".",
|
|
198
|
-
required: !0
|
|
199
|
-
}]
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
name: "wire_ui_for_procedure",
|
|
203
|
-
description: "Generate the client code to call one procedure and render its result, using the procedure's real input/output JSON Schema from the manifest.",
|
|
204
|
-
arguments: [{
|
|
205
|
-
name: "tag",
|
|
206
|
-
description: "The rpc tag, e.g. \"todos.list\".",
|
|
207
|
-
required: !0
|
|
208
|
-
}]
|
|
209
|
-
}
|
|
210
|
-
], _ = class extends Error {
|
|
211
|
-
promptName;
|
|
212
|
-
_tag = "UnknownPromptError";
|
|
213
|
-
constructor(e) {
|
|
214
|
-
super(`no prompt named "${e}"`), this.promptName = e, this.name = "UnknownPromptError";
|
|
215
|
-
}
|
|
216
|
-
}, v = class extends Error {
|
|
217
|
-
promptName;
|
|
218
|
-
argument;
|
|
219
|
-
_tag = "MissingPromptArgumentError";
|
|
220
|
-
constructor(e, t) {
|
|
221
|
-
super(`prompt "${e}" requires the "${t}" argument`), this.promptName = e, this.argument = t, this.name = "MissingPromptArgumentError";
|
|
222
|
-
}
|
|
223
|
-
}, y = () => g, b = (e) => ({
|
|
224
|
-
role: "user",
|
|
225
|
-
content: {
|
|
226
|
-
type: "text",
|
|
227
|
-
text: e
|
|
228
|
-
}
|
|
229
|
-
}), x = (e, t, n) => {
|
|
230
|
-
let r = t[n];
|
|
231
|
-
if (typeof r != "string" || r === "") throw new v(e, n);
|
|
232
|
-
return r;
|
|
233
|
-
}, S = (e, t, n = {}) => {
|
|
234
|
-
let r = e.manifest;
|
|
235
|
-
switch (t) {
|
|
236
|
-
case "scaffold_procedure": {
|
|
237
|
-
let e = x(t, n, "kind"), i = x(t, n, "purpose"), a = (r.tables ?? []).map((e) => e.name).join(", ") || "(none discovered)", o = r.procedures.filter((t) => t.kind === e).map((e) => e.tag).slice(0, 10).join(", ") || "(none yet)";
|
|
238
|
-
return {
|
|
239
|
-
description: `Scaffold a ${e} procedure`,
|
|
240
|
-
messages: [b(`Write a new Voltro ${e} procedure that: ${i}.\n\nThe app's tables are: ${a}.\nExisting ${e} procedures (match their file-convention and shape): ${o}.\n\nFollow the Voltro file conventions for a ${e} descriptor + its server handler, define the input/output with the schema DSL, and only reference tables that exist above.`)]
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
case "explain_table": {
|
|
244
|
-
let e = x(t, n, "table"), i = (r.tables ?? []).find((t) => t.name === e), a = r.procedures.filter((t) => (t.targets ?? []).some((t) => t.table === e)).map((t) => `${t.tag} (${(t.targets ?? []).filter((t) => t.table === e).map((e) => e.op).join("/")})`).join(", ") || "(none)", o = i === void 0 ? `(no table named "${e}" in the manifest)` : JSON.stringify(i, null, 2);
|
|
245
|
-
return {
|
|
246
|
-
description: `Explain the ${e} table`,
|
|
247
|
-
messages: [b(`Explain the "${e}" table of this Voltro app: its columns and their meaning, and how the app uses it.\n\nSchema:\n${o}\n\nProcedures touching it: ${a}.`)]
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
case "wire_ui_for_procedure": {
|
|
251
|
-
let e = x(t, n, "tag"), i = r.procedures.find((t) => t.tag === e), a = i === void 0 ? `(no procedure with tag "${e}" in the manifest)` : JSON.stringify({
|
|
252
|
-
tag: i.tag,
|
|
253
|
-
kind: i.kind,
|
|
254
|
-
input: i.input,
|
|
255
|
-
output: i.output
|
|
256
|
-
}, null, 2);
|
|
257
|
-
return {
|
|
258
|
-
description: `Wire UI for ${e}`,
|
|
259
|
-
messages: [b(`Write the Voltro client code to call the "${e}" procedure and render its result.\n\nProcedure:\n${a}\n\nUse the correct Voltro hook for this procedure kind, type the call from the input/output schema above, and render a minimal but complete UI for the result.`)]
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
default: throw new _(t);
|
|
263
|
-
}
|
|
264
|
-
}, C = "2025-06-18", w = [
|
|
265
|
-
C,
|
|
266
|
-
"2025-03-26",
|
|
267
|
-
"2024-11-05"
|
|
268
|
-
], T = {
|
|
269
|
-
name: "voltro-mcp",
|
|
270
|
-
version: "0.1.0"
|
|
271
|
-
}, E = (e) => typeof e == "string" && w.includes(e) ? e : C, D = (e, t, n = T) => {
|
|
272
|
-
if ((t.id === void 0 || t.id === null) && t.method.startsWith("notifications/")) return null;
|
|
273
|
-
let r = t.id ?? null, a = (e) => ({
|
|
274
|
-
jsonrpc: "2.0",
|
|
275
|
-
id: r,
|
|
276
|
-
result: e
|
|
277
|
-
}), o = (e, t) => ({
|
|
278
|
-
jsonrpc: "2.0",
|
|
279
|
-
id: r,
|
|
280
|
-
error: {
|
|
281
|
-
code: e,
|
|
282
|
-
message: t
|
|
283
|
-
}
|
|
284
|
-
});
|
|
285
|
-
switch (t.method) {
|
|
286
|
-
case "initialize": return a({
|
|
287
|
-
protocolVersion: E(t.params?.protocolVersion),
|
|
288
|
-
capabilities: {
|
|
289
|
-
tools: {},
|
|
290
|
-
resources: {},
|
|
291
|
-
prompts: {}
|
|
292
|
-
},
|
|
293
|
-
serverInfo: n
|
|
294
|
-
});
|
|
295
|
-
case "ping": return a({});
|
|
296
|
-
case "tools/list": return a({ tools: i });
|
|
297
|
-
case "tools/call": {
|
|
298
|
-
let n = t.params ?? {}, r = String(n.name ?? ""), i = n.arguments ?? {};
|
|
299
|
-
try {
|
|
300
|
-
return a({ content: [{
|
|
301
|
-
type: "text",
|
|
302
|
-
text: c(e, r, i)
|
|
303
|
-
}] });
|
|
304
|
-
} catch (e) {
|
|
305
|
-
return a({
|
|
306
|
-
content: [{
|
|
307
|
-
type: "text",
|
|
308
|
-
text: `Error: ${String(e)}`
|
|
309
|
-
}],
|
|
310
|
-
isError: !0
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
case "resources/list": return a({ resources: p(e) });
|
|
315
|
-
case "resources/read": {
|
|
316
|
-
let n = String(t.params?.uri ?? "");
|
|
317
|
-
try {
|
|
318
|
-
return a({ contents: h(e, n) });
|
|
319
|
-
} catch (e) {
|
|
320
|
-
if (e instanceof m) return o(-32602, e.message);
|
|
321
|
-
throw e;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
case "prompts/list": return a({ prompts: y() });
|
|
325
|
-
case "prompts/get": {
|
|
326
|
-
let n = String(t.params?.name ?? ""), r = t.params?.arguments ?? {};
|
|
327
|
-
try {
|
|
328
|
-
return a(S(e, n, r));
|
|
329
|
-
} catch (e) {
|
|
330
|
-
if (e instanceof _ || e instanceof v) return o(-32602, e.message);
|
|
331
|
-
throw e;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
default: return t.method.startsWith("notifications/") ? null : o(-32601, `method not found: ${t.method}`);
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
//#endregion
|
|
338
|
-
export { e as _, E as a, _ as c, u as d, m as f, c as g, i as h, D as i, S as l, h as m, T as n, v as o, p, w as r, g as s, C as t, y as u, n as v, t as y };
|
package/dist/serve-CRW_Na4H.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { i as e, n as t, v as n } from "./mcp-DrI72Mwz.js";
|
|
2
|
-
import { createRequire as r } from "node:module";
|
|
3
|
-
//#region src/serve.ts
|
|
4
|
-
var i = () => {
|
|
5
|
-
try {
|
|
6
|
-
let e = r(import.meta.url)("../package.json");
|
|
7
|
-
return {
|
|
8
|
-
name: t.name,
|
|
9
|
-
version: e.version ?? t.version
|
|
10
|
-
};
|
|
11
|
-
} catch {
|
|
12
|
-
return t;
|
|
13
|
-
}
|
|
14
|
-
}, a = async (t) => {
|
|
15
|
-
let r = t.env.VOLTRO_INSPECT_URL ?? "http://localhost:4000", a = t.env.VOLTRO_INSPECT_TOKEN, o = t.serverInfo ?? i(), s = n({
|
|
16
|
-
baseUrl: r,
|
|
17
|
-
...a === void 0 ? {} : { token: a },
|
|
18
|
-
...t.manifestTtlMs === void 0 ? {} : { ttlMs: t.manifestTtlMs }
|
|
19
|
-
}), c = await s.get();
|
|
20
|
-
c.error === void 0 ? t.errput.write(`voltro-mcp: loaded ${c.manifest.procedures.length} procedures from ${r}\n`) : t.errput.write(`voltro-mcp: could not fetch manifest from ${r}: ${c.error} — serving empty manifest\n`);
|
|
21
|
-
let l = async (n) => {
|
|
22
|
-
if (n === "") return;
|
|
23
|
-
let r;
|
|
24
|
-
try {
|
|
25
|
-
r = JSON.parse(n);
|
|
26
|
-
} catch {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
let i = Array.isArray(r) ? r : [r];
|
|
30
|
-
for (let n of i) {
|
|
31
|
-
(n.method === "tools/call" || n.method === "tools/list") && (c = await s.get());
|
|
32
|
-
let r = e(c, n, o);
|
|
33
|
-
r !== null && t.output.write(`${JSON.stringify(r)}\n`);
|
|
34
|
-
}
|
|
35
|
-
}, u = "";
|
|
36
|
-
for await (let e of t.input) {
|
|
37
|
-
u += String(e);
|
|
38
|
-
let t = u.indexOf("\n");
|
|
39
|
-
for (; t !== -1;) {
|
|
40
|
-
let e = u.slice(0, t).trim();
|
|
41
|
-
u = u.slice(t + 1), await l(e), t = u.indexOf("\n");
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
await l(u.trim());
|
|
45
|
-
};
|
|
46
|
-
//#endregion
|
|
47
|
-
export { a as n, i as t };
|