pub struct FilesystemProvider { /* private fields */ }Expand description
A resource provider that exposes filesystem directories.
Files under the configured root directory are exposed as MCP resources
with URIs like file://{prefix}/{relative_path}.
§Security
- Path traversal attempts (e.g.,
../../../etc/passwd) are blocked - Symlinks can be optionally followed or blocked
- Maximum file size limits prevent memory exhaustion
- Hidden files (starting with
.) can be excluded
§Example
ⓘ
use fastmcp_server::providers::FilesystemProvider;
let provider = FilesystemProvider::new("/app/data")
.with_prefix("data")
.with_patterns(&["*.json", "*.yaml"])
.with_recursive(true);Implementations§
Source§impl FilesystemProvider
impl FilesystemProvider
Sourcepub fn with_prefix(self, prefix: impl Into<String>) -> Self
pub fn with_prefix(self, prefix: impl Into<String>) -> Self
Sourcepub fn with_patterns(self, patterns: &[&str]) -> Self
pub fn with_patterns(self, patterns: &[&str]) -> Self
Sourcepub fn with_exclude(self, patterns: &[&str]) -> Self
pub fn with_exclude(self, patterns: &[&str]) -> Self
Sourcepub fn with_recursive(self, enabled: bool) -> Self
pub fn with_recursive(self, enabled: bool) -> Self
Sourcepub fn with_max_size(self, bytes: usize) -> Self
pub fn with_max_size(self, bytes: usize) -> Self
Sourcepub fn with_follow_symlinks(self, enabled: bool) -> Self
pub fn with_follow_symlinks(self, enabled: bool) -> Self
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Trait Implementations§
Source§impl Clone for FilesystemProvider
impl Clone for FilesystemProvider
Source§fn clone(&self) -> FilesystemProvider
fn clone(&self) -> FilesystemProvider
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for FilesystemProvider
impl RefUnwindSafe for FilesystemProvider
impl Send for FilesystemProvider
impl Sync for FilesystemProvider
impl Unpin for FilesystemProvider
impl UnwindSafe for FilesystemProvider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).