Skip to content

Commit 5a780bb

Browse files
nandshaolaservo
andcommitted
Apply suggestions from code review comments on docs and logging
Co-authored-by: Ola Hungerford <olahungerford@gmail.com>
1 parent c8c489c commit 5a780bb

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/filesystem/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,26 @@ Node.js server implementing Model Context Protocol (MCP) for filesystem operatio
99
- Move files/directories
1010
- Search files
1111
- Get file metadata
12-
- Dynamic directory access control via MCP roots protocol
12+
- Dynamic directory access control via [Roots](https://modelcontextprotocol.io/docs/concepts/roots)
1313

1414
## Directory Access Control
1515

16-
The server uses a flexible directory access control system. Directories can be specified via command-line arguments or dynamically via the MCP roots protocol.
16+
The server uses a flexible directory access control system. Directories can be specified via command-line arguments or dynamically via [Roots](https://modelcontextprotocol.io/docs/concepts/roots).
1717

1818
### Method 1: Command-line Arguments
1919
Specify Allowed directories when starting the server:
2020
```bash
2121
mcp-server-filesystem /path/to/dir1 /path/to/dir2
2222
```
2323

24-
### Method 2: MCP Roots Protocol (Recommended)
25-
MCP clients that support the roots protocol can dynamically update the Allowed directories.
24+
### Method 2: MCP Roots (Recommended)
25+
MCP clients that support [Roots](https://modelcontextprotocol.io/docs/concepts/roots) can dynamically update the Allowed directories.
2626

2727
Roots notified by Client to Server, completely replace any server-side Allowed directories when provided.
2828

2929
**Important**: If server starts without command-line arguments AND client doesn't support roots protocol (or provides empty roots), the server will throw an error during initialization.
3030

31-
This is the recommended method, as MCP roots protocol for dynamic directory management. This enables runtime directory updates via `roots/list_changed` notifications without server restart, providing a more flexible and modern integration experience.
31+
This is the recommended method, as this enables runtime directory updates via `roots/list_changed` notifications without server restart, providing a more flexible and modern integration experience.
3232

3333
### How It Works
3434

src/filesystem/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -876,14 +876,14 @@ server.oninitialized = async () => {
876876
if (response && 'roots' in response) {
877877
await updateAllowedDirectoriesFromRoots(response.roots);
878878
} else {
879-
console.log("Client returned no roots set, keeping current settings");
879+
console.error("Client returned no roots set, keeping current settings");
880880
}
881881
} catch (error) {
882882
console.error("Failed to request initial roots from client:", error instanceof Error ? error.message : String(error));
883883
}
884884
} else {
885885
if (allowedDirectories.length > 0) {
886-
console.log("Client does not support MCP Roots, using allowed directories set from server args:", allowedDirectories);
886+
console.error("Client does not support MCP Roots, using allowed directories set from server args:", allowedDirectories);
887887
}else{
888888
throw new Error(`Server cannot operate: No allowed directories available. Server was started without command-line directories and client either does not support MCP roots protocol or 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.`);
889889
}
@@ -896,7 +896,7 @@ async function runServer() {
896896
await server.connect(transport);
897897
console.error("Secure MCP Filesystem Server running on stdio");
898898
if (allowedDirectories.length === 0) {
899-
console.log("Started without allowed directories - waiting for client to provide roots via MCP protocol");
899+
console.error("Started without allowed directories - waiting for client to provide roots via MCP protocol");
900900
}
901901
}
902902

0 commit comments

Comments
 (0)