4 releases
Uses new Rust 2024
| 0.6.6 | Feb 22, 2026 |
|---|---|
| 0.6.5 | Jan 27, 2026 |
| 0.6.4 | Jan 4, 2026 |
| 0.6.3 | Jan 4, 2026 |
#523 in Filesystem
Used in 2 crates
165KB
2.5K
SLoC
mcp-execution-files
In-memory virtual filesystem for MCP tools organization and export.
Installation
[dependencies]
mcp-execution-files = "0.6"
Or with cargo-add:
cargo add mcp-execution-files
[!IMPORTANT] Requires Rust 1.89 or later.
Usage
Basic Usage
use mcp_execution_files::{FileSystem, FilesBuilder};
let fs = FilesBuilder::new()
.add_file("/mcp-tools/manifest.json", "{\"version\": \"1.0\"}")
.add_file("/mcp-tools/createIssue.ts", "export function createIssue() {}")
.build()
.unwrap();
// Read files
let content = fs.read_file("/mcp-tools/manifest.json").unwrap();
// Check existence
assert!(fs.exists("/mcp-tools/createIssue.ts"));
Directory Operations
use mcp_execution_files::FilesBuilder;
let fs = FilesBuilder::new()
.add_file("/servers/github/createIssue.ts", "// code")
.add_file("/servers/github/updateIssue.ts", "// code")
.add_file("/servers/github/getIssue.ts", "// code")
.build()
.unwrap();
let files = fs.list_dir("/servers/github").unwrap();
assert_eq!(files.len(), 3);
Integration with Code Generation
use mcp_execution_files::FilesBuilder;
use mcp_execution_codegen::{GeneratedCode, GeneratedFile};
let mut code = GeneratedCode::new();
code.add_file(GeneratedFile {
path: "createIssue.ts".to_string(),
content: "export function createIssue() {}".to_string(),
});
let vfs = FilesBuilder::from_generated_code(code, "/servers/github")
.build()
.unwrap();
assert!(vfs.exists("/servers/github/createIssue.ts"));
[!TIP] Use
from_generated_codeto seamlessly integrate withmcp-execution-codegenoutput.
Export to Disk
use mcp_execution_files::{FilesBuilder, ExportOptions};
use std::path::Path;
let fs = FilesBuilder::new()
.add_file("/github/createIssue.ts", "// code")
.build()
.unwrap();
let options = ExportOptions::default();
fs.export_to_disk(Path::new("~/.claude/servers"), &options)?;
[!NOTE] Export validates paths to prevent directory traversal attacks.
Features
- In-Memory Storage: Fast access without disk I/O during generation
- Builder Pattern: Fluent API for VFS construction
- Strong Types: Type-safe paths and error handling
- Disk Export: Write VFS contents to filesystem
- Thread-Safe: All types are
Send + Sync
Types Reference
| Type | Description |
|---|---|
FileSystem |
In-memory virtual filesystem |
FilesBuilder |
Builder for constructing FileSystem |
FilePath |
Validated file path (newtype) |
FileEntry |
File entry with path and content |
ExportOptions |
Options for disk export |
FilesError |
Error type for file operations |
Performance
| Operation | Target | Achieved |
|---|---|---|
| VFS export | <10ms | 1.2ms (8.3x faster) |
| Memory (1000 files) | <256MB | ~2MB |
Related Crates
This crate is part of the mcp-execution workspace:
mcp-execution-core- Foundation types used by this cratemcp-execution-codegen- Generates code that this crate organizes
MSRV Policy
Minimum Supported Rust Version: 1.89
MSRV increases are considered minor version bumps.
License
Licensed under either of Apache License 2.0 or MIT license at your option.
Dependencies
~16–24MB
~362K SLoC