# openai/mcpfs architecture

> Architecture diagram of the GitHub repository openai/mcpfs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/openai/mcpfs
- Repository: https://github.com/openai/mcpfs

## Overview

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: [`vfs/src/mcp.rs`](https://github.com/openai/mcpfs/blob/main/vfs/src/mcp.rs) (MCP discovery and operations), [`vfs/src/session.rs`](https://github.com/openai/mcpfs/blob/main/vfs/src/session.rs) (Session orchestration), [`vfs/src/tree.rs`](https://github.com/openai/mcpfs/blob/main/vfs/src/tree.rs) (Namespace projection), [`virtiofs/src/main.rs`](https://github.com/openai/mcpfs/blob/main/virtiofs/src/main.rs) (virtio-fs daemon)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mount["Mount adapters"]
  node_mount_cli["Mount CLI<br/>[main.rs]"]
  node_fuse_adapter["FUSE adapter<br/>[fs.rs]"]
  node_virtio_daemon["virtio-fs daemon<br/>[main.rs]"]
  node_virtio_adapter["Guest filesystem<br/>[fs.rs]"]
  node_vhost_transport["vhost-user transport<br/>[transport.rs]"]
end

subgraph group_vfs["Virtual filesystem"]
  node_vfs_api["VFS API / handles<br/>[lib.rs]"]
  node_session["Session orchestration<br/>[session.rs]"]
  node_namespace["Namespace projection<br/>[tree.rs]"]
  node_resource_cache[("Resource cache<br/>[cache.rs]")]
  node_catalog_budget["Catalog budget<br/>[catalog_budget.rs]"]
  node_catalog_results["Catalog result handling<br/>[catalog_result.rs]"]
end

subgraph group_mcp["MCP integration"]
  node_mcp_protocol["MCP discovery and operations<br/>[mcp.rs]"]
  node_http_transport["Streamable HTTP<br/>[http.rs]"]
  node_stdio_transport["Local stdio<br/>[stdio.rs]"]
end

subgraph group_commands["User commands"]
  node_tool_scripts["Tool scripts<br/>[tool.rs]"]
  node_tool_help["Tool help generation<br/>[help.rs]"]
  node_search["Catalog search<br/>[search.rs]"]
  node_ioctl_abi["Tool invocation ABI<br/>[lib.rs]"]
  node_guest_helper["Guest helper CLI<br/>[main.rs]"]
end

node_user(("Filesystem user"))
node_servers(("MCP servers"))
node_vmm(("VMM / guest"))

node_user -->|"starts mount"| node_mount_cli
node_mount_cli -->|"configures servers"| node_session
node_session -->|"connects sessions"| node_mcp_protocol
node_mcp_protocol -->|"uses HTTP"| node_http_transport
node_mcp_protocol -->|"uses stdio"| node_stdio_transport
node_http_transport -->|"sends requests"| node_servers
node_stdio_transport -->|"launches command"| node_servers
node_mcp_protocol -->|"charges catalog"| node_catalog_budget
node_mcp_protocol -->|"preserves replies"| node_catalog_results
node_mcp_protocol -->|"reads resources"| node_resource_cache
node_session -->|"builds tree"| node_namespace
node_namespace -->|"generates scripts"| node_tool_scripts
node_namespace -->|"builds index"| node_search
node_tool_scripts -->|"renders help"| node_tool_help
node_user -->|"reads mount"| node_fuse_adapter
node_fuse_adapter -->|"serves filesystem"| node_vfs_api
node_vfs_api -->|"invokes tools"| node_ioctl_abi
node_user -->|"runs search"| node_search
node_search -->|"searches catalog"| node_namespace
node_user -->|"runs script"| node_tool_scripts
node_ioctl_abi -.->|"uses helper"| node_guest_helper
node_virtio_daemon -->|"starts backend"| node_session
node_virtio_daemon -->|"serves requests"| node_virtio_adapter
node_virtio_adapter -->|"maps operations"| node_vfs_api
node_virtio_daemon -->|"serves queues"| node_vhost_transport
node_vmm -->|"connects socket"| node_vhost_transport
node_vmm -->|"mounts share"| node_guest_helper

click node_mount_cli "https://github.com/openai/mcpfs/blob/main/fusefs/src/main.rs"
click node_fuse_adapter "https://github.com/openai/mcpfs/blob/main/fusefs/src/fs.rs"
click node_virtio_daemon "https://github.com/openai/mcpfs/blob/main/virtiofs/src/main.rs"
click node_virtio_adapter "https://github.com/openai/mcpfs/blob/main/virtiofs/src/fs.rs"
click node_vhost_transport "https://github.com/openai/mcpfs/blob/main/virtiofs/src/transport.rs"
click node_vfs_api "https://github.com/openai/mcpfs/blob/main/vfs/src/lib.rs"
click node_session "https://github.com/openai/mcpfs/blob/main/vfs/src/session.rs"
click node_namespace "https://github.com/openai/mcpfs/blob/main/vfs/src/tree.rs"
click node_resource_cache "https://github.com/openai/mcpfs/blob/main/vfs/src/cache.rs"
click node_catalog_budget "https://github.com/openai/mcpfs/blob/main/vfs/src/catalog_budget.rs"
click node_catalog_results "https://github.com/openai/mcpfs/blob/main/vfs/src/catalog_result.rs"
click node_mcp_protocol "https://github.com/openai/mcpfs/blob/main/vfs/src/mcp.rs"
click node_http_transport "https://github.com/openai/mcpfs/blob/main/vfs/src/http.rs"
click node_stdio_transport "https://github.com/openai/mcpfs/blob/main/vfs/src/stdio.rs"
click node_tool_scripts "https://github.com/openai/mcpfs/blob/main/vfs/src/tool.rs"
click node_tool_help "https://github.com/openai/mcpfs/blob/main/vfs/src/tool/help.rs"
click node_search "https://github.com/openai/mcpfs/blob/main/vfs/src/search.rs"
click node_ioctl_abi "https://github.com/openai/mcpfs/blob/main/ioctl/src/lib.rs"
click node_guest_helper "https://github.com/openai/mcpfs/blob/main/src/main.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_mount_cli,node_fuse_adapter,node_virtio_daemon,node_virtio_adapter,node_vhost_transport,node_user toneBlue
class node_vfs_api,node_session,node_namespace,node_resource_cache,node_catalog_budget,node_catalog_results toneAmber
class node_mcp_protocol,node_http_transport,node_stdio_transport,node_servers toneMint
class node_tool_scripts,node_tool_help,node_search,node_ioctl_abi,node_guest_helper toneRose
class node_vmm toneIndigo
```

## Components

### Mount adapters

- [Mount CLI](https://github.com/openai/mcpfs/blob/main/fusefs/src/main.rs): `fusefs/src/main.rs`
- [FUSE adapter](https://github.com/openai/mcpfs/blob/main/fusefs/src/fs.rs): `fusefs/src/fs.rs`
- [virtio-fs daemon](https://github.com/openai/mcpfs/blob/main/virtiofs/src/main.rs): `virtiofs/src/main.rs`
- [Guest filesystem](https://github.com/openai/mcpfs/blob/main/virtiofs/src/fs.rs): `virtiofs/src/fs.rs`
- [vhost-user transport](https://github.com/openai/mcpfs/blob/main/virtiofs/src/transport.rs): `virtiofs/src/transport.rs`

### Virtual filesystem

- [VFS API / handles](https://github.com/openai/mcpfs/blob/main/vfs/src/lib.rs): `vfs/src/lib.rs`
- [Session orchestration](https://github.com/openai/mcpfs/blob/main/vfs/src/session.rs): `vfs/src/session.rs`
- [Namespace projection](https://github.com/openai/mcpfs/blob/main/vfs/src/tree.rs): `vfs/src/tree.rs`
- [Resource cache](https://github.com/openai/mcpfs/blob/main/vfs/src/cache.rs): `vfs/src/cache.rs`
- [Catalog budget](https://github.com/openai/mcpfs/blob/main/vfs/src/catalog_budget.rs): `vfs/src/catalog_budget.rs`
- [Catalog result handling](https://github.com/openai/mcpfs/blob/main/vfs/src/catalog_result.rs): `vfs/src/catalog_result.rs`

### MCP integration

- [MCP discovery and operations](https://github.com/openai/mcpfs/blob/main/vfs/src/mcp.rs): `vfs/src/mcp.rs`
- [Streamable HTTP](https://github.com/openai/mcpfs/blob/main/vfs/src/http.rs): `vfs/src/http.rs`
- [Local stdio](https://github.com/openai/mcpfs/blob/main/vfs/src/stdio.rs): `vfs/src/stdio.rs`

### User commands

- [Tool scripts](https://github.com/openai/mcpfs/blob/main/vfs/src/tool.rs): `vfs/src/tool.rs`
- [Tool help generation](https://github.com/openai/mcpfs/blob/main/vfs/src/tool/help.rs): `vfs/src/tool/help.rs`
- [Catalog search](https://github.com/openai/mcpfs/blob/main/vfs/src/search.rs): `vfs/src/search.rs`
- [Tool invocation ABI](https://github.com/openai/mcpfs/blob/main/ioctl/src/lib.rs): `ioctl/src/lib.rs`
- [Guest helper CLI](https://github.com/openai/mcpfs/blob/main/src/main.rs): `src/main.rs`

### Other components

- **Filesystem user**
- **MCP servers**
- **VMM / guest**

## Connections

- Filesystem user → Mount CLI: starts mount (evidence: `README.md`)
- Mount CLI → Session orchestration: configures servers (evidence: `vfs/src/session.rs`)
- Session orchestration → MCP discovery and operations: connects sessions (evidence: `vfs/src/session.rs`)
- MCP discovery and operations → Streamable HTTP: uses HTTP (evidence: `vfs/src/mcp.rs`)
- MCP discovery and operations → Local stdio: uses stdio (evidence: `vfs/src/mcp.rs`)
- Streamable HTTP → MCP servers: sends requests (evidence: `README.md`)
- Local stdio → MCP servers: launches command (evidence: `README.md`)
- MCP discovery and operations → Catalog budget: charges catalog (evidence: `vfs/src/mcp.rs`)
- MCP discovery and operations → Catalog result handling: preserves replies (evidence: `vfs/src/mcp.rs`)
- MCP discovery and operations → Resource cache: reads resources (evidence: `vfs/src/mcp.rs`)
- Session orchestration → Namespace projection: builds tree (evidence: `vfs/src/session.rs`)
- Namespace projection → Tool scripts: generates scripts (evidence: `vfs/src/tree.rs`)
- Namespace projection → Catalog search: builds index (evidence: `vfs/src/tree.rs`)
- Tool scripts → Tool help generation: renders help (evidence: `vfs/src/tool.rs`)
- Filesystem user → FUSE adapter: reads mount (evidence: `README.md`)
- FUSE adapter → VFS API / handles: serves filesystem (evidence: `README.md`)
- VFS API / handles → Tool invocation ABI: invokes tools (evidence: `README.md`)
- Filesystem user → Catalog search: runs search (evidence: `README.md`)
- Catalog search → Namespace projection: searches catalog (evidence: `vfs/src/search.rs`)
- Filesystem user → Tool scripts: runs script (evidence: `README.md`)
- Tool invocation ABI → Guest helper CLI: uses helper
- virtio-fs daemon → Session orchestration: starts backend (evidence: `README.md`)
- virtio-fs daemon → Guest filesystem: serves requests (evidence: `virtiofs/src/main.rs`)
- Guest filesystem → VFS API / handles: maps operations (evidence: `README.md`)
- virtio-fs daemon → vhost-user transport: serves queues (evidence: `virtiofs/src/main.rs`)
- VMM / guest → vhost-user transport: connects socket (evidence: `README.md`)
- VMM / guest → Guest helper CLI: mounts share (evidence: `README.md`)
