@@ -38,28 +38,28 @@ customize the destination path inside the container.
3838
3939To enable file system access using the ` --volume ` flag, you specify the host
4040path and the container path in the ` thv run ` command. The syntax is the same as
41- Docker's volume syntax:
41+ Docker's volume syntax for bind mounts :
4242
4343``` bash
4444thv run --volume < HOST_PATH> :< CONTAINER_PATH> [:ro] < SERVER>
4545```
4646
47- You can specify multiple ` --volume ` flags to mount multiple paths.
47+ You can add the ` --volume ` flag multiple times to mount multiple paths.
4848
4949The optional ` :ro ` suffix makes the volume read-only in the container. This is
5050useful for sharing files without letting the MCP server modify them. For
51- example, to mount a host directory ` /example/ data ` as read-only in the container
52- at ` /data ` , run:
51+ example, to mount a host directory ` /home/user/ data ` as read-only in the
52+ container at ` /data ` , run:
5353
5454``` bash
55- thv run --volume /example /data:/data:ro < SERVER>
55+ thv run --volume /home/user /data:/data:ro < SERVER>
5656```
5757
58- To mount a host file ` /example /config.json ` as read-write in the container at
59- ` /config.json ` , run:
58+ To mount a host file ` /home/user /config.json ` as read-write in the container at
59+ ` /app/ config.json ` , run:
6060
6161``` bash
62- thv run --volume /example/ config.json:/config.json < SERVER>
62+ thv run --volume /home/user/ config.json:/app /config.json < SERVER>
6363```
6464
6565## Permission profiles
@@ -69,6 +69,14 @@ that specifies which host paths the MCP server can read or write. You can
6969include file system permissions alone or combine them with network permissions
7070in the same profile.
7171
72+ ::: note
73+
74+ Paths in permission profiles must be absolute paths on your host system.
75+ Relative paths and expanded paths (like ` ~/ ` ) are not supported. Always use full
76+ paths starting from the root directory (e.g., ` /home/user/documents ` ).
77+
78+ :::
79+
7280### File system-only profile
7381
7482Create a JSON file with your desired file system permissions:
@@ -129,6 +137,74 @@ thv run --isolate-network --permission-profile none --volume /home/user/aws-diag
129137This approach is useful when you need simple file system access combined with
130138standard network restrictions.
131139
140+ ## Examples
141+
142+ Below are some examples of how to use file system access with some common MCP
143+ servers in the ToolHive registry.
144+
145+ ### Filesystem MCP server
146+
147+ The
148+ [ Filesystem MCP server] ( https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem )
149+ lets you read and write files on your host system. By default, it expects paths
150+ to be mounted under ` /projects ` inside the container.
151+
152+ Here's how to mount two directories using the ` --volume ` flag, with one as
153+ read-only:
154+
155+ ``` bash
156+ thv run --volume ~ /documents:/projects/docs:ro --volume ~ /code:/projects/code filesystem
157+ ```
158+
159+ You can achieve the same result using a permission profile. Create a file called
160+ ` filesystem-profile.json ` :
161+
162+ ``` json title="filesystem-profile.json"
163+ {
164+ "read" : [" /home/user/documents" ],
165+ "write" : [" /home/user/code" ]
166+ }
167+ ```
168+
169+ Since permission profiles mount paths at the same location inside the container
170+ as they exist on your host, you need to tell the filesystem server which base
171+ directory to allow. Pass ` /home/user ` as an argument:
172+
173+ ``` bash
174+ thv run --permission-profile ./filesystem-profile.json filesystem -- /home/user
175+ ```
176+
177+ ### Memory MCP server
178+
179+ The
180+ [ Memory MCP server] ( https://github.com/modelcontextprotocol/servers/tree/main/src/memory )
181+ uses a local knowledge graph to persist information across chats.
182+
183+ To preserve data between runs, you need to mount a file. First, create an empty
184+ JSON file, then mount it to the expected location inside the container:
185+
186+ ``` bash
187+ touch ./memory.json
188+ thv run --volume ./memory.json:/app/dist/memory.json memory
189+ ```
190+
191+ ### SQLite MCP server
192+
193+ The [ SQLite MCP server] ( https://github.com/StacklokLabs/sqlite-mcp ) works with
194+ database files on your host system. By default, it expects to find a database
195+ file at ` /database.db ` inside the container:
196+
197+ ``` bash
198+ thv run --volume ~ /my-database.db:/database.db sqlite
199+ ```
200+
201+ If you want to place the database file in a different location inside the
202+ container, use the server's ` --db ` flag to specify the new path:
203+
204+ ``` bash
205+ thv run --volume ~ /my-database.db:/data/my-database.db sqlite --db /data/my-database.db
206+ ```
207+
132208## Troubleshooting
133209
134210<details >
0 commit comments