Skip to content

Commit 1afeefa

Browse files
committed
internal/mcp: unexport FileResourceHandler
Unexport our nice root-respecting local-filesystem resource handler. It's unclear how roots should interact with a resource handler that uses the local filesystem. All we know from the spec is that servers should "respect root boundaries during operations," but it's not clear how they can do that reliably if root changes are notifications, meaning there is no causality between a client changing a root and then asking the server for a file. (Maybe the server sees the new roots, maybe it doesn't.) The spec is loose about all this: it feels more like a sketch. No other SDK seems to devote much to providing a local helper, and those that do (Python) don't look at roots. Change-Id: Ia4d9abb9bc1a6450e1fc8e607df5d7bc6aa227e3 Reviewed-on: https://go-review.googlesource.com/c/tools/+/678855 Reviewed-by: Robert Findley <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 33d5988 commit 1afeefa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/mcp/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ func (s *Server) readResource(ctx context.Context, ss *ServerSession, params *Re
291291
return res, nil
292292
}
293293

294-
// FileResourceHandler returns a ReadResourceHandler that reads paths using dir as
294+
// fileResourceHandler returns a ReadResourceHandler that reads paths using dir as
295295
// a base directory.
296296
// It honors client roots and protects against path traversal attacks.
297297
//
@@ -303,7 +303,7 @@ func (s *Server) readResource(ctx context.Context, ss *ServerSession, params *Re
303303
// Lexical path traversal attacks, where the path has ".." elements that escape dir,
304304
// are always caught. Go 1.24 and above also protects against symlink-based attacks,
305305
// where symlinks under dir lead out of the tree.
306-
func (s *Server) FileResourceHandler(dir string) ResourceHandler {
306+
func (s *Server) fileResourceHandler(dir string) ResourceHandler {
307307
return fileResourceHandler(dir)
308308
}
309309

0 commit comments

Comments
 (0)