Skip to content

Commit f3891aa

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

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
@@ -927,14 +927,14 @@ server.oninitialized = async () => {
927927
if (response && 'roots' in response) {
928928
await updateAllowedDirectoriesFromRoots(response.roots);
929929
} else {
930-
console.log("Client returned no roots set, keeping current settings");
930+
console.error("Client returned no roots set, keeping current settings");
931931
}
932932
} catch (error) {
933933
console.error("Failed to request initial roots from client:", error instanceof Error ? error.message : String(error));
934934
}
935935
} else {
936936
if (allowedDirectories.length > 0) {
937-
console.log("Client does not support MCP Roots, using allowed directories set from server args:", allowedDirectories);
937+
console.error("Client does not support MCP Roots, using allowed directories set from server args:", allowedDirectories);
938938
}else{
939939
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.`);
940940
}
@@ -947,7 +947,7 @@ async function runServer() {
947947
await server.connect(transport);
948948
console.error("Secure MCP Filesystem Server running on stdio");
949949
if (allowedDirectories.length === 0) {
950-
console.log("Started without allowed directories - waiting for client to provide roots via MCP protocol");
950+
console.error("Started without allowed directories - waiting for client to provide roots via MCP protocol");
951951
}
952952
}
953953

0 commit comments

Comments
 (0)