You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,7 @@ This project is a pure Rust rewrite of the JavaScript-based `@modelcontextprotoc
19
19
-**🔄 MCP Roots support**: enabling clients to dynamically modify the list of allowed directories (disabled by default).
20
20
-**📦 ZIP Archive Support**: Tools to create ZIP archives from files or directories and extract ZIP files with ease.
21
21
-**🪶 Lightweight**: Standalone with no external dependencies (e.g., no Node.js, Python etc required), compiled to a single binary with a minimal resource footprint, ideal for both lightweight and extensive deployment scenarios.
22
+
-**🎛️ Tool Disabling**: Disable specific tools to limit functionality and reduce the number of available tools, helping to save tokens.
22
23
23
24
#### 👉 Refer to [capabilities](https://rust-mcp-stack.github.io/rust-mcp-filesystem/#/capabilities) for a full list of tools and other capabilities.
Copy file name to clipboardExpand all lines: docs/README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@ This project is a pure Rust rewrite of the JavaScript-based **@modelcontextproto
11
11
-**🔄 MCP Roots support**: enabling clients to dynamically modify the list of allowed directories (disabled by default).
12
12
-**📦 ZIP Archive Support**: Tools to create ZIP archives from files or directories and extract ZIP files with ease.
13
13
-**🪶 Lightweight**: Standalone with no external dependencies (e.g., no Node.js, Python etc required), compiled to a single binary with a minimal resource footprint, ideal for both lightweight and extensive deployment scenarios.
14
+
-**🎛️ Tool Disabling**: Disable specific tools to limit functionality and reduce the number of available tools, helping to save tokens.
14
15
15
16
#### Refer to [capabilities](capabilities.md) for a full list of tools and other capabilities.
Copy file name to clipboardExpand all lines: docs/_configs/claude-desktop.md
+23-1Lines changed: 23 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,11 +33,31 @@ Incorporate the following into your `claude_desktop_config.json`, based on your
33
33
}
34
34
```
35
35
36
+
### Disabling Specific Tools
37
+
38
+
You can disable specific tools using the `-d` or `--disable-tools` flag:
39
+
40
+
```json
41
+
{
42
+
"mcpServers": {
43
+
"filesystem": {
44
+
"command": "rust-mcp-filesystem",
45
+
"args": [
46
+
"-d", "write_file,edit_file,move_file",
47
+
"~/Documents"
48
+
]
49
+
}
50
+
}
51
+
}
52
+
```
53
+
54
+
This example disables `write_file`, `edit_file` and `move_file`. See the [CLI Options](../guide/cli-command-options.md) documentation for more details.
55
+
36
56
## Running via Docker
37
57
38
58
**Note:** In the example below, all allowed directories are mounted to `/projects`, and `/projects` is passed as the allowed directory argument to the server CLI. You can modify this as needed to fit your requirements.
39
59
40
-
`ALLOW_WRITE`and `ENABLE_ROOTS` environments could be used to enable write and MCP Roots support.
60
+
`ALLOW_WRITE`, `ENABLE_ROOTS`, and `DISABLE_TOOLS` environments could be used to enable write, MCP Roots support, and disable specific tools.
41
61
42
62
```json
43
63
{
@@ -52,6 +72,8 @@ Incorporate the following into your `claude_desktop_config.json`, based on your
For a complete list of available tools and their names, see the [Capabilities](https://rust-mcp-stack.github.io/rust-mcp-filesystem/#/capabilities) page. Tool names are case-insensitive (e.g., `read_text_file` and `Read_Text_File` are equivalent).
Copy file name to clipboardExpand all lines: src/cli.rs
+41-1Lines changed: 41 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,6 @@
1
+
usecrate::tools::FileSystemTools;
1
2
use clap::{Parser, arg, command};
3
+
use std::collections::HashSet;
2
4
3
5
#[derive(Parser,Debug)]
4
6
#[command(name = env!("CARGO_PKG_NAME"))]
@@ -16,6 +18,14 @@ pub struct CommandArguments {
16
18
)]
17
19
puballow_write:bool,
18
20
21
+
#[arg(
22
+
short = 'd',
23
+
long = "disable-tools",
24
+
help = "Comma-separated list of tools to disable. By default, all tools are enabled.\nVisit https://rust-mcp-stack.github.io/rust-mcp-filesystem/#/capabilities to view the full list of available tools.",
25
+
env = "DISABLE_TOOLS"
26
+
)]
27
+
pubdisable_tools:Option<String>,
28
+
19
29
#[arg(
20
30
short = 't',
21
31
long,
@@ -32,16 +42,46 @@ pub struct CommandArguments {
32
42
required = false
33
43
)]
34
44
puballowed_directories:Vec<String>,
45
+
46
+
// internal-only field, not exposed as CLI arg
47
+
#[arg(skip)]
48
+
pubdisabled_tool_names:Option<Vec<String>>,
35
49
}
36
50
37
51
implCommandArguments{
38
-
pubfnvalidate(&self) -> Result<(),String>{
52
+
pubfnvalidate(&mutself) -> Result<(),String>{
39
53
if !self.enable_roots && self.allowed_directories.is_empty(){
40
54
returnErr(format!(
41
55
" <ALLOWED_DIRECTORIES> is required when `--enable-roots` is not provided.\n Run `{} --help` to view the usage instructions.",
42
56
env!("CARGO_PKG_NAME")
43
57
));
44
58
}
59
+
60
+
// verify disable_tools are valid
61
+
ifletSome(tools) = self.disable_tools.as_ref(){
62
+
let disabled_tools:Vec<_> = tools
63
+
.split(',')
64
+
.map(|t| t.trim().to_lowercase())
65
+
.filter(|t| !t.is_empty())
66
+
.collect();
67
+
68
+
let valid_tools:HashSet<_> = FileSystemTools::tools()
69
+
.iter()
70
+
.map(|t| t.name.to_lowercase())
71
+
.collect();
72
+
73
+
for tool in&disabled_tools {
74
+
if !valid_tools.contains(tool){
75
+
returnErr(format!(
76
+
"Invalid entry detected in the disable-tools list : '{}'",
77
+
tool
78
+
));
79
+
}
80
+
}
81
+
82
+
// Update the struct field with the cleaned list as a **comma-separated string**
0 commit comments