Patrick Rathje
commited on
Commit
·
f36616f
1
Parent(s):
25d2e66
update description and readme
Browse files
README.md
CHANGED
|
@@ -11,6 +11,13 @@ tags:
|
|
| 11 |
- mcp-server-track
|
| 12 |
---
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
## Run
|
| 15 |
|
| 16 |
```bash
|
|
@@ -24,4 +31,23 @@ One can disable editing files using the env variable *ALLOW_EDITING=false*:
|
|
| 24 |
docker run -p 7860:7860 -e ALLOW_EDITING=false fs_mcp
|
| 25 |
```
|
| 26 |
|
| 27 |
-
The MCP server will be available under *http://localhost:7860*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
- mcp-server-track
|
| 12 |
---
|
| 13 |
|
| 14 |
+
|
| 15 |
+
# Filesystem MCP Server
|
| 16 |
+
|
| 17 |
+
This is a simple MCP server based on Gradio that allows you to read and write files to a local directory.
|
| 18 |
+
The API is a simpler version of https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem .
|
| 19 |
+
Please note that this code is a proof of concept and not meant for production.
|
| 20 |
+
|
| 21 |
## Run
|
| 22 |
|
| 23 |
```bash
|
|
|
|
| 31 |
docker run -p 7860:7860 -e ALLOW_EDITING=false fs_mcp
|
| 32 |
```
|
| 33 |
|
| 34 |
+
The MCP server will be available under *http://localhost:7860*
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
## Mounting External Files
|
| 38 |
+
|
| 39 |
+
You can use Docker to mount external directories as well:
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
```bash
|
| 43 |
+
docker build -t fs_mcp .
|
| 44 |
+
docker run -p 7860:7860 -v $LOCAL_DIR:/app/files fs_mcp
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
If you do not want to allow editing the files, you can use *ALLOW_EDITING=false* and also prevent changes to your local filesystem by making the mount readonly:
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
```bash
|
| 51 |
+
docker build -t fs_mcp .
|
| 52 |
+
docker run -p 7860:7860 -v $LOCAL_DIR:/app/files:ro -e ALLOW_EDITING=false fs_mcp
|
| 53 |
+
```
|
app.py
CHANGED
|
@@ -62,6 +62,15 @@ def directory_tree(path):
|
|
| 62 |
return safe_exec(fs.directory_tree, path)
|
| 63 |
|
| 64 |
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
with gr.Tab("Read File"):
|
| 66 |
path = gr.Textbox(label="Path", value="index.md")
|
| 67 |
output = gr.Textbox(label="File Contents")
|
|
|
|
| 62 |
return safe_exec(fs.directory_tree, path)
|
| 63 |
|
| 64 |
with gr.Blocks() as demo:
|
| 65 |
+
|
| 66 |
+
gr.Markdown("""
|
| 67 |
+
# Filesystem MCP Server
|
| 68 |
+
|
| 69 |
+
This is a simple MCP server based on Gradio that allows you to read and write files to a local directory.
|
| 70 |
+
The API is a simpler version of https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem .
|
| 71 |
+
Please note that this code is a proof of concept and not meant for production.
|
| 72 |
+
""")
|
| 73 |
+
|
| 74 |
with gr.Tab("Read File"):
|
| 75 |
path = gr.Textbox(label="Path", value="index.md")
|
| 76 |
output = gr.Textbox(label="File Contents")
|