How openai/mcpfs works
mcpfs mounts MCP servers as a read-only filesystem: the mount command starts server sessions and discovers their catalogs, the VFS projects resources, skills, and tools into paths, and users read files or invoke generated tool scripts. FUSE serves local mounts; virtio-fs serves guest requests over vhost-user. Search and the shared tool-invocation ABI are additional user-facing capabilities. Relationships reflect the README and shown source references; unsampled adapter and runtime details are not inferred.
Main entry points: mcp.rs MCP discovery and operations · session.rs Session orchestration · tree.rs Namespace projection · main.rs virtio-fs daemon
Components 22
Mount adapters
- Mount CLI
fusefs/src/main.rs - FUSE adapter
fusefs/src/fs.rs - virtio-fs daemon
virtiofs/src/main.rs - Guest filesystem
virtiofs/src/fs.rs - vhost-user transport
virtiofs/src/transport.rs
Virtual filesystem
- VFS API / handles
vfs/src/lib.rs - Session orchestration
vfs/src/session.rs - Namespace projection
vfs/src/tree.rs - Resource cache
vfs/src/cache.rs - Catalog budget
vfs/src/catalog_budget.rs - Catalog result handling
vfs/src/catalog_result.rs
MCP integration
- MCP discovery and operations
vfs/src/mcp.rs - Streamable HTTP
vfs/src/http.rs - Local stdio
vfs/src/stdio.rs
User commands
- Tool scripts
vfs/src/tool.rs - Tool help generation
vfs/src/tool/help.rs - Catalog search
vfs/src/search.rs - Tool invocation ABI
ioctl/src/lib.rs - Guest helper CLI
src/main.rs
Other components
- Filesystem user
- MCP servers
- VMM / guest
Connections 27
- Filesystem user → Mount CLI: starts mount
README.md - Mount CLI → Session orchestration: configures servers
vfs/src/session.rs - Session orchestration → MCP discovery and operations: connects sessions
vfs/src/session.rs - MCP discovery and operations → Streamable HTTP: uses HTTP
vfs/src/mcp.rs - MCP discovery and operations → Local stdio: uses stdio
vfs/src/mcp.rs - Streamable HTTP → MCP servers: sends requests
README.md - Local stdio → MCP servers: launches command
README.md - MCP discovery and operations → Catalog budget: charges catalog
vfs/src/mcp.rs - MCP discovery and operations → Catalog result handling: preserves replies
vfs/src/mcp.rs - MCP discovery and operations → Resource cache: reads resources
vfs/src/mcp.rs - Session orchestration → Namespace projection: builds tree
vfs/src/session.rs - Namespace projection → Tool scripts: generates scripts
vfs/src/tree.rs - Namespace projection → Catalog search: builds index
vfs/src/tree.rs - Tool scripts → Tool help generation: renders help
vfs/src/tool.rs - Filesystem user → FUSE adapter: reads mount
README.md - FUSE adapter → VFS API / handles: serves filesystem
README.md - VFS API / handles → Tool invocation ABI: invokes tools
README.md - Filesystem user → Catalog search: runs search
README.md - Catalog search → Namespace projection: searches catalog
vfs/src/search.rs - Filesystem user → Tool scripts: runs script
README.md - Tool invocation ABI → Guest helper CLI: uses helper
- virtio-fs daemon → Session orchestration: starts backend
README.md - virtio-fs daemon → Guest filesystem: serves requests
virtiofs/src/main.rs - Guest filesystem → VFS API / handles: maps operations
README.md - virtio-fs daemon → vhost-user transport: serves queues
virtiofs/src/main.rs - VMM / guest → vhost-user transport: connects socket
README.md - VMM / guest → Guest helper CLI: mounts share
README.md