token-goat 2.8.4 → 2.9.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.
@@ -4,14 +4,14 @@ import {
4
4
  buildEvent,
5
5
  relay,
6
6
  relayInProcess
7
- } from "./token-goat-chunk-ZQ3PUOP3.mjs";
7
+ } from "./token-goat-chunk-RRNRPCLX.mjs";
8
8
  import {
9
9
  MAX_STDIN_BYTES,
10
10
  readStdinJson
11
- } from "./token-goat-chunk-IZRXU64B.mjs";
12
- import "./token-goat-chunk-4OTIB7SB.mjs";
13
- import "./token-goat-chunk-CZALRRGN.mjs";
14
- import "./token-goat-chunk-E76UNTVK.mjs";
11
+ } from "./token-goat-chunk-MR7MNSDR.mjs";
12
+ import "./token-goat-chunk-FDXINYK4.mjs";
13
+ import "./token-goat-chunk-LHMC5ENL.mjs";
14
+ import "./token-goat-chunk-4ZDRTNGV.mjs";
15
15
  import "./token-goat-chunk-AO2QD2AG.mjs";
16
16
  import "./token-goat-chunk-AEX54RUZ.mjs";
17
17
  export {
@@ -25,7 +25,7 @@ import {
25
25
  runSkeleton,
26
26
  runSymbol,
27
27
  withPinnedReads
28
- } from "./token-goat-chunk-RE7S7H26.mjs";
28
+ } from "./token-goat-chunk-SXSWQMNP.mjs";
29
29
  import {
30
30
  buildProjectMap,
31
31
  embeddingsDepsAvailable,
@@ -34,10 +34,12 @@ import {
34
34
  getProjectIndexCounts,
35
35
  isWorkerRunning,
36
36
  mapLookupBytesSaved
37
- } from "./token-goat-chunk-4OTIB7SB.mjs";
37
+ } from "./token-goat-chunk-FDXINYK4.mjs";
38
38
  import {
39
+ ENV_KEYS,
39
40
  VERSION,
40
41
  dataDir,
42
+ envStrList,
41
43
  extractErrorMessage,
42
44
  getDb,
43
45
  globalDbPath,
@@ -46,7 +48,7 @@ import {
46
48
  recordStat,
47
49
  resolveProjectRoot,
48
50
  savedTokensFromBytes
49
- } from "./token-goat-chunk-E76UNTVK.mjs";
51
+ } from "./token-goat-chunk-4ZDRTNGV.mjs";
50
52
  import "./token-goat-chunk-AO2QD2AG.mjs";
51
53
  import "./token-goat-chunk-AEX54RUZ.mjs";
52
54
 
@@ -201,9 +203,30 @@ function withConfinedRead(pins, fn) {
201
203
  throw err;
202
204
  }
203
205
  }
206
+ function mcpToolAllowlist() {
207
+ const names = envStrList(ENV_KEYS.MCP_TOOLS, [], ",");
208
+ return names.length === 0 ? null : new Set(names);
209
+ }
204
210
  async function createMcpServer() {
205
211
  const [{ McpServer }, { z }] = await Promise.all([import("./token-goat-chunk-5CVKO3DA.mjs"), import("./token-goat-chunk-R4SR7MQY.mjs")]);
206
212
  const server = new McpServer({ name: "token-goat", version: VERSION });
213
+ const allowlist = mcpToolAllowlist();
214
+ if (allowlist !== null) {
215
+ const matched = /* @__PURE__ */ new Set();
216
+ const registerAll = server.registerTool.bind(server);
217
+ server.registerTool = ((name, definition, handler) => {
218
+ if (!allowlist.has(name)) return;
219
+ matched.add(name);
220
+ registerAll(name, definition, handler);
221
+ });
222
+ setTimeout(() => {
223
+ const unmatched = [...allowlist].filter((n) => !matched.has(n));
224
+ if (unmatched.length > 0) {
225
+ process.stderr.write(`token-goat: ${ENV_KEYS.MCP_TOOLS} names no such tool: ${unmatched.join(", ")}
226
+ `);
227
+ }
228
+ }, 0).unref();
229
+ }
207
230
  const makeProjectRootField = (verb) => z.string().optional().describe(
208
231
  `absolute path to the workspace root to scope this ${verb} to; defaults to the MCP server process's cwd, which is not always the actual workspace root for MCP clients -- pass this explicitly when it might differ`
209
232
  );
@@ -703,5 +726,6 @@ async function createMcpServer() {
703
726
  return server;
704
727
  }
705
728
  export {
706
- createMcpServer
729
+ createMcpServer,
730
+ mcpToolAllowlist
707
731
  };