localmcp-cli 0.0.0-stage → 0.0.11
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/LICENSE +21 -0
- package/README.md +104 -2
- package/bin/cli.js +27 -0
- package/package.json +28 -4
- package/src/agents/hub.js +663 -0
- package/src/agents/providers.js +840 -0
- package/src/agents/store.js +524 -0
- package/src/cli/options.js +177 -0
- package/src/cli/runtime.js +126 -0
- package/src/cli/service.js +29 -0
- package/src/cli/tunnel.js +242 -0
- package/src/core/audit.js +105 -0
- package/src/core/auth.js +326 -0
- package/src/core/bounded-log.js +39 -0
- package/src/core/config.js +319 -0
- package/src/core/context-discovery.js +245 -0
- package/src/core/mesh.js +103 -0
- package/src/core/protocol.js +112 -0
- package/src/core/updater-client.js +165 -0
- package/src/server.js +260 -0
- package/src/tools/agents.js +149 -0
- package/src/tools/apply-patch.js +454 -0
- package/src/tools/diagnostics.js +158 -0
- package/src/tools/filesystem.js +1122 -0
- package/src/tools/gui-windows.js +268 -0
- package/src/tools/registry.js +119 -0
- package/src/tools/system.js +591 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { CONTROL_SECURITY_SCHEMES, okResult, toolMeta } from "../core/protocol.js";
|
|
2
|
+
import { runPowerShell } from "./system.js";
|
|
3
|
+
|
|
4
|
+
const VK_MAP = new Map(
|
|
5
|
+
Object.entries({
|
|
6
|
+
BACKSPACE: 0x08,
|
|
7
|
+
TAB: 0x09,
|
|
8
|
+
ENTER: 0x0d,
|
|
9
|
+
RETURN: 0x0d,
|
|
10
|
+
SHIFT: 0x10,
|
|
11
|
+
CTRL: 0x11,
|
|
12
|
+
CONTROL: 0x11,
|
|
13
|
+
ALT: 0x12,
|
|
14
|
+
PAUSE: 0x13,
|
|
15
|
+
CAPSLOCK: 0x14,
|
|
16
|
+
CAPS_LOCK: 0x14,
|
|
17
|
+
ESC: 0x1b,
|
|
18
|
+
ESCAPE: 0x1b,
|
|
19
|
+
SPACE: 0x20,
|
|
20
|
+
PAGEUP: 0x21,
|
|
21
|
+
PAGE_UP: 0x21,
|
|
22
|
+
PAGEDOWN: 0x22,
|
|
23
|
+
PAGE_DOWN: 0x22,
|
|
24
|
+
END: 0x23,
|
|
25
|
+
HOME: 0x24,
|
|
26
|
+
LEFT: 0x25,
|
|
27
|
+
UP: 0x26,
|
|
28
|
+
RIGHT: 0x27,
|
|
29
|
+
DOWN: 0x28,
|
|
30
|
+
PRINTSCREEN: 0x2c,
|
|
31
|
+
PRINT_SCREEN: 0x2c,
|
|
32
|
+
INSERT: 0x2d,
|
|
33
|
+
INS: 0x2d,
|
|
34
|
+
DELETE: 0x2e,
|
|
35
|
+
DEL: 0x2e,
|
|
36
|
+
WIN: 0x5b,
|
|
37
|
+
WINDOWS: 0x5b,
|
|
38
|
+
META: 0x5b,
|
|
39
|
+
COMMAND: 0x5b,
|
|
40
|
+
NUMLOCK: 0x90,
|
|
41
|
+
NUM_LOCK: 0x90,
|
|
42
|
+
SCROLLLOCK: 0x91,
|
|
43
|
+
SCROLL_LOCK: 0x91,
|
|
44
|
+
})
|
|
45
|
+
);
|
|
46
|
+
for (let i = 1; i <= 24; i += 1) {
|
|
47
|
+
VK_MAP.set(`F${i}`, 0x6f + i);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function resolveVirtualKey(key) {
|
|
51
|
+
const norm = String(key || "").trim().toUpperCase().replace(/\s+/g, "_");
|
|
52
|
+
if (/^[A-Z0-9]$/.test(norm)) return norm.charCodeAt(0);
|
|
53
|
+
if (VK_MAP.has(norm)) return VK_MAP.get(norm);
|
|
54
|
+
throw new Error(`Unsupported Windows key "${key}". Use names like CTRL, ALT, WIN, ENTER, ESC, A, 1, or F5.`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function createWindowsGuiTools({ config, auth }) {
|
|
58
|
+
return [
|
|
59
|
+
{
|
|
60
|
+
name: "get_cursor_position",
|
|
61
|
+
title: "Get cursor position",
|
|
62
|
+
description: "Return the current Windows mouse cursor coordinates when ALLOW_GUI=1.",
|
|
63
|
+
inputSchema: {
|
|
64
|
+
type: "object",
|
|
65
|
+
properties: { control_pin: { type: "string", description: "Optional fallback PIN." } },
|
|
66
|
+
additionalProperties: false,
|
|
67
|
+
},
|
|
68
|
+
annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false, idempotentHint: true },
|
|
69
|
+
_meta: toolMeta("Reading cursor position", "Cursor position ready", CONTROL_SECURITY_SCHEMES),
|
|
70
|
+
async handler(args, { authContext }) {
|
|
71
|
+
auth.requireCapability("ALLOW_GUI", config.state.allowGui, args.control_pin, authContext);
|
|
72
|
+
const res = await runPowerShell(
|
|
73
|
+
`Add-Type -AssemblyName System.Windows.Forms; $p = [System.Windows.Forms.Cursor]::Position; Write-Output "$($p.X),$($p.Y)"`,
|
|
74
|
+
{ config, timeoutMs: 5000, sta: true }
|
|
75
|
+
);
|
|
76
|
+
const [x, y] = res.stdout.text.trim().split(",").map(Number);
|
|
77
|
+
if (!Number.isFinite(x) || !Number.isFinite(y)) {
|
|
78
|
+
throw new Error("Could not read Windows cursor position.");
|
|
79
|
+
}
|
|
80
|
+
const payload = { x, y };
|
|
81
|
+
return okResult(JSON.stringify(payload), payload);
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: "move_mouse",
|
|
86
|
+
title: "Move mouse",
|
|
87
|
+
description: "Move the Windows mouse cursor to screen coordinates when ALLOW_GUI=1.",
|
|
88
|
+
inputSchema: {
|
|
89
|
+
type: "object",
|
|
90
|
+
properties: {
|
|
91
|
+
x: { type: "integer", minimum: -32768, maximum: 32767 },
|
|
92
|
+
y: { type: "integer", minimum: -32768, maximum: 32767 },
|
|
93
|
+
control_pin: { type: "string", description: "Optional fallback PIN." },
|
|
94
|
+
},
|
|
95
|
+
required: ["x", "y"],
|
|
96
|
+
additionalProperties: false,
|
|
97
|
+
},
|
|
98
|
+
annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: false, idempotentHint: false },
|
|
99
|
+
_meta: toolMeta("Moving mouse", "Mouse moved", CONTROL_SECURITY_SCHEMES),
|
|
100
|
+
async handler(args, { authContext }) {
|
|
101
|
+
auth.requireCapability("ALLOW_GUI", config.state.allowGui, args.control_pin, authContext);
|
|
102
|
+
await runPowerShell(
|
|
103
|
+
`Add-Type -AssemblyName System.Windows.Forms; Add-Type -AssemblyName System.Drawing; [System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point([int]$env:LMCP_X, [int]$env:LMCP_Y)`,
|
|
104
|
+
{ config, timeoutMs: 5000, sta: true, env: { LMCP_X: String(args.x), LMCP_Y: String(args.y) } }
|
|
105
|
+
);
|
|
106
|
+
const payload = { ok: true, x: Number(args.x), y: Number(args.y) };
|
|
107
|
+
return okResult(JSON.stringify(payload), payload);
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: "mouse_click",
|
|
112
|
+
title: "Mouse click",
|
|
113
|
+
description: "Click Windows screen coordinates with left, right, or middle button when ALLOW_GUI=1.",
|
|
114
|
+
inputSchema: {
|
|
115
|
+
type: "object",
|
|
116
|
+
properties: {
|
|
117
|
+
x: { type: "integer", minimum: -32768, maximum: 32767 },
|
|
118
|
+
y: { type: "integer", minimum: -32768, maximum: 32767 },
|
|
119
|
+
button: { type: "string", enum: ["left", "right", "middle"] },
|
|
120
|
+
clicks: { type: "integer", minimum: 1, maximum: 3 },
|
|
121
|
+
control_pin: { type: "string", description: "Optional fallback PIN." },
|
|
122
|
+
},
|
|
123
|
+
required: ["x", "y"],
|
|
124
|
+
additionalProperties: false,
|
|
125
|
+
},
|
|
126
|
+
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false, idempotentHint: false },
|
|
127
|
+
_meta: toolMeta("Clicking mouse", "Mouse click finished", CONTROL_SECURITY_SCHEMES),
|
|
128
|
+
async handler(args, { authContext }) {
|
|
129
|
+
auth.requireCapability("ALLOW_GUI", config.state.allowGui, args.control_pin, authContext);
|
|
130
|
+
const button = args.button || "left";
|
|
131
|
+
const clicks = Math.min(Math.max(Number(args.clicks ?? 1) || 1, 1), 3);
|
|
132
|
+
const flags = {
|
|
133
|
+
left: { down: 0x0002, up: 0x0004 },
|
|
134
|
+
right: { down: 0x0008, up: 0x0010 },
|
|
135
|
+
middle: { down: 0x0020, up: 0x0040 },
|
|
136
|
+
}[button];
|
|
137
|
+
if (!flags) throw new Error(`Unsupported mouse button "${button}".`);
|
|
138
|
+
|
|
139
|
+
await runPowerShell(
|
|
140
|
+
`
|
|
141
|
+
Add-Type -TypeDefinition @"
|
|
142
|
+
using System;
|
|
143
|
+
using System.Runtime.InteropServices;
|
|
144
|
+
public static class LocalMcpMouse {
|
|
145
|
+
[DllImport("user32.dll")] public static extern bool SetCursorPos(int x, int y);
|
|
146
|
+
[DllImport("user32.dll")] public static extern void mouse_event(uint flags, uint dx, uint dy, uint data, UIntPtr extraInfo);
|
|
147
|
+
}
|
|
148
|
+
"@
|
|
149
|
+
[LocalMcpMouse]::SetCursorPos([int]$env:LMCP_X, [int]$env:LMCP_Y) | Out-Null
|
|
150
|
+
Start-Sleep -Milliseconds 50
|
|
151
|
+
for ($i = 0; $i -lt [int]$env:LMCP_CLICKS; $i++) {
|
|
152
|
+
[LocalMcpMouse]::mouse_event([uint32]$env:LMCP_DOWN, 0, 0, 0, [UIntPtr]::Zero)
|
|
153
|
+
Start-Sleep -Milliseconds 35
|
|
154
|
+
[LocalMcpMouse]::mouse_event([uint32]$env:LMCP_UP, 0, 0, 0, [UIntPtr]::Zero)
|
|
155
|
+
Start-Sleep -Milliseconds 80
|
|
156
|
+
}
|
|
157
|
+
`,
|
|
158
|
+
{
|
|
159
|
+
config,
|
|
160
|
+
timeoutMs: 10000,
|
|
161
|
+
env: {
|
|
162
|
+
LMCP_X: String(args.x),
|
|
163
|
+
LMCP_Y: String(args.y),
|
|
164
|
+
LMCP_DOWN: String(flags.down),
|
|
165
|
+
LMCP_UP: String(flags.up),
|
|
166
|
+
LMCP_CLICKS: String(clicks),
|
|
167
|
+
},
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
const payload = { ok: true, x: Number(args.x), y: Number(args.y), button, clicks };
|
|
171
|
+
return okResult(JSON.stringify(payload), payload);
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: "press_keys",
|
|
176
|
+
title: "Press keys",
|
|
177
|
+
description: "Press a Windows keyboard chord such as ['CTRL','L'] or ['ALT','TAB'] when ALLOW_GUI=1.",
|
|
178
|
+
inputSchema: {
|
|
179
|
+
type: "object",
|
|
180
|
+
properties: {
|
|
181
|
+
keys: { type: "array", items: { type: "string" }, minItems: 1 },
|
|
182
|
+
holdMs: { type: "integer", minimum: 10, maximum: 2000 },
|
|
183
|
+
control_pin: { type: "string", description: "Optional fallback PIN." },
|
|
184
|
+
},
|
|
185
|
+
required: ["keys"],
|
|
186
|
+
additionalProperties: false,
|
|
187
|
+
},
|
|
188
|
+
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: true, idempotentHint: false },
|
|
189
|
+
_meta: toolMeta("Pressing keys", "Key press finished", CONTROL_SECURITY_SCHEMES),
|
|
190
|
+
async handler(args, { authContext }) {
|
|
191
|
+
auth.requireCapability("ALLOW_GUI", config.state.allowGui, args.control_pin, authContext);
|
|
192
|
+
if (!Array.isArray(args.keys) || args.keys.length === 0) {
|
|
193
|
+
throw new Error("keys must be a non-empty array.");
|
|
194
|
+
}
|
|
195
|
+
const codes = args.keys.map(resolveVirtualKey);
|
|
196
|
+
const holdMs = Math.min(Math.max(Number(args.holdMs ?? 60) || 60, 10), 2000);
|
|
197
|
+
await runPowerShell(
|
|
198
|
+
`
|
|
199
|
+
Add-Type -TypeDefinition @"
|
|
200
|
+
using System;
|
|
201
|
+
using System.Runtime.InteropServices;
|
|
202
|
+
public static class LocalMcpKeyboard {
|
|
203
|
+
[DllImport("user32.dll")] public static extern void keybd_event(byte vk, byte scan, uint flags, UIntPtr extraInfo);
|
|
204
|
+
}
|
|
205
|
+
"@
|
|
206
|
+
$codes = $env:LMCP_KEYS -split "," | ForEach-Object { [byte]$_ }
|
|
207
|
+
foreach ($c in $codes) { [LocalMcpKeyboard]::keybd_event($c, 0, 0, [UIntPtr]::Zero); Start-Sleep -Milliseconds 20 }
|
|
208
|
+
Start-Sleep -Milliseconds ([int]$env:LMCP_HOLD)
|
|
209
|
+
[array]::Reverse($codes)
|
|
210
|
+
foreach ($c in $codes) { [LocalMcpKeyboard]::keybd_event($c, 0, 2, [UIntPtr]::Zero); Start-Sleep -Milliseconds 20 }
|
|
211
|
+
`,
|
|
212
|
+
{ config, timeoutMs: 10000, env: { LMCP_KEYS: codes.join(","), LMCP_HOLD: String(holdMs) } }
|
|
213
|
+
);
|
|
214
|
+
const payload = { ok: true, keys: args.keys, holdMs };
|
|
215
|
+
return okResult(JSON.stringify(payload), payload);
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
name: "type_text",
|
|
220
|
+
title: "Type text",
|
|
221
|
+
description: "Paste UTF-8 text into the active Windows application via clipboard when ALLOW_GUI=1.",
|
|
222
|
+
inputSchema: {
|
|
223
|
+
type: "object",
|
|
224
|
+
properties: {
|
|
225
|
+
text: { type: "string" },
|
|
226
|
+
restoreClipboard: { type: "boolean" },
|
|
227
|
+
control_pin: { type: "string", description: "Optional fallback PIN." },
|
|
228
|
+
},
|
|
229
|
+
required: ["text"],
|
|
230
|
+
additionalProperties: false,
|
|
231
|
+
},
|
|
232
|
+
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: true, idempotentHint: false },
|
|
233
|
+
_meta: toolMeta("Typing text", "Text typed", CONTROL_SECURITY_SCHEMES),
|
|
234
|
+
async handler(args, { authContext }) {
|
|
235
|
+
auth.requireCapability("ALLOW_GUI", config.state.allowGui, args.control_pin, authContext);
|
|
236
|
+
const text = String(args.text ?? "");
|
|
237
|
+
if (Buffer.byteLength(text, "utf8") > 16000) {
|
|
238
|
+
throw new Error("type_text is limited to 16KB of UTF-8 text. Use write_file for larger content.");
|
|
239
|
+
}
|
|
240
|
+
const restore = args.restoreClipboard !== false;
|
|
241
|
+
await runPowerShell(
|
|
242
|
+
`
|
|
243
|
+
Add-Type -AssemblyName System.Windows.Forms
|
|
244
|
+
$text = [System.Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($env:LMCP_TEXT_B64))
|
|
245
|
+
$had = [System.Windows.Forms.Clipboard]::ContainsText()
|
|
246
|
+
$prev = if ($had) { [System.Windows.Forms.Clipboard]::GetText() } else { "" }
|
|
247
|
+
[System.Windows.Forms.Clipboard]::SetText($text)
|
|
248
|
+
Start-Sleep -Milliseconds 80
|
|
249
|
+
[System.Windows.Forms.SendKeys]::SendWait("^v")
|
|
250
|
+
Start-Sleep -Milliseconds 300
|
|
251
|
+
if ($env:LMCP_RESTORE -eq "1" -and $had) { [System.Windows.Forms.Clipboard]::SetText($prev) }
|
|
252
|
+
`,
|
|
253
|
+
{
|
|
254
|
+
config,
|
|
255
|
+
timeoutMs: 15000,
|
|
256
|
+
sta: true,
|
|
257
|
+
env: {
|
|
258
|
+
LMCP_TEXT_B64: Buffer.from(text, "utf8").toString("base64"),
|
|
259
|
+
LMCP_RESTORE: restore ? "1" : "0",
|
|
260
|
+
},
|
|
261
|
+
}
|
|
262
|
+
);
|
|
263
|
+
const payload = { ok: true, length: text.length, restoreClipboard: restore };
|
|
264
|
+
return okResult(JSON.stringify(payload), payload);
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
];
|
|
268
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import Ajv from "ajv";
|
|
2
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
|
+
import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
4
|
+
import { errorResult } from "../core/protocol.js";
|
|
5
|
+
import { buildServerInstructions } from "../core/context-discovery.js";
|
|
6
|
+
import { createAgentTools } from "./agents.js";
|
|
7
|
+
import { createDiagnosticsTools } from "./diagnostics.js";
|
|
8
|
+
import { createFilesystemTools } from "./filesystem.js";
|
|
9
|
+
import { createWindowsGuiTools } from "./gui-windows.js";
|
|
10
|
+
import { createSystemTools } from "./system.js";
|
|
11
|
+
|
|
12
|
+
export function createToolRegistry({ config, auth, audit, agentHub }) {
|
|
13
|
+
const systemTools = createSystemTools({ config, auth });
|
|
14
|
+
const diagTools = createDiagnosticsTools({ config, auth });
|
|
15
|
+
const fsTools = createFilesystemTools({ config, auth });
|
|
16
|
+
const guiTools = createWindowsGuiTools({ config, auth });
|
|
17
|
+
const agentTools = createAgentTools({ config, auth, agentHub });
|
|
18
|
+
|
|
19
|
+
const byName = new Map();
|
|
20
|
+
for (const tool of [...systemTools, ...diagTools, ...fsTools, ...guiTools, ...agentTools]) {
|
|
21
|
+
byName.set(tool.name, tool);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Deterministic ordering keeps LLM prompt caches stable across stateless requests.
|
|
25
|
+
const orderedNames = [
|
|
26
|
+
"computer_status",
|
|
27
|
+
"self_update",
|
|
28
|
+
"code_diagnostics",
|
|
29
|
+
"list_directory",
|
|
30
|
+
"read_file",
|
|
31
|
+
"write_file",
|
|
32
|
+
"edit_file",
|
|
33
|
+
"apply_patch",
|
|
34
|
+
"transfer_file",
|
|
35
|
+
"search_files",
|
|
36
|
+
"run_shell",
|
|
37
|
+
"run_command",
|
|
38
|
+
"take_screenshot",
|
|
39
|
+
"open_target",
|
|
40
|
+
"run_applescript",
|
|
41
|
+
"run_powershell",
|
|
42
|
+
"get_cursor_position",
|
|
43
|
+
"move_mouse",
|
|
44
|
+
"mouse_click",
|
|
45
|
+
"press_keys",
|
|
46
|
+
"type_text",
|
|
47
|
+
"agent_list",
|
|
48
|
+
"agent_register",
|
|
49
|
+
"agent_dispatch",
|
|
50
|
+
"agent_result",
|
|
51
|
+
"agent_notify",
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
const orderedTools = orderedNames.map((name) => {
|
|
55
|
+
const tool = byName.get(name);
|
|
56
|
+
if (!tool) throw new Error(`Missing required tool registration: ${name}`);
|
|
57
|
+
return tool;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const descriptors = orderedTools.map(({ handler: _handler, ...descriptor }) => descriptor);
|
|
61
|
+
|
|
62
|
+
function getInstructions() {
|
|
63
|
+
return buildServerInstructions({ config });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function createStatelessMcpServer(authContext) {
|
|
67
|
+
const server = new Server(
|
|
68
|
+
{ name: config.state.serverName, version: config.state.version },
|
|
69
|
+
{ capabilities: { tools: {} }, instructions: getInstructions() }
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: descriptors }));
|
|
73
|
+
|
|
74
|
+
server.setRequestHandler(CallToolRequestSchema, request => callTool(request, authContext));
|
|
75
|
+
|
|
76
|
+
return server;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const ajv = new Ajv({ strict: false });
|
|
80
|
+
const validators = new Map(orderedTools.map(tool => [tool.name, ajv.compile(tool.inputSchema)]));
|
|
81
|
+
|
|
82
|
+
async function callTool(request, authContext) {
|
|
83
|
+
const toolName = String(request.params?.name || "");
|
|
84
|
+
const args = request.params?.arguments === undefined ? {} : request.params.arguments;
|
|
85
|
+
const tool = byName.get(toolName);
|
|
86
|
+
if (!tool) {
|
|
87
|
+
return errorResult(new Error(`Unknown tool: ${toolName}`));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const validate = validators.get(toolName);
|
|
91
|
+
if (!validate(args)) return errorResult(new Error("Invalid tool arguments."));
|
|
92
|
+
const started = Date.now();
|
|
93
|
+
try {
|
|
94
|
+
const result = await tool.handler(args, { authContext });
|
|
95
|
+
await audit.record({
|
|
96
|
+
tool: toolName,
|
|
97
|
+
ok: !result?.isError,
|
|
98
|
+
authKind: authContext.kind,
|
|
99
|
+
durationMs: Date.now() - started,
|
|
100
|
+
});
|
|
101
|
+
return result;
|
|
102
|
+
} catch (error) {
|
|
103
|
+
await audit.record({
|
|
104
|
+
tool: toolName,
|
|
105
|
+
ok: false,
|
|
106
|
+
authKind: authContext.kind,
|
|
107
|
+
durationMs: Date.now() - started,
|
|
108
|
+
});
|
|
109
|
+
return errorResult(error);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return {
|
|
114
|
+
callTool,
|
|
115
|
+
descriptors,
|
|
116
|
+
getInstructions,
|
|
117
|
+
createStatelessMcpServer,
|
|
118
|
+
};
|
|
119
|
+
}
|