on main help sign in
feat(mcp-config): add list of disabled_tools (#1533)
6219de7Amolith
README.md+22
@@ -275,6 +275,7 @@ using `$(echo $VAR)` syntax.
275 "args": ["/path/to/mcp-server.js"],
275 "args": ["/path/to/mcp-server.js"],
276 "timeout": 120,
276 "timeout": 120,
277 "disabled": false,
277 "disabled": false,
278+ "disabled_tools": ["some-tool-name"],
278 "env": {
279 "env": {
279 "NODE_ENV": "production"
280 "NODE_ENV": "production"
280 }
281 }
@@ -284,6 +285,7 @@ using `$(echo $VAR)` syntax.
284 "url": "https://api.githubcopilot.com/mcp/",
285 "url": "https://api.githubcopilot.com/mcp/",
285 "timeout": 120,
286 "timeout": 120,
286 "disabled": false,
287 "disabled": false,
288+ "disabled_tools": ["create_issue", "create_pull_request"],
287 "headers": {
289 "headers": {
288 "Authorization": "Bearer $GH_PAT"
290 "Authorization": "Bearer $GH_PAT"
289 }
291 }
@@ -335,6 +337,26 @@ permissions. Use this with care.
335You can also skip all permission prompts entirely by running Crush with the
337You can also skip all permission prompts entirely by running Crush with the
336`--yolo` flag. Be very, very careful with this feature.
338`--yolo` flag. Be very, very careful with this feature.
337
339
340+### Disabling Built-In Tools
341+
342+If you'd like to prevent Crush from using certain built-in tools entirely, you
343+can disable them via the `options.disabled_tools` list. Disabled tools are
344+completely hidden from the agent.
345+
346+```json
347+{
348+ "$schema": "https://charm.land/crush.json",
349+ "options": {
350+ "disabled_tools": [
351+ "bash",
352+ "sourcegraph"
353+ ]
354+ }
355+}
356+```
357+
358+To disable tools from MCP servers, see the [MCP config section](#mcps).
359+
338### Initialization
360### Initialization
339
361
340When you initialize a project, Crush analyzes your codebase and creates
362When you initialize a project, Crush analyzes your codebase and creates
internal/agent/coordinator.go+6
@@ -388,6 +388,12 @@ func (c *coordinator) buildTools(ctx context.Context, agent config.Agent) ([]fan
388 }
388 }
389
389
390 for _, tool := range tools.GetMCPTools(c.permissions, c.cfg.WorkingDir()) {
390 for _, tool := range tools.GetMCPTools(c.permissions, c.cfg.WorkingDir()) {
391+ // Check MCP-specific disabled tools.
392+ if mcpCfg, ok := c.cfg.MCP[tool.MCP()]; ok {
393+ if slices.Contains(mcpCfg.DisabledTools, tool.MCPToolName()) {
394+ continue
395+ }
396+ }
391 if agent.AllowedMCP == nil {
397 if agent.AllowedMCP == nil {
392 // No MCP restrictions
398 // No MCP restrictions
393 filteredTools = append(filteredTools, tool)
399 filteredTools = append(filteredTools, tool)
internal/config/config.go+9−8
@@ -144,13 +144,14 @@ const (
144)
144)
145
145
146type MCPConfig struct {
146type MCPConfig struct {
147− Command string `json:"command,omitempty" jsonschema:"description=Command to execute for stdio MCP servers,example=npx"`
147+ Command string `json:"command,omitempty" jsonschema:"description=Command to execute for stdio MCP servers,example=npx"`
148− Env map[string]string `json:"env,omitempty" jsonschema:"description=Environment variables to set for the MCP server"`
148+ Env map[string]string `json:"env,omitempty" jsonschema:"description=Environment variables to set for the MCP server"`
149− Args []string `json:"args,omitempty" jsonschema:"description=Arguments to pass to the MCP server command"`
149+ Args []string `json:"args,omitempty" jsonschema:"description=Arguments to pass to the MCP server command"`
150− Type MCPType `json:"type" jsonschema:"required,description=Type of MCP connection,enum=stdio,enum=sse,enum=http,default=stdio"`
150+ Type MCPType `json:"type" jsonschema:"required,description=Type of MCP connection,enum=stdio,enum=sse,enum=http,default=stdio"`
151− URL string `json:"url,omitempty" jsonschema:"description=URL for HTTP or SSE MCP servers,format=uri,example=http://localhost:3000/mcp"`
151+ URL string `json:"url,omitempty" jsonschema:"description=URL for HTTP or SSE MCP servers,format=uri,example=http://localhost:3000/mcp"`
152− Disabled bool `json:"disabled,omitempty" jsonschema:"description=Whether this MCP server is disabled,default=false"`
152+ Disabled bool `json:"disabled,omitempty" jsonschema:"description=Whether this MCP server is disabled,default=false"`
153+ DisabledTools []string `json:"disabled_tools,omitempty" jsonschema:"description=List of tools from this MCP server to disable,example=get-library-doc"`
153− Timeout int `json:"timeout,omitempty" jsonschema:"description=Timeout in seconds for MCP server connections,default=15,example=30,example=60,example=120"`
154+ Timeout int `json:"timeout,omitempty" jsonschema:"description=Timeout in seconds for MCP server connections,default=15,example=30,example=60,example=120"`
154
155
155 // TODO: maybe make it possible to get the value from the env
156 // TODO: maybe make it possible to get the value from the env
156 Headers map[string]string `json:"headers,omitempty" jsonschema:"description=HTTP headers for HTTP/SSE MCP servers"`
157 Headers map[string]string `json:"headers,omitempty" jsonschema:"description=HTTP headers for HTTP/SSE MCP servers"`
@@ -221,7 +222,7 @@ type Options struct {
221 DebugLSP bool `json:"debug_lsp,omitempty" jsonschema:"description=Enable debug logging for LSP servers,default=false"`
222 DebugLSP bool `json:"debug_lsp,omitempty" jsonschema:"description=Enable debug logging for LSP servers,default=false"`
222 DisableAutoSummarize bool `json:"disable_auto_summarize,omitempty" jsonschema:"description=Disable automatic conversation summarization,default=false"`
223 DisableAutoSummarize bool `json:"disable_auto_summarize,omitempty" jsonschema:"description=Disable automatic conversation summarization,default=false"`
223 DataDirectory string `json:"data_directory,omitempty" jsonschema:"description=Directory for storing application data (relative to working directory),default=.crush,example=.crush"` // Relative to the cwd
224 DataDirectory string `json:"data_directory,omitempty" jsonschema:"description=Directory for storing application data (relative to working directory),default=.crush,example=.crush"` // Relative to the cwd
224− DisabledTools []string `json:"disabled_tools" jsonschema:"description=Tools to disable"`
225+ DisabledTools []string `json:"disabled_tools,omitempty" jsonschema:"description=List of built-in tools to disable and hide from the agent,example=bash,example=sourcegraph"`
225 DisableProviderAutoUpdate bool `json:"disable_provider_auto_update,omitempty" jsonschema:"description=Disable providers auto-update,default=false"`
226 DisableProviderAutoUpdate bool `json:"disable_provider_auto_update,omitempty" jsonschema:"description=Disable providers auto-update,default=false"`
226 Attribution *Attribution `json:"attribution,omitempty" jsonschema:"description=Attribution settings for generated content"`
227 Attribution *Attribution `json:"attribution,omitempty" jsonschema:"description=Attribution settings for generated content"`
227 DisableMetrics bool `json:"disable_metrics,omitempty" jsonschema:"description=Disable sending metrics,default=false"`
228 DisableMetrics bool `json:"disable_metrics,omitempty" jsonschema:"description=Disable sending metrics,default=false"`
schema.json+17−6
@@ -229,6 +229,16 @@
229 "description": "Whether this MCP server is disabled",
229 "description": "Whether this MCP server is disabled",
230 "default": false
230 "default": false
231 },
231 },
232+ "disabled_tools": {
233+ "items": {
234+ "type": "string",
235+ "examples": [
236+ "get-library-doc"
237+ ]
238+ },
239+ "type": "array",
240+ "description": "List of tools from this MCP server to disable"
241+ },
232 "timeout": {
242 "timeout": {
233 "type": "integer",
243 "type": "integer",
234 "description": "Timeout in seconds for MCP server connections",
244 "description": "Timeout in seconds for MCP server connections",
@@ -386,10 +396,14 @@
386 },
396 },
387 "disabled_tools": {
397 "disabled_tools": {
388 "items": {
398 "items": {
389− "type": "string"
399+ "type": "string",
400+ "examples": [
401+ "bash",
402+ "sourcegraph"
403+ ]
390 },
404 },
391 "type": "array",
405 "type": "array",
392− "description": "Tools to disable"
406+ "description": "List of built-in tools to disable and hide from the agent"
393 },
407 },
394 "disable_provider_auto_update": {
408 "disable_provider_auto_update": {
395 "type": "boolean",
409 "type": "boolean",
@@ -418,10 +432,7 @@
418 }
432 }
419 },
433 },
420 "additionalProperties": false,
434 "additionalProperties": false,
421− "type": "object",
435+ "type": "object"
422− "required": [
423− "disabled_tools"
424− ]
425 },
436 },
426 "Permissions": {
437 "Permissions": {
427 "properties": {
438 "properties": {