* Optional allowlist of exposed tools, parsed from the CODEGRAPH_MCP_TOOLS * env var (comma-separated short names, e.g. "trace,search,node,context"). * Unset/empty → every tool is exposed. Lets an operator (or an A/B harness) * trim the tool surface without rebuilding the client config; the
()
| 2365 | * Matching is on the short form, so "node" and "codegraph_node" both work. |
| 2366 | */ |
| 2367 | private toolAllowlist(): Set<string> | null { |
| 2368 | const raw = process.env.CODEGRAPH_MCP_TOOLS; |
| 2369 | if (!raw || !raw.trim()) return null; |
| 2370 | const short = (s: string) => s.trim().replace(/^codegraph_/, ''); |
| 2371 | const set = new Set(raw.split(',').map(short).filter(Boolean)); |
| 2372 | return set.size ? set : null; |
| 2373 | } |
| 2374 | |
| 2375 | /** Whether a tool name passes the CODEGRAPH_MCP_TOOLS allowlist (if any). */ |
| 2376 | private isToolAllowed(name: string): boolean { |
no test coverage detected