file-share-mcp 1.0.19 → 1.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +233 -233
  2. package/dist/version.js +16 -1
  3. package/package.json +3 -4
package/README.md CHANGED
@@ -1,233 +1,233 @@
1
- # File Share MCP
2
-
3
- An MCP server for bidirectional file sharing between AI agents and users, with a built-in web GUI.
4
-
5
- The agent can list, read, and notify about files. The user can upload, download, and delete files via the GUI — all through a shared local folder.
6
-
7
- ## Features
8
-
9
- - **MCP Tools** for the AI agent:
10
- - `get_shared_folder` — Get the current shared folder path
11
- - `list_shared_files` — List all files available in the shared folder
12
- - `share_file` — Notify the user that a file is ready to download
13
- - `preview_file` — Read the content of a `.txt` or `.md` file (max 1 MB)
14
- - `write_file` — Write text content to a new file in the shared folder
15
- - `copy_file` — Copy a file from the agent machine into the shared folder (see [Moving files across machines](#moving-files-across-machines))
16
- - `download_file` — Copy a file from the shared folder onto the agent machine (any file type, binary included — see [Downloading to the agent machine](#downloading-to-the-agent-machine))
17
- - `create_directory` / `delete_directory` — Manage subdirectories
18
- - `move_file` — Move or rename a file inside the shared folder
19
- - **Web GUI** — Upload, download, preview, and delete files from a browser
20
- - **Zero config** — works out of the box with sensible defaults (`~/.file-share-mcp`)
21
- - **Proxy-ready** — optional integration with the [file-share-mcp proxy](https://github.com/...)
22
-
23
- ---
24
-
25
- ## Quick Start with Cursor
26
-
27
- Add this to your Cursor MCP configuration (`~/.cursor/mcp.json` or your workspace `.cursor/mcp.json`):
28
-
29
- ```json
30
- {
31
- "mcpServers": {
32
- "file-share": {
33
- "command": "npx",
34
- "args": ["-y", "file-share-mcp"]
35
- }
36
- }
37
- }
38
- ```
39
-
40
- Once added, restart Cursor. The GUI will be available at **http://localhost:3005**.
41
-
42
- ---
43
-
44
- ## Quick Start with Claude Desktop
45
-
46
- Add this to your Claude Desktop configuration (`claude_desktop_config.json`):
47
-
48
- ```json
49
- {
50
- "mcpServers": {
51
- "file-share": {
52
- "command": "npx",
53
- "args": ["-y", "file-share-mcp"]
54
- }
55
- }
56
- }
57
- ```
58
-
59
- ---
60
-
61
- ## Configuration (optional)
62
-
63
- All configuration is done via environment variables, passed in the MCP `env` block or in a `.env` file inside the package directory.
64
-
65
- | Variable | Default | Description |
66
- |---|---|---|
67
- | `GUI_PORT` | `3005` | Port for the web GUI |
68
- | `MCP_DATA_DIR` | `~/.file-share-mcp` | Directory for `configs.json` and persistent data |
69
- | `PROXY_URL` | _(none)_ | URL of the proxy server (optional) |
70
- | `PROXY_APP_PATH` | `/file-share` | Path to register on the proxy |
71
- | `PROXY_APP_NAME` | `File Share MCP` | Display name shown in the proxy dashboard |
72
- | `APP_GROUP` | _(none)_ | Groups the app under a collapsible section (folded by default) in the proxy dashboard. Apps sharing the same value appear together; if unset, the app lands in the default "ungrouped" section |
73
-
74
- ### Example: custom port and data directory
75
-
76
- ```json
77
- {
78
- "mcpServers": {
79
- "file-share": {
80
- "command": "npx",
81
- "args": ["-y", "file-share-mcp"],
82
- "env": {
83
- "GUI_PORT": "3010",
84
- "MCP_DATA_DIR": "C:/Users/YourName/my-shared-files"
85
- }
86
- }
87
- }
88
- }
89
- ```
90
-
91
- ### Example: with proxy integration
92
-
93
- ```json
94
- {
95
- "mcpServers": {
96
- "file-share": {
97
- "command": "npx",
98
- "args": ["-y", "file-share-mcp"],
99
- "env": {
100
- "PROXY_URL": "http://localhost:3000",
101
- "PROXY_APP_PATH": "/file-share",
102
- "PROXY_APP_NAME": "File Share MCP",
103
- "APP_GROUP": "Files"
104
- }
105
- }
106
- }
107
- }
108
- ```
109
-
110
- ---
111
-
112
- ## Moving files across machines
113
-
114
- Two tools move a file between the agent and the shared folder, in opposite directions:
115
-
116
- | Tool | Direction | Names the file with |
117
- |---|---|---|
118
- | `copy_file` | agent machine → shared folder | `source_path` (absolute file path) |
119
- | `download_file` | shared folder → agent machine | `destination_path` (absolute directory) |
120
-
121
- Both are straightforward **over stdio**, the usual case where the MCP server is a child
122
- process of the agent: one filesystem, and the paths mean the same thing on both sides.
123
- Nothing to configure.
124
-
125
- **Through [`@imenam/mcp-http-gateway`](https://www.npmjs.com/package/@imenam/mcp-http-gateway)**
126
- the server runs on the gateway machine, and neither path means anything there. MCP has no
127
- file-transfer primitive — only the bytes a message carries actually travel — so the relay,
128
- which runs next to the agent in `--mcp` mode, fills the gap in both directions. Configure it
129
- with `GATEWAY_INLINE_ROOTS` (reading, for `copy_file`) and `GATEWAY_INLINE_WRITE_ROOTS`
130
- (writing, for `download_file`). Those two directory lists are the whole configuration: every
131
- file type is allowed by default.
132
-
133
- Neither direction has a fallback. With the relay in the chain but the matching root
134
- unconfigured, the call fails and names the variable to set; nothing is read, written, or
135
- dumped into the conversation.
136
-
137
- ### Uploading: `copy_file`
138
-
139
- `source_path` is the absolute path of the file on the agent machine. Through the relay, the
140
- hidden `source_content` / `source_name` parameters carry the file itself; the agent only ever
141
- names a path.
142
-
143
- ### Downloading: `download_file`
144
-
145
- `destination_path` is the **absolute directory** where the file should land on the agent
146
- machine. The file keeps its own name; `destination_overwrite` (default `false`) governs
147
- replacing an existing file.
148
- **absolute directory** where it should land on the agent machine. The file keeps its own
149
- name; `destination_overwrite` (default `false`) governs replacing an existing file.
150
-
151
- Through the relay, the hidden `destination_relay` flag tells the server the destination is
152
- on another machine: it then returns the file's bytes in its response, and the relay writes
153
- them and strips them from the result. The bytes never reach the agent's context — an 8 MiB
154
- file base64-encoded into a conversation would be costly, and an agent re-typing it by hand
155
- would corrupt it.
156
-
157
- ---
158
-
159
- ## Data & Logs
160
-
161
- By default, all user data is stored in `~/.file-share-mcp/`:
162
-
163
- ```
164
- ~/.file-share-mcp/
165
- ├── configs.json # Saved configuration (shared folder path, etc.)
166
- ├── shared/ # Default shared folder
167
- │ └── .uploads-tmp/ # Staging area for in-flight GUI uploads (hidden, purged at startup)
168
- └── logs/
169
- └── server.log # Application logs
170
- ```
171
-
172
- This directory survives package updates and reinstalls. Both processes (MCP server
173
- and GUI) log under `<data dir>/logs`, never under the working directory — the cwd of
174
- an MCP launched by a gateway is not its own and is not necessarily writable.
175
-
176
- Uploads are staged in `.uploads-tmp` inside the shared folder rather than in the
177
- system temp directory, so the final move never crosses a mount boundary. `rename()`
178
- returns `EXDEV` as soon as it does, even when both sides are on the same filesystem —
179
- which is the case under systemd `PrivateTmp=yes`, with `/tmp` on tmpfs, or with a
180
- `TMPDIR` on another volume. A copy-then-rename fallback covers the remaining case
181
- where `MCP_DATA_DIR` and a custom `shared_folder_path` sit on different volumes.
182
-
183
- ---
184
-
185
- ## Network exposure
186
-
187
- The GUI server listens on `127.0.0.1` only. Other machines reach it through the proxy or
188
- the gateway manager, which relay to `localhost`.
189
-
190
- Every GUI request goes through the request guard of `@imenam/mcp-gui-interface`: it
191
- refuses (HTTP 403) a `Host` header other than `localhost` / `127.0.0.1` / `::1`, and any
192
- modifying request (other than GET, HEAD, OPTIONS) that the browser marks as coming from
193
- another site (`Sec-Fetch-Site`, or `Origin` outside this machine and the proxy).
194
-
195
- The GUI sends no CORS headers: the frontend is served by the same server, and other
196
- websites cannot read the shared files through the browser.
197
-
198
- ---
199
-
200
- ## Development
201
-
202
- ```bash
203
- # Install dependencies
204
- npm install
205
- cd gui && npm install && cd ..
206
-
207
- # Build (backend + frontend)
208
- npm run build
209
-
210
- # Start
211
- npm start
212
- ```
213
-
214
- ### Project structure
215
-
216
- ```
217
- src/
218
- ├── mcp-server.ts # MCP server (MASTER process)
219
- ├── gui.ts # Express GUI server (WORKER process)
220
- └── utils/
221
- ├── config-manager.ts
222
- ├── file-manager.ts
223
- ├── logger.ts
224
- └── generate-version.ts
225
- gui/ # React + Vite frontend (builds to ../public/)
226
- public/ # Built frontend (served by the GUI server)
227
- ```
228
-
229
- ---
230
-
231
- ## License
232
-
233
- ISC
1
+ # File Share MCP
2
+
3
+ An MCP server for bidirectional file sharing between AI agents and users, with a built-in web GUI.
4
+
5
+ The agent can list, read, and notify about files. The user can upload, download, and delete files via the GUI — all through a shared local folder.
6
+
7
+ ## Features
8
+
9
+ - **MCP Tools** for the AI agent:
10
+ - `get_shared_folder` — Get the current shared folder path
11
+ - `list_shared_files` — List all files available in the shared folder
12
+ - `share_file` — Notify the user that a file is ready to download
13
+ - `preview_file` — Read the content of a `.txt` or `.md` file (max 1 MB)
14
+ - `write_file` — Write text content to a new file in the shared folder
15
+ - `copy_file` — Copy a file from the agent machine into the shared folder (see [Moving files across machines](#moving-files-across-machines))
16
+ - `download_file` — Copy a file from the shared folder onto the agent machine (any file type, binary included — see [Downloading to the agent machine](#downloading-to-the-agent-machine))
17
+ - `create_directory` / `delete_directory` — Manage subdirectories
18
+ - `move_file` — Move or rename a file inside the shared folder
19
+ - **Web GUI** — Upload, download, preview, and delete files from a browser
20
+ - **Zero config** — works out of the box with sensible defaults (`~/.file-share-mcp`)
21
+ - **Proxy-ready** — optional integration with the [file-share-mcp proxy](https://github.com/...)
22
+
23
+ ---
24
+
25
+ ## Quick Start with Cursor
26
+
27
+ Add this to your Cursor MCP configuration (`~/.cursor/mcp.json` or your workspace `.cursor/mcp.json`):
28
+
29
+ ```json
30
+ {
31
+ "mcpServers": {
32
+ "file-share": {
33
+ "command": "npx",
34
+ "args": ["-y", "file-share-mcp"]
35
+ }
36
+ }
37
+ }
38
+ ```
39
+
40
+ Once added, restart Cursor. The GUI will be available at **http://localhost:3005**.
41
+
42
+ ---
43
+
44
+ ## Quick Start with Claude Desktop
45
+
46
+ Add this to your Claude Desktop configuration (`claude_desktop_config.json`):
47
+
48
+ ```json
49
+ {
50
+ "mcpServers": {
51
+ "file-share": {
52
+ "command": "npx",
53
+ "args": ["-y", "file-share-mcp"]
54
+ }
55
+ }
56
+ }
57
+ ```
58
+
59
+ ---
60
+
61
+ ## Configuration (optional)
62
+
63
+ All configuration is done via environment variables, passed in the MCP `env` block or in a `.env` file inside the package directory.
64
+
65
+ | Variable | Default | Description |
66
+ |---|---|---|
67
+ | `GUI_PORT` | `3005` | Port for the web GUI |
68
+ | `MCP_DATA_DIR` | `~/.file-share-mcp` | Directory for `configs.json` and persistent data |
69
+ | `PROXY_URL` | _(none)_ | URL of the proxy server (optional) |
70
+ | `PROXY_APP_PATH` | `/file-share` | Path to register on the proxy |
71
+ | `PROXY_APP_NAME` | `File Share MCP` | Display name shown in the proxy dashboard |
72
+ | `APP_GROUP` | _(none)_ | Groups the app under a collapsible section (folded by default) in the proxy dashboard. Apps sharing the same value appear together; if unset, the app lands in the default "ungrouped" section |
73
+
74
+ ### Example: custom port and data directory
75
+
76
+ ```json
77
+ {
78
+ "mcpServers": {
79
+ "file-share": {
80
+ "command": "npx",
81
+ "args": ["-y", "file-share-mcp"],
82
+ "env": {
83
+ "GUI_PORT": "3010",
84
+ "MCP_DATA_DIR": "C:/Users/YourName/my-shared-files"
85
+ }
86
+ }
87
+ }
88
+ }
89
+ ```
90
+
91
+ ### Example: with proxy integration
92
+
93
+ ```json
94
+ {
95
+ "mcpServers": {
96
+ "file-share": {
97
+ "command": "npx",
98
+ "args": ["-y", "file-share-mcp"],
99
+ "env": {
100
+ "PROXY_URL": "http://localhost:3000",
101
+ "PROXY_APP_PATH": "/file-share",
102
+ "PROXY_APP_NAME": "File Share MCP",
103
+ "APP_GROUP": "Files"
104
+ }
105
+ }
106
+ }
107
+ }
108
+ ```
109
+
110
+ ---
111
+
112
+ ## Moving files across machines
113
+
114
+ Two tools move a file between the agent and the shared folder, in opposite directions:
115
+
116
+ | Tool | Direction | Names the file with |
117
+ |---|---|---|
118
+ | `copy_file` | agent machine → shared folder | `source_path` (absolute file path) |
119
+ | `download_file` | shared folder → agent machine | `destination_path` (absolute directory) |
120
+
121
+ Both are straightforward **over stdio**, the usual case where the MCP server is a child
122
+ process of the agent: one filesystem, and the paths mean the same thing on both sides.
123
+ Nothing to configure.
124
+
125
+ **Through [`@imenam/mcp-http-gateway`](https://www.npmjs.com/package/@imenam/mcp-http-gateway)**
126
+ the server runs on the gateway machine, and neither path means anything there. MCP has no
127
+ file-transfer primitive — only the bytes a message carries actually travel — so the relay,
128
+ which runs next to the agent in `--mcp` mode, fills the gap in both directions. Configure it
129
+ with `GATEWAY_INLINE_ROOTS` (reading, for `copy_file`) and `GATEWAY_INLINE_WRITE_ROOTS`
130
+ (writing, for `download_file`). Those two directory lists are the whole configuration: every
131
+ file type is allowed by default.
132
+
133
+ Neither direction has a fallback. With the relay in the chain but the matching root
134
+ unconfigured, the call fails and names the variable to set; nothing is read, written, or
135
+ dumped into the conversation.
136
+
137
+ ### Uploading: `copy_file`
138
+
139
+ `source_path` is the absolute path of the file on the agent machine. Through the relay, the
140
+ hidden `source_content` / `source_name` parameters carry the file itself; the agent only ever
141
+ names a path.
142
+
143
+ ### Downloading: `download_file`
144
+
145
+ `destination_path` is the **absolute directory** where the file should land on the agent
146
+ machine. The file keeps its own name; `destination_overwrite` (default `false`) governs
147
+ replacing an existing file.
148
+ **absolute directory** where it should land on the agent machine. The file keeps its own
149
+ name; `destination_overwrite` (default `false`) governs replacing an existing file.
150
+
151
+ Through the relay, the hidden `destination_relay` flag tells the server the destination is
152
+ on another machine: it then returns the file's bytes in its response, and the relay writes
153
+ them and strips them from the result. The bytes never reach the agent's context — an 8 MiB
154
+ file base64-encoded into a conversation would be costly, and an agent re-typing it by hand
155
+ would corrupt it.
156
+
157
+ ---
158
+
159
+ ## Data & Logs
160
+
161
+ By default, all user data is stored in `~/.file-share-mcp/`:
162
+
163
+ ```
164
+ ~/.file-share-mcp/
165
+ ├── configs.json # Saved configuration (shared folder path, etc.)
166
+ ├── shared/ # Default shared folder
167
+ │ └── .uploads-tmp/ # Staging area for in-flight GUI uploads (hidden, purged at startup)
168
+ └── logs/
169
+ └── server.log # Application logs
170
+ ```
171
+
172
+ This directory survives package updates and reinstalls. Both processes (MCP server
173
+ and GUI) log under `<data dir>/logs`, never under the working directory — the cwd of
174
+ an MCP launched by a gateway is not its own and is not necessarily writable.
175
+
176
+ Uploads are staged in `.uploads-tmp` inside the shared folder rather than in the
177
+ system temp directory, so the final move never crosses a mount boundary. `rename()`
178
+ returns `EXDEV` as soon as it does, even when both sides are on the same filesystem —
179
+ which is the case under systemd `PrivateTmp=yes`, with `/tmp` on tmpfs, or with a
180
+ `TMPDIR` on another volume. A copy-then-rename fallback covers the remaining case
181
+ where `MCP_DATA_DIR` and a custom `shared_folder_path` sit on different volumes.
182
+
183
+ ---
184
+
185
+ ## Network exposure
186
+
187
+ The GUI server listens on `127.0.0.1` only. Other machines reach it through the proxy or
188
+ the gateway manager, which relay to `localhost`.
189
+
190
+ Every GUI request goes through the request guard of `@imenam/mcp-gui-interface`: it
191
+ refuses (HTTP 403) a `Host` header other than `localhost` / `127.0.0.1` / `::1`, and any
192
+ modifying request (other than GET, HEAD, OPTIONS) that the browser marks as coming from
193
+ another site (`Sec-Fetch-Site`, or `Origin` outside this machine and the proxy).
194
+
195
+ The GUI sends no CORS headers: the frontend is served by the same server, and other
196
+ websites cannot read the shared files through the browser.
197
+
198
+ ---
199
+
200
+ ## Development
201
+
202
+ ```bash
203
+ # Install dependencies
204
+ npm install
205
+ cd gui && npm install && cd ..
206
+
207
+ # Build (backend + frontend)
208
+ npm run build
209
+
210
+ # Start
211
+ npm start
212
+ ```
213
+
214
+ ### Project structure
215
+
216
+ ```
217
+ src/
218
+ ├── mcp-server.ts # MCP server (MASTER process)
219
+ ├── gui.ts # Express GUI server (WORKER process)
220
+ ├── version.ts # Version read from package.json
221
+ └── utils/
222
+ ├── config-manager.ts
223
+ ├── file-manager.ts
224
+ └── logger.ts
225
+ gui/ # React + Vite frontend (builds to ../public/)
226
+ public/ # Built frontend (served by the GUI server)
227
+ ```
228
+
229
+ ---
230
+
231
+ ## License
232
+
233
+ ISC
package/dist/version.js CHANGED
@@ -1 +1,16 @@
1
- export const VERSION = '1.0.19';
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ // Lit la version dans le premier package.json trouvé en remontant depuis ce module.
5
+ function readPackageVersion() {
6
+ let dir = path.dirname(fileURLToPath(import.meta.url));
7
+ while (!existsSync(path.join(dir, "package.json"))) {
8
+ const parent = path.dirname(dir);
9
+ if (parent === dir)
10
+ throw new Error("package.json introuvable");
11
+ dir = parent;
12
+ }
13
+ const pkg = JSON.parse(readFileSync(path.join(dir, "package.json"), "utf8"));
14
+ return pkg.version;
15
+ }
16
+ export const VERSION = readPackageVersion();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "file-share-mcp",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "MCP server for bidirectional file sharing between AI agents and users, with a built-in web GUI",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -26,12 +26,11 @@
26
26
  ],
27
27
  "type": "module",
28
28
  "scripts": {
29
- "generate-version": "node --loader ts-node/esm src/utils/generate-version.ts",
30
- "build:backend": "npm run generate-version && tsc",
29
+ "build:backend": "tsc",
31
30
  "build:frontend": "cd gui && npm run build",
32
31
  "build": "npm run build:backend && npm run build:frontend",
33
32
  "start": "node dist/mcp-server.js",
34
- "dev": "npm run build:backend && nodemon --exec \"node --loader ts-node/esm\" src/mcp-server.ts",
33
+ "dev": "nodemon --exec \"node --loader ts-node/esm\" src/mcp-server.ts",
35
34
  "prepublishOnly": "npm run build",
36
35
  "release": "npm version patch && npm publish --access public && git push origin master --follow-tags",
37
36
  "test": "echo \"Error: no test specified\" && exit 1"