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: src/handler.rs
+43-39Lines changed: 43 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -88,47 +88,45 @@ impl FileSystemHandler {
88
88
let fs_service = self.fs_service.clone();
89
89
let mcp_roots_support = self.mcp_roots_support;
90
90
// retrieve roots from the client and update the allowed directories accordingly
91
-
tokio::spawn(asyncmove{
92
-
let roots = match runtime.clone().list_roots(None).await{
93
-
Ok(roots_result) => roots_result.roots,
94
-
Err(_err) => {
95
-
vec![]
96
-
}
97
-
};
98
-
99
-
let valid_roots = if roots.is_empty(){
91
+
let roots = match runtime.clone().list_roots(None).await{
92
+
Ok(roots_result) => roots_result.roots,
93
+
Err(_err) => {
100
94
vec![]
101
-
}else{
102
-
let roots:Vec<_> = roots.iter().map(|v| v.uri.as_str()).collect();
103
-
104
-
match fs_service.valid_roots(roots){
105
-
Ok((roots, skipped)) => {
106
-
ifletSome(message) = skipped {
107
-
let _ = runtime.stderr_message(message.to_string()).await;
108
-
}
109
-
roots
95
+
}
96
+
};
97
+
98
+
let valid_roots = if roots.is_empty(){
99
+
vec![]
100
+
}else{
101
+
let roots:Vec<_> = roots.iter().map(|v| v.uri.as_str()).collect();
102
+
103
+
match fs_service.valid_roots(roots){
104
+
Ok((roots, skipped)) => {
105
+
ifletSome(message) = skipped {
106
+
let _ = runtime.stderr_message(message.to_string()).await;
110
107
}
111
-
Err(_err) => vec![],
108
+
roots
112
109
}
113
-
};
110
+
Err(_err) => vec![],
111
+
}
112
+
};
114
113
115
-
if valid_roots.is_empty() && !mcp_roots_support {
116
-
let message = if allowed_directories.is_empty(){
117
-
"Server cannot operate: No allowed directories available. Server was started without command-line directories and client provided empty roots. Please either: 1) Start server with directory arguments, or 2) Use a client that supports MCP roots protocol and provides valid root directories."
118
-
}else{
119
-
"Client provided empty roots. Allowed directories passed from command-line will be used."
120
-
};
121
-
let _ = runtime.stderr_message(message.to_string()).await;
114
+
if valid_roots.is_empty() && !mcp_roots_support {
115
+
let message = if allowed_directories.is_empty(){
116
+
"Server cannot operate: No allowed directories available. Server was started without command-line directories and client provided empty roots. Please either: 1) Start server with directory arguments, or 2) Use a client that supports MCP roots protocol and provides valid root directories."
122
117
}else{
123
-
let num_valid_roots = valid_roots.len();
118
+
"Client provided empty roots. Allowed directories passed from command-line will be used."
119
+
};
120
+
let _ = runtime.stderr_message(message.to_string()).await;
0 commit comments