MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / toolAllowlist

Method toolAllowlist

src/mcp/tools.ts:2328–2334  ·  view source on GitHub ↗

* 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

()

Source from the content-addressed store, hash-verified

2326 * Matching is on the short form, so "node" and "codegraph_node" both work.
2327 */
2328 private toolAllowlist(): Set<string> | null {
2329 const raw = process.env.CODEGRAPH_MCP_TOOLS;
2330 if (!raw || !raw.trim()) return null;
2331 const short = (s: string) => s.trim().replace(/^codegraph_/, '');
2332 const set = new Set(raw.split(',').map(short).filter(Boolean));
2333 return set.size ? set : null;
2334 }
2335
2336 /** Whether a tool name passes the CODEGRAPH_MCP_TOOLS allowlist (if any). */
2337 private isToolAllowed(name: string): boolean {

Callers 3

isToolAllowedMethod · 0.95
isToolServedMethod · 0.95
getToolsMethod · 0.95

Calls 1

mapMethod · 0.80

Tested by

no test coverage detected