@bendyline/gezel-mcp 1.1.2 → 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/index.js CHANGED
@@ -1,400 +1,22 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/tool-inventory.ts
4
- import { resolveDistributionProfile } from "@bendyline/gezel";
5
- var ALWAYS_REGISTERED_TOOLS = [
6
- // Memory
7
- "search_memory",
8
- "save_memory",
9
- "list_memories",
10
- // Workspace (read-write project files)
11
- "list_dir",
12
- "read_file",
13
- "read_files",
14
- "stat",
15
- "write_file",
16
- "append_to_file",
17
- "replace_in_file",
18
- "replace_lines",
19
- "apply_patch",
20
- "insert_at_marker",
21
- "delete_path",
22
- "make_dir",
23
- "rename",
24
- "copy_artifact_to_workspace",
25
- "validate",
26
- // Execution (Node / npm / playwright)
27
- "npm_install",
28
- "list_package_scripts",
29
- "run_package_script",
30
- "run_npx",
31
- "run_nodejs_script",
32
- "derive_file",
33
- "list_packages",
34
- "run_playwright_script",
35
- // Artifacts (project-scoped)
36
- "list_artifacts",
37
- "read_artifact",
38
- "read_artifacts",
39
- "write_artifact",
40
- "grep_artifact",
41
- "browser_find_page_element",
42
- // Documents (shared library)
43
- "list_documents",
44
- "read_document",
45
- "write_document",
46
- "delete_document",
47
- "search_documents",
48
- // Team / gezels
49
- "list_gezels",
50
- "create_gezel",
51
- "list_gilde",
52
- "list_project_types",
53
- "apply_project_type",
54
- "start_project_from_type",
55
- "export_ai_app",
56
- "import_ai_app",
57
- "ensure_gezel",
58
- "update_gezel",
59
- "message_gezel",
60
- "ask_gezel",
61
- "ask_specialist",
62
- // Role-typed delegation (always registered; surfaced per session only
63
- // when the `tools.gezels-as-roles` behavior is active — see
64
- // role-tool-filter.ts + builtin-toolsets.ts `role-delegation*` groups).
65
- "delegate_developer",
66
- "consult_developer",
67
- "delegate_designer",
68
- "consult_designer",
69
- "delegate_reviewer",
70
- "consult_reviewer",
71
- "delegate_planner",
72
- "consult_planner",
73
- "delegate_researcher",
74
- "consult_researcher",
75
- "delegate_builder",
76
- "consult_builder",
77
- "delegate_writer",
78
- "consult_writer",
79
- "delegate_image_generator",
80
- "consult_image_generator",
81
- "delegate_voorman",
82
- "consult_voorman",
83
- "delegate_meester",
84
- "consult_meester",
85
- // User
86
- "ask_user_question",
87
- // Projects
88
- "list_projects",
89
- "start_project",
90
- "fetch_repo",
91
- "fetch_diff",
92
- "update_project",
93
- "list_project_gezels",
94
- "add_gezel_to_project",
95
- "remove_gezel_from_project",
96
- "list_suggested_work",
97
- "enable_suggested_work",
98
- "disable_suggested_work",
99
- // Tasks
100
- "list_tasks",
101
- "get_task",
102
- "create_task",
103
- "start_plan",
104
- "update_task",
105
- "set_outcomes",
106
- "verify_outcome",
107
- "add_verification_step",
108
- "spawn_task_instances",
109
- "list_task_children",
110
- "set_task_status",
111
- "activate_task",
112
- "assign_task",
113
- "add_task_step",
114
- "advance_task_step",
115
- "read_task_notes",
116
- "write_task_note",
117
- // History
118
- "search_history",
119
- "search_sessions",
120
- // Handboek (built-in documentation)
121
- "how_do_i",
122
- // Images
123
- "render_image",
124
- "generate_image",
125
- "describe_image",
126
- "read_image_metadata",
127
- // Video
128
- "generate_video",
129
- // Audio (whisper.cpp STT + Kokoro TTS)
130
- "transcribe_audio",
131
- "synthesize_speech",
132
- // Web
133
- "fetch_url",
134
- "web_search",
135
- "wikipedia_search",
136
- "wikipedia_read",
137
- // Search / files
138
- "search",
139
- "grep_files",
140
- "find_files",
141
- "diff_files",
142
- "read_image_as_base64",
143
- // Code intelligence (workspace content index)
144
- "outline_file",
145
- "find_symbol",
146
- "read_symbol",
147
- "find_references",
148
- "map_repo",
149
- "search_code",
150
- "file_review",
151
- "list_file_issues",
152
- "get_file_issue",
153
- "set_file_issue_status",
154
- // Security intelligence (static security analysis over the index)
155
- "security_scan",
156
- "security_overview",
157
- "scan_findings",
158
- "map_attack_surface",
159
- "list_dependencies",
160
- "trace_taint",
161
- // Document intelligence (converted office docs)
162
- "search_docs",
163
- "read_doc_as_markdown",
164
- // Image intelligence (workspace image library)
165
- "search_images",
166
- "find_similar_images",
167
- "describe_folder",
168
- // Entity intelligence (meta-boekwachter: cross-file entities)
169
- "find_entity",
170
- "list_entity_mentions",
171
- // Archives
172
- "list_archive",
173
- "extract_archive",
174
- // Git
175
- "run_git",
176
- // Scripts
177
- "list_scripts",
178
- "run_installed_script",
179
- "get_script_run",
180
- // Craftbooks (procedures)
181
- "list_craftbooks",
182
- "suggest_craftbook",
183
- "invoke_craftbook",
184
- "import_skill",
185
- // Craftbook editing (template authoring + step surgery)
186
- "craftbook_read",
187
- "craftbook_write",
188
- "craftbook_add_step",
189
- "set_step_deliverable",
190
- "craftbook_remove_step",
191
- "craftbook_reorder_steps",
192
- "craftbook_set_entry",
193
- "craftbook_update",
194
- "export_task_craftbook",
195
- // GitHub (PR + workflow operations)
196
- "github_pr_list",
197
- "github_pr_view",
198
- "github_pr_files",
199
- "github_pr_file",
200
- "github_pr_diff",
201
- "github_pr_comments",
202
- "github_pr_comment",
203
- "github_pr_create",
204
- "github_workflow_runs",
205
- "github_check_status"
206
- ];
207
- var CONDITIONALLY_REGISTERED_TOOLS = {
208
- // Compatibility aliases consolidated into smaller primary tools. Hidden
209
- // from model sessions by default; direct MCP clients can opt in while they
210
- // migrate by setting GEZEL_MCP_LEGACY_TOOLS=1.
211
- create_gezel_from_gilde: {
212
- envVar: "GEZEL_MCP_LEGACY_TOOLS",
213
- envValue: "1",
214
- modelFacing: false
215
- },
216
- start_job: { envVar: "GEZEL_MCP_LEGACY_TOOLS", envValue: "1", modelFacing: false },
217
- list_project_local_gezels: {
218
- envVar: "GEZEL_MCP_LEGACY_TOOLS",
219
- envValue: "1",
220
- modelFacing: false
221
- },
222
- craftbook_create: {
223
- envVar: "GEZEL_MCP_LEGACY_TOOLS",
224
- envValue: "1",
225
- modelFacing: false
226
- },
227
- craftbook_replace: {
228
- envVar: "GEZEL_MCP_LEGACY_TOOLS",
229
- envValue: "1",
230
- modelFacing: false
231
- },
232
- // The large surgical-step schema is useful in the explicit craftbook
233
- // editor and in task-scoped plan authoring, but wasteful on every ordinary
234
- // coordinator turn. The chat manager enables this MCP-side registration
235
- // for those session types; its exact per-turn allowlist still decides
236
- // whether the schema reaches the model.
237
- craftbook_update_step: {
238
- envVar: "GEZEL_CRAFTBOOK_STEP_EDITING",
239
- envValue: "1",
240
- modelFacing: true
241
- },
242
- request_tool_permission: {
243
- envVar: "GEZEL_PERMISSION_PROMPT",
244
- envValue: "1",
245
- modelFacing: false
246
- },
247
- // Observation-table tools — registered only for projects that actually hold
248
- // a tabular corpus (the chat manager sets GEZEL_TABLES_ENABLED after a
249
- // directory probe). The tool listing is injected into every system prompt,
250
- // so three tools a project can never use are pure prompt cost at depth —
251
- // and a model that sees a tool tends to reach for it.
252
- list_tables: { envVar: "GEZEL_TABLES_ENABLED", envValue: "1", modelFacing: true },
253
- describe_table: { envVar: "GEZEL_TABLES_ENABLED", envValue: "1", modelFacing: true },
254
- query_table: { envVar: "GEZEL_TABLES_ENABLED", envValue: "1", modelFacing: true },
255
- // Email write tools — registered only for mail-enabled projects (the chat
256
- // manager sets GEZEL_MAIL_ENABLED when project.mail is configured).
257
- draft_email: { envVar: "GEZEL_MAIL_ENABLED", envValue: "1", modelFacing: true },
258
- queue_email: { envVar: "GEZEL_MAIL_ENABLED", envValue: "1", modelFacing: true },
259
- send_email: { envVar: "GEZEL_MAIL_ENABLED", envValue: "1", modelFacing: true },
260
- // Social post write tools — registered only for projects with a social-type
261
- // connector binding (the chat manager sets GEZEL_SOCIAL_ENABLED).
262
- draft_post: { envVar: "GEZEL_SOCIAL_ENABLED", envValue: "1", modelFacing: true },
263
- queue_post: { envVar: "GEZEL_SOCIAL_ENABLED", envValue: "1", modelFacing: true },
264
- publish_post: { envVar: "GEZEL_SOCIAL_ENABLED", envValue: "1", modelFacing: true },
265
- // Generic connector writes are draft-only and appear only for projects
266
- // with at least one connector binding.
267
- draft_connector_action: {
268
- envVar: "GEZEL_CONNECTORS_ENABLED",
269
- envValue: "1",
270
- modelFacing: true
271
- }
272
- };
273
- var HOST_CALLBACK_TOOLS = Object.freeze(
274
- /* @__PURE__ */ new Set(["request_tool_permission"])
275
- );
276
- var RENAMED_TOOLS = {
277
- readdir: "list_dir",
278
- readFile: "read_file",
279
- read_multiple_files: "read_files",
280
- writeFile: "write_file",
281
- appendToFile: "append_to_file",
282
- replaceInFile: "replace_in_file",
283
- replaceLines: "replace_lines",
284
- applyPatch: "apply_patch",
285
- insertAtMarker: "insert_at_marker",
286
- rm: "delete_path",
287
- mkdir: "make_dir",
288
- draftEmail: "draft_email",
289
- queueEmail: "queue_email",
290
- sendEmail: "send_email",
291
- // Familiar coding-agent vocabulary improves tool selection for local
292
- // models. The old semantic name remains a hidden dispatch alias.
293
- search_files: "grep_files",
294
- // Not part of the snake_case sweep — a later, semantic rename. `run_script`
295
- // read as "run a script", so models that had just written `derive.mjs`
296
- // called it with a file path and got a "script not found" dead end; the
297
- // 2026-08-02 core suite caught gemma4-e4b doing this 6 times in one trial
298
- // and then fabricating the output it could not compute. Measured, not
299
- // assumed: forcing `prompt.derive-by-execution` (whose text names
300
- // `derive_file` and `run_nodejs_script` outright) did NOT redirect it —
301
- // the model still reached for `run_script`. The name is the pull, so the
302
- // name changes; `run_script` stays callable here forever.
303
- run_script: "run_installed_script"
304
- };
305
- var TOOL_NAME_TOMBSTONES = {
306
- update_task_step: { replacement: void 0, reason: "no such MCP tool" },
307
- commitProjectGit: { replacement: void 0, reason: "UI/client method, not an MCP tool" },
308
- pushProjectGit: { replacement: void 0, reason: "UI/client method, not an MCP tool" },
309
- listAudioVoices: { replacement: void 0, reason: "UI/client method, not an MCP tool" },
310
- create_project: { replacement: "start_project", reason: "removed project-creation tool" },
311
- inspect_git_workdir: { replacement: "run_git", reason: "foreign coding-agent tool" },
312
- ensureGezel: { replacement: "ensure_gezel", reason: "client method, not an MCP tool" },
313
- pushProjectGithub: { replacement: void 0, reason: "client method, not an MCP tool" },
314
- AskUserQuestion: { replacement: "ask_user_question", reason: "foreign coding-agent tool" },
315
- WebSearch: { replacement: "web_search", reason: "foreign coding-agent tool" },
316
- Grep: { replacement: "grep_files", reason: "foreign coding-agent tool" },
317
- Read: { replacement: "read_file", reason: "foreign coding-agent tool" },
318
- Edit: { replacement: "replace_in_file", reason: "foreign coding-agent tool" },
319
- Agent: { replacement: "message_gezel", reason: "foreign coding-agent tool" },
320
- Bash: { replacement: void 0, reason: "foreign shell tool; no unrestricted shell is exposed" },
321
- ExitPlanMode: { replacement: void 0, reason: "foreign coding-agent control tool" }
322
- };
323
- var CANONICAL_TOOL_NAMES = Object.freeze([
324
- ...ALWAYS_REGISTERED_TOOLS,
325
- ...Object.keys(CONDITIONALLY_REGISTERED_TOOLS)
326
- ]);
327
- var LEGACY_TOOL_NAMES = Object.freeze(
328
- Object.keys(RENAMED_TOOLS)
329
- );
330
- var aliasesByCanonical = /* @__PURE__ */ new Map();
331
- for (const [alias, canonical] of Object.entries(RENAMED_TOOLS)) {
332
- const aliases = aliasesByCanonical.get(canonical) ?? [];
333
- aliases.push(alias);
334
- aliasesByCanonical.set(canonical, aliases);
335
- }
336
- var TOOL_REGISTRY = Object.freeze(
337
- Object.fromEntries(
338
- CANONICAL_TOOL_NAMES.map((canonicalName) => {
339
- const conditional = CONDITIONALLY_REGISTERED_TOOLS[canonicalName];
340
- const aliases = Object.freeze([
341
- ...aliasesByCanonical.get(canonicalName) ?? []
342
- ]);
343
- const entry = conditional ? {
344
- canonicalName,
345
- registration: "conditional",
346
- gate: { envVar: conditional.envVar, envValue: conditional.envValue },
347
- aliases,
348
- advertisedByDefault: false,
349
- modelFacing: conditional.modelFacing
350
- } : {
351
- canonicalName,
352
- registration: "always",
353
- aliases,
354
- advertisedByDefault: true,
355
- modelFacing: true
356
- };
357
- return [canonicalName, Object.freeze(entry)];
358
- })
359
- )
360
- );
361
- var BUILTIN_TOOL_NAMES = Object.freeze([
362
- ...CANONICAL_TOOL_NAMES,
363
- ...LEGACY_TOOL_NAMES
364
- ]);
365
- var RESERVED_TOOL_NAMES = Object.freeze([
366
- ...BUILTIN_TOOL_NAMES,
367
- ...Object.keys(TOOL_NAME_TOMBSTONES)
368
- ]);
369
- var LEGACY_SPELLING_BY_CANONICAL = Object.fromEntries(
370
- Object.entries(RENAMED_TOOLS).map(([legacy, canonical]) => [canonical, legacy])
371
- );
372
- function normalizeToolNameSpelling(name) {
373
- return name.toLowerCase().replace(/[^a-z0-9]/g, "");
374
- }
375
- function canonicalToolName(name) {
376
- const direct = RENAMED_TOOLS[name];
377
- if (direct) return direct;
378
- return name;
379
- }
380
- function resolveToolNameSpelling(requested, knownNames) {
381
- if (knownNames.has(requested)) return requested;
382
- if (requested in TOOL_NAME_TOMBSTONES) return requested;
383
- const viaRename = RENAMED_TOOLS[requested];
384
- if (viaRename && knownNames.has(viaRename)) return viaRename;
385
- const viaLegacy = LEGACY_SPELLING_BY_CANONICAL[requested];
386
- if (viaLegacy && knownNames.has(viaLegacy)) return viaLegacy;
387
- const wanted = normalizeToolNameSpelling(requested);
388
- if (!wanted) return requested;
389
- for (const candidate of knownNames) {
390
- if (normalizeToolNameSpelling(candidate) === wanted) return candidate;
391
- }
392
- for (const [legacy, canonical] of Object.entries(RENAMED_TOOLS)) {
393
- if (normalizeToolNameSpelling(legacy) === wanted && knownNames.has(canonical)) return canonical;
394
- if (normalizeToolNameSpelling(canonical) === wanted && knownNames.has(legacy)) return legacy;
395
- }
396
- return requested;
397
- }
4
+ import {
5
+ ALWAYS_REGISTERED_TOOLS,
6
+ BUILTIN_TOOL_NAMES,
7
+ CANONICAL_TOOL_NAMES,
8
+ CONDITIONALLY_REGISTERED_TOOLS,
9
+ HOST_CALLBACK_TOOLS,
10
+ LEGACY_SPELLING_BY_CANONICAL,
11
+ LEGACY_TOOL_NAMES,
12
+ RESERVED_TOOL_NAMES,
13
+ TOOL_NAME_TOMBSTONES,
14
+ TOOL_REGISTRY,
15
+ distributionWithheldTools,
16
+ normalizeToolNameSpelling,
17
+ resolveToolNameSpelling
18
+ } from "@bendyline/gezel/local-loop";
19
+ import { canonicalToolName, RENAMED_TOOLS } from "@bendyline/gezel";
398
20
 
399
21
  // src/validate.ts
400
22
  import ts2 from "typescript";
@@ -994,6 +616,7 @@ function validateImage(path, content) {
994
616
  // src/platform-tool-availability.ts
995
617
  import { spawnSync } from "child_process";
996
618
  var DENY_NET_TOOLS = ["run_nodejs_script", "derive_file"];
619
+ var SCRIPT_NETWORK_ALLOWED_ENV = "GEZEL_SCRIPT_NETWORK_ALLOWED";
997
620
  var linuxSystemdProbe;
998
621
  function canUseLinuxSystemdDenyNet() {
999
622
  if (process.platform !== "linux") return false;
@@ -1026,6 +649,7 @@ function unavailableToolsForPlatform(platform, options = {}) {
1026
649
  if (platform === "linux" && (options.linuxSystemdAvailable ?? canUseLinuxSystemdDenyNet())) {
1027
650
  return [];
1028
651
  }
652
+ if (options.networkAllowed) return [];
1029
653
  return DENY_NET_TOOLS;
1030
654
  }
1031
655
 
@@ -1042,6 +666,7 @@ export {
1042
666
  LEGACY_TOOL_NAMES,
1043
667
  RENAMED_TOOLS,
1044
668
  RESERVED_TOOL_NAMES,
669
+ SCRIPT_NETWORK_ALLOWED_ENV,
1045
670
  TOOL_NAME_TOMBSTONES,
1046
671
  TOOL_REGISTRY,
1047
672
  canUseLinuxSystemdDenyNet,
package/dist/server.d.ts CHANGED
@@ -1,26 +1,5 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
 
3
- /**
4
- * Gezel MCP Server
5
- *
6
- * A stdio-based MCP server that gives Copilot agents access to Gezel's
7
- * memory system, workspace files, artifacts, and project tools. Spawned by
8
- * the ChatManager as a local MCP server for each chat session.
9
- *
10
- * Configuration is passed via environment variables:
11
- * GEZEL_BASE_URL — daemon base URL (http(s)://127.0.0.1:<port>)
12
- * GEZEL_TOKEN — bearer token for the daemon API
13
- * GEZEL_CERT_PATH — path to the daemon's runtime/cert.pem (under its GEZEL_HOME; default ~/.gezel/runtime) when it serves HTTPS
14
- * GEZEL_AGENT_ID — the agent this session belongs to
15
- * GEZEL_PROJECT_ID — the project context
16
- * GEZEL_SESSION_ID — the chat session this subprocess serves
17
- * GEZEL_HOME — path to ~/.gezel (for direct memory access)
18
- * GEZEL_ROLE_BASED_NAME_ONLY_MODE — 1/0 naming presentation inherited by new tasks
19
- * GEZEL_CRAFTBOOK_ID — explicit craftbook-editor context (loads step surgery)
20
- * GEZEL_MCP_AUTHORIZED_TOOLS — role-authorized built-ins (may exceed registered tools)
21
- * GEZEL_MCP_LEGACY_TOOLS=1 — expose compatibility aliases during migration
22
- */
23
-
24
3
  declare const server: McpServer;
25
4
 
26
5
  export { server };