@t2nagi/filebrowser-quantum-mcp 0.0.0-stage → 0.1.0-rc.1

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 (49) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +21 -0
  3. package/README.ja.md +335 -0
  4. package/README.md +328 -2
  5. package/dist/client/api.js +222 -0
  6. package/dist/client/errors.js +120 -0
  7. package/dist/client/http.js +172 -0
  8. package/dist/client/types.js +2 -0
  9. package/dist/config.js +168 -0
  10. package/dist/core/approvals.js +75 -0
  11. package/dist/core/confirm.js +66 -0
  12. package/dist/core/content.js +28 -0
  13. package/dist/core/display.js +65 -0
  14. package/dist/core/inspect.js +180 -0
  15. package/dist/core/lock.js +54 -0
  16. package/dist/core/messages.js +131 -0
  17. package/dist/core/names.js +114 -0
  18. package/dist/core/paths.js +41 -0
  19. package/dist/core/reads.js +39 -0
  20. package/dist/core/recovery.js +55 -0
  21. package/dist/core/replace.js +131 -0
  22. package/dist/core/shares.js +46 -0
  23. package/dist/core/sources.js +18 -0
  24. package/dist/core/state.js +154 -0
  25. package/dist/core/text.js +44 -0
  26. package/dist/core/writeflow.js +497 -0
  27. package/dist/index.js +83 -0
  28. package/dist/log.js +32 -0
  29. package/dist/server.js +117 -0
  30. package/dist/tools/archive.js +159 -0
  31. package/dist/tools/common.js +68 -0
  32. package/dist/tools/create-folder.js +94 -0
  33. package/dist/tools/delete.js +195 -0
  34. package/dist/tools/find-duplicates.js +59 -0
  35. package/dist/tools/get-info.js +53 -0
  36. package/dist/tools/index.js +45 -0
  37. package/dist/tools/list-dir.js +68 -0
  38. package/dist/tools/list-sources.js +45 -0
  39. package/dist/tools/move-copy.js +231 -0
  40. package/dist/tools/read-file.js +69 -0
  41. package/dist/tools/rename.js +99 -0
  42. package/dist/tools/search.js +93 -0
  43. package/dist/tools/shares.js +219 -0
  44. package/dist/tools/unarchive.js +147 -0
  45. package/dist/tools/write-common.js +89 -0
  46. package/dist/tools/write-file.js +160 -0
  47. package/dist/version.js +5 -0
  48. package/npm-shrinkwrap.json +2657 -0
  49. package/package.json +57 -4
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,21 @@
1
+ filebrowser-quantum-mcp
2
+ Copyright 2026 t2nagi
3
+
4
+ This product is licensed under the Apache License, Version 2.0.
5
+ See the LICENSE file for the full license text.
6
+
7
+ This project is unofficial and is not affiliated with or endorsed by
8
+ the FileBrowser Quantum project.
9
+
10
+ --------------------------------------------------------------------------
11
+
12
+ The source repository of this product includes third-party material.
13
+ It is not included in the npm package or the Docker image.
14
+
15
+ docs/api/swagger-v2.1.0-stable.json
16
+ The Swagger (OpenAPI 2.0) specification of the FileBrowser Quantum
17
+ REST API, version v2.1.0-stable, generated from the FileBrowser Quantum
18
+ source code. It is redistributed unmodified.
19
+
20
+ Source: https://github.com/gtsteffaniak/filebrowser
21
+ License: Apache License, Version 2.0
package/README.ja.md ADDED
@@ -0,0 +1,335 @@
1
+ # filebrowser-quantum-mcp
2
+
3
+ [English](README.md) | **日本語**
4
+
5
+ > **非公式**のプロジェクトです。FileBrowser Quantum プロジェクトとは関係がなく、公認も受けていません。
6
+
7
+ > 正式版は英語の [README.md](README.md) です。内容に差がある場合は英語版を優先してください。
8
+
9
+ [FileBrowser Quantum](https://filebrowserquantum.com/) のサーバー上のファイルを、AI エージェント(Claude など)から閲覧・検索・操作できるようにする **MCP (Model Context Protocol) サーバー** です。
10
+
11
+ > **ご利用は自己責任でお願いします。** このサーバーは、AI アシスタントにファイルの変更や削除をさせることができます。本ソフトウェアは「現状のまま」無保証で提供され、データの損失や損害について作者は責任を負いません。使う前にデータをバックアップし、[免責事項](#免責事項)を読んでください。
12
+
13
+ > **ステータス: リリース候補。** 試用のために `0.1.0-rc.1` を公開しています(npm の dist-tag は `next`、イメージのタグは `0.1.0-rc.1`)。下の例は `0.1.0` を使っていますが、まだ公開していません。それまでは、例の版を `0.1.0-rc.1` に置き換えるか(`@0.1.0-rc.1`、`:0.1.0-rc.1`)、[ソースから動かして](#ソースから動かすリリースの公開前)ください。
14
+
15
+ ---
16
+
17
+ ## 機能
18
+
19
+ - ソース(FileBrowser に登録されたストレージ)とディレクトリの一覧表示
20
+ - ファイル・フォルダの情報取得とテキストファイルの読み取り
21
+ - インデックスを利用したファイル検索
22
+ - ファイル・フォルダの作成、書き込み、移動、コピー、名前変更、削除
23
+ - サーバー側での圧縮・展開(zip / tar.gz)
24
+ - 共有リンクの一覧・作成・削除
25
+ - 重複ファイルの検出
26
+ - 安全側の既定値: 確認画面で同意しない限り上書きも削除もしません。削除と共有のツールは有効にしない限り使えません。読み取り専用モードもあります
27
+
28
+ ---
29
+
30
+ ## 対応バージョン
31
+
32
+ filebrowser-quantum-mcp は FileBrowser Quantum のバージョン番号とは独立した、独自の[セマンティックバージョニング](https://semver.org/lang/ja/)を採用します。破壊的変更(ツール・引数・出力の項目の名前の変更や削除、環境変数の変更、安全に関わる既定値の変更)はメジャーバージョンで示します。`0.x` の間は、マイナーリリースに破壊的変更が含まれることがあります。詳しい決まりは [docs/release.md](docs/release.md) にあります。
33
+
34
+ | filebrowser-quantum-mcp | FileBrowser Quantum | 確認済みの版 |
35
+ |---|---|---|
36
+ | 0.1.x | 2.1.x | v2.1.0-stable |
37
+
38
+ 対応するのは FileBrowser Quantum の最新の stable の系列だけです。対応範囲は `package.json` の `filebrowserCompat` でも宣言します。FileBrowser は API で版を返さないため、実行時には版を確かめません。
39
+
40
+ ---
41
+
42
+ ## セットアップ
43
+
44
+ ### 1. API トークンを作る
45
+
46
+ 1. 管理者として FileBrowser のユーザー管理を開き、必要な権限だけを持つ MCP 用の**管理者ではない**ユーザーを作ります。ユーザーの全体の権限で **API** を有効にし(共有系ツールを使う場合は **Share** も)、**Admin** は無効のままにします。API の権限がないと、そのユーザーは *API Management* を使えず、トークンを作れません。スコープは、アシスタントに触らせてよいディレクトリに限り、Web で配信されるフォルダや、ほかの機器と同期するフォルダは含めないでください。管理者ユーザーのトークンでは起動を拒否します(管理者のトークンでは、全ユーザーの共有リンクと、そのユーザーのほかのトークンがすべて見えてしまうため)。
47
+ 2. いったんログアウトしてそのユーザーでログインし、**Settings → API Management** でトークンを作ります。トークンには `api` 権限(共有系ツールを使うなら `api` と `share`)を付けてください。*minimal* トークンは、ユーザーの権限をすべて持つので作らないでください。
48
+
49
+ MCP サーバーでできる操作は、このユーザーのソースごとの権限(`view` / `download` / `modify` / `create` / `delete`)と、トークンの権限の範囲に限られます。
50
+
51
+ ### 2. MCP クライアントを設定する
52
+
53
+ filebrowser-quantum-mcp は stdio でローカル実行します。`npx`(Node.js 24 以上が必要)か Docker で起動できます。
54
+
55
+ **npx**
56
+
57
+ ```json
58
+ {
59
+ "mcpServers": {
60
+ "filebrowser": {
61
+ "command": "npx",
62
+ "args": ["-y", "@t2nagi/filebrowser-quantum-mcp@0.1.0"],
63
+ "env": {
64
+ "npm_config_ignore_scripts": "true",
65
+ "FILEBROWSER_URL": "https://files.example.com",
66
+ "FILEBROWSER_TOKEN": "<your-api-token>",
67
+ "FILEBROWSER_READ_ONLY": "true"
68
+ }
69
+ }
70
+ }
71
+ }
72
+ ```
73
+
74
+ **Docker**
75
+
76
+ ```json
77
+ {
78
+ "mcpServers": {
79
+ "filebrowser": {
80
+ "command": "docker",
81
+ "args": [
82
+ "run", "-i", "--rm",
83
+ "-e", "FILEBROWSER_URL",
84
+ "-e", "FILEBROWSER_TOKEN",
85
+ "-e", "FILEBROWSER_READ_ONLY",
86
+ "ghcr.io/t2nagi/filebrowser-quantum-mcp:0.1.0"
87
+ ],
88
+ "env": {
89
+ "FILEBROWSER_URL": "https://files.example.com",
90
+ "FILEBROWSER_TOKEN": "<your-api-token>",
91
+ "FILEBROWSER_READ_ONLY": "true"
92
+ }
93
+ }
94
+ }
95
+ }
96
+ ```
97
+
98
+ 使う環境変数は、それぞれ `-e 名前` の形(値を書かず名前だけ)で渡し、値は `env` に書いてください。こうするとトークンがコマンドラインに出ず、ほかのプロセスから見えません。`-i` は必須です。`-t` は付けないでください(TTY が入ると stdio の通信が壊れます)。
99
+
100
+ 上の例は読み取り専用です。書き込みや削除をさせるには、`FILEBROWSER_READ_ONLY` を外し、必要な機能を有効にします。Docker では、どの変数も `args` の `-e 名前` と、`env` の値の **2 か所** に書く必要があります。片方だけだと、サーバーに値が届きません。
101
+
102
+ ```json
103
+ "args": [
104
+ "run", "-i", "--rm",
105
+ "-e", "FILEBROWSER_URL",
106
+ "-e", "FILEBROWSER_TOKEN",
107
+ "-e", "FILEBROWSER_WRITABLE_SOURCES",
108
+ "-e", "FILEBROWSER_ALLOW_DELETE",
109
+ "ghcr.io/t2nagi/filebrowser-quantum-mcp:0.1.0"
110
+ ],
111
+ "env": {
112
+ "FILEBROWSER_URL": "https://files.example.com",
113
+ "FILEBROWSER_TOKEN": "<your-api-token>",
114
+ "FILEBROWSER_WRITABLE_SOURCES": "<ソース名>",
115
+ "FILEBROWSER_ALLOW_DELETE": "true"
116
+ }
117
+ ```
118
+
119
+ 上の例のように、必ずバージョンを固定してください(`@0.1.0`、`:0.1.0`、またはイメージの digest)。最新版を自動で取得する指定は避けてください。リリースは GitHub Actions の[リリース用ワークフロー](.github/workflows/release.yml)だけが作って公開します。npm パッケージには `npm-shrinkwrap.json` を含めて依存パッケージの版も固定し、npm の provenance 付きで公開します。イメージは `linux/amd64` と `linux/arm64` に対応し、cosign で署名して SBOM を付けます。`npm_config_ignore_scripts` は、トークンが環境変数にある間にインストールスクリプトを動かさないための設定です。
120
+
121
+ イメージがこのリポジトリのリリース用ワークフローで作られたものかは、[cosign](https://docs.sigstore.dev/) で署名を検証して確かめられます。
122
+
123
+ ```bash
124
+ cosign verify ghcr.io/t2nagi/filebrowser-quantum-mcp:0.1.0 --certificate-oidc-issuer https://token.actions.githubusercontent.com --certificate-identity-regexp '^https://github\.com/t2nagi/filebrowser-quantum-mcp/\.github/workflows/release\.yml@refs/tags/v'
125
+ ```
126
+
127
+ ### ソースから動かす(リリースの公開前)
128
+
129
+ npm パッケージとイメージを公開するまでは、このリポジトリからビルドして使います。
130
+
131
+ **Docker**(ホストに Node.js は不要):
132
+
133
+ ```bash
134
+ git clone https://github.com/t2nagi/filebrowser-quantum-mcp.git
135
+ cd filebrowser-quantum-mcp
136
+ docker build -t filebrowser-quantum-mcp:dev .
137
+ ```
138
+
139
+ 上の Docker の設定で、イメージを `ghcr.io/t2nagi/filebrowser-quantum-mcp:0.1.0` の代わりに `filebrowser-quantum-mcp:dev` にします。新しいコミットを取り込んだら、イメージをビルドし直してください。
140
+
141
+ **Node.js 24 以上**:
142
+
143
+ ```bash
144
+ git clone https://github.com/t2nagi/filebrowser-quantum-mcp.git
145
+ cd filebrowser-quantum-mcp
146
+ npm ci --ignore-scripts
147
+ npm run build
148
+ ```
149
+
150
+ 設定は `"command": "node"`、`"args": ["/絶対パス/filebrowser-quantum-mcp/dist/index.js"]` とし、`env` は上と同じにします。クライアントが `node` や `docker` を見つけられない場合は、絶対パス(`which node`、`which docker` の結果)を書いてください。
151
+
152
+ ### 環境変数
153
+
154
+ | 変数 | 必須 | 既定値 | 説明 |
155
+ |---|---|---|---|
156
+ | `FILEBROWSER_URL` | ✓ | — | FileBrowser のベース URL(例: `https://files.example.com`。サブパス付きの `https://example.com/files` も可)。`localhost`・`127.0.0.1`・`[::1]` と `FILEBROWSER_ALLOW_INSECURE_HTTP_HOSTS` に書いたホスト以外への平文の `http://` は拒否する。リダイレクトは追わないので、最終的な API のアドレスを指定する |
157
+ | `FILEBROWSER_TOKEN` | ✓ | — | 管理者ではないユーザーの API トークン |
158
+ | `FILEBROWSER_DEFAULT_SOURCE` | | — | ツールで `source` を省略したときに使うソース。未設定で、アクセスできるソースが 1 つだけならそれを使う |
159
+ | `FILEBROWSER_READ_ONLY` | | `false` | `true` のとき、読み取り系ツールだけを使えるようにする。下の 2 つより優先される |
160
+ | `FILEBROWSER_ALLOW_DELETE` | | `false` | `true` のときだけ削除系ツールを使えるようにする |
161
+ | `FILEBROWSER_ALLOW_SHARE` | | `false` | `true` のときだけ共有系ツール(共有リンクの一覧・作成・削除)を使えるようにする |
162
+ | `FILEBROWSER_ALLOW_FOLDER_SHARE` | | `false` | フォルダの共有リンクを許可する。共有したフォルダの中の隠しファイル(`.env` など)は、パスを知っていれば誰でも取得できるため、既定では無効 |
163
+ | `FILEBROWSER_MAX_READ_BYTES` | | `65536`(64 KiB) | `fb_read_file` が 1 回で返す最大バイト数。続きは `offset` で読む |
164
+ | `FILEBROWSER_MAX_WRITE_BYTES` | | `1048576`(1 MiB) | `fb_write_file` で書き込める最大バイト数 |
165
+ | `FILEBROWSER_TIMEOUT_MS` | | `30000` | リクエストのタイムアウト(ミリ秒) |
166
+ | `FILEBROWSER_LONG_TIMEOUT_MS` | | `300000` | 移動・コピー・名前変更・圧縮・展開・重複検出のタイムアウト(ミリ秒) |
167
+ | `FILEBROWSER_LOG_LEVEL` | | `warn` | `error` / `warn` / `info` / `debug`。ログは stderr に出す |
168
+ | `FILEBROWSER_LANG` | | `en` | 確認画面の言語。`en` / `ja` |
169
+ | `FILEBROWSER_CONFIRM_POLICY` | | `strict` | `strict` か `trust-client` のどちらか。データを失う操作(上書き・削除)と外部に出る操作の確認方針。`strict`: 利用者が確認画面で同意したときだけ実行する(確認に対応していないクライアントでは上書き・削除できない)。`trust-client`: 確認に対応していないクライアントでは、確認画面の代わりに 2 段階の承認(下記)を経て実行し、クライアント側のツール実行の承認に任せる(**データを失うおそれあり**)。確認に対応しているクライアントでは効果がない。共有リンクの作成は、どちらでも確認画面が必要 |
170
+ | `FILEBROWSER_ELICITATION` | | `auto` | `auto` か `off` のどちらか。`auto`: クライアントが対応していると申告すれば確認画面を使う。`off`: クライアントが対応していないものとして扱い、確認画面を使わない。確認画面に対応していると申告しながら表示しないクライアントのための設定。**`off` にする前に、下の注意を必ず読むこと** |
171
+ | `FILEBROWSER_CONFIRM_TIMEOUT_MS` | | `300000` | 確認に答えるまでの待ち時間。過ぎたらキャンセル扱い |
172
+ | `FILEBROWSER_MAX_SHARE_DAYS` | | `7` | 共有リンクの有効期限の上限(日) |
173
+ | `FILEBROWSER_ALLOWED_SOURCES` | | — | MCP で使ってよいソースの一覧(カンマ区切り)。未設定なら、ユーザーが使えるすべてのソース |
174
+ | `FILEBROWSER_WRITABLE_SOURCES` | | — | MCP で書き込んでよいソースの一覧(カンマ区切り)。未設定なら `FILEBROWSER_ALLOWED_SOURCES` と同じ |
175
+ | `FILEBROWSER_ALLOW_ADMIN_USER` | | `false` | 管理者ユーザーのトークンでも起動する(推奨しない) |
176
+ | `FILEBROWSER_ALLOW_INSECURE_HTTP_HOSTS` | | — | 平文の `http://` で接続してよいホスト名の一覧(カンマ区切り)。トークンとファイルの中身が暗号化されずに流れる |
177
+
178
+ 真偽値には `true` / `false` / `1` / `0` / `yes` / `no` が使えます。正しくない値(たとえば `FILEBROWSER_CONFIRM_POLICY=client`)を指定すると、サーバーは起動時に終了します。理由は MCP クライアントのサーバーログに出ます。
179
+
180
+ > [!CAUTION]
181
+ > **`FILEBROWSER_ELICITATION=off` と `FILEBROWSER_CONFIRM_POLICY=trust-client` を組み合わせると、確認画面がすべてなくなります。**
182
+ >
183
+ > - 上書き・削除・別のソースや共有中のフォルダへの書き込みは、確認画面の代わりに **2 段階の承認**になります。1 回目の呼び出しでは何も変えずに、変更の一覧と使い捨ての `approvalCode` を返し、そのコードを付けた 2 回目の呼び出しだけが実行されます。アシスタントには「一覧を見せて、チャットで承認を得てから呼び直す」よう伝えますが、**利用者が承認したかどうかはサーバーには確かめられません**。実際の検証では、アシスタントが聞かずに削除しました。FileBrowser にゴミ箱はないので、削除したファイルは戻せません。
184
+ > - アシスタントとデータの間に残るのは、MCP クライアント側のツール実行の承認だけです。**書き込み系と削除のツールを、自動で承認する設定にしないでください**(「常に許可」、自動承認のモード、エージェントのフックなど)。
185
+ > - アシスタントが読んだファイルに、ほかの人が書いた指示が含まれていることがあります。確認画面がない分、ツール実行の承認を求められたら、毎回中身を読んでから許可してください。
186
+ > - 使うのはテスト用のデータか、バックアップのあるデータだけにし、不要になったらすぐに 2 つの設定を外してください。
187
+ >
188
+ > できるだけ、確認画面を表示するクライアント(ターミナルの Claude Code など)を使ってください。`off` と既定の `strict` の組み合わせなら、データは失われません(上書き・削除・共有リンクの作成が拒否されるだけです)。
189
+
190
+ 自己署名の証明書を使うサーバーでは、`NODE_EXTRA_CA_CERTS` で CA を追加してください。`NODE_TLS_REJECT_UNAUTHORIZED=0` で証明書の検証を無効にしないでください。
191
+
192
+ 起動時には、有効な書き込み系の機能と、無保証であることの注意を 1 行 stderr に出します。また、`FILEBROWSER_ALLOW_DELETE`・`FILEBROWSER_ALLOW_SHARE`・`FILEBROWSER_ALLOW_FOLDER_SHARE`・`FILEBROWSER_CONFIRM_POLICY=trust-client` など危険を伴う設定を使っているときは、設定ごとに警告を出します。設定を変えたら、MCP クライアントのサーバーログを確認してください。これらが出なくなるのは `FILEBROWSER_LOG_LEVEL=error` のときだけです。`FILEBROWSER_ELICITATION=off` と `trust-client` の組み合わせは、`!!! DANGER` で始まる error レベルの行で知らせるので、常に表示されます。
193
+
194
+ ### うまく動かないとき
195
+
196
+ - **サーバーが起動しない、クライアントから接続できない。** クライアントで MCP サーバーのログを見てください。`FILEBROWSER_CONFIRM_POLICY must be one of strict, trust-client` のように、直すべき設定が出ています。
197
+ - **「The startup checks against FileBrowser have not passed yet」と出る。** FileBrowser に接続できていません。`FILEBROWSER_URL` と、FileBrowser が動いているかを確かめてください。Docker では、社内の DNS でしか引けないホスト名をコンテナの中で引けないことがあります(`details.cause` に `ENOTFOUND`)。その場合は `args` に `"--add-host", "<ホスト名>:<IP アドレス>"` を足してください。
198
+ - **「The API token belongs to an admin user」と出る。** 管理者ではないユーザーのトークンを作ってください([API トークンを作る](#1-api-トークンを作る))。
199
+ - **確認画面が出ないまま、上書きや削除がすべてキャンセルされる。** クライアントが確認画面に対応していると申告しながら、表示していません。確認画面を表示するクライアントを使ってください([制限事項](#制限事項)のクライアントについての項目)。`FILEBROWSER_ELICITATION=off` は最後の手段です。使う前に[環境変数](#環境変数)の注意を読んでください。
200
+
201
+ ---
202
+
203
+ ## ツール
204
+
205
+ ツールは `source`(`FILEBROWSER_DEFAULT_SOURCE` を参照)と `path`(ソース内の絶対パス。例: `/docs/readme.md`)で対象を指定します。新しい場所に書き込むツールは、行き先を `toSource` と `toPath` で指定します。アクセスできるソースと書き込めるソースは `fb_list_sources` で確認できます。
206
+
207
+ **名前の規則**: 新しく作るファイル・フォルダの名前は、Windows / macOS / Linux のどれでも使えるものに限ります。次の名前は拒否します。
208
+
209
+ - `< > : " / \ | ? *`、制御文字、名前を偽装できる見えない文字(双方向制御文字、ゼロ幅文字など。全角空白 U+3000 は使えます)を含む名前
210
+ - `CON` や `nul.txt` などの Windows のデバイス名
211
+ - 空白か `.` で終わる名前、255 バイトを超える名前
212
+ - 既存の名前と大文字小文字だけが違う名前
213
+
214
+ 新しい名前は Unicode の NFC に正規化します。規則に合わない名前の既存ファイルも、読み取り・移動・削除はできます。
215
+
216
+ **データを失う前の確認**: 確認画面で同意しない限り、上書きも削除もしません。
217
+
218
+ - 移動先・作成先に同じ名前があり、MCP クライアントが *Elicitation* に対応していれば、**cancel**(キャンセルする)・**rename**(`report(1).txt` のように名前を変えて保存する)・**overwrite**(上書きする)から選ぶ確認が表示されます。cancel が先頭にあり、既定値にしてあるので、最初から選択肢を選んだ状態で表示するクライアントでは cancel が選ばれます。確認画面には、既存の項目のサイズと更新日時、置き換える側のサイズと更新日時(新しく書くテキストではサイズだけ)が出て、新しい内容が大幅に小さいときや、アシスタントがファイルを最後まで読んでいないときは警告が出ます。
219
+ - アシスタントが `onConflict: "rename"` を指定した場合は、何も失わないので確認なしで別名で保存します。
220
+ - 削除(`fb_delete`)では確認が表示されます(既定の `strict` の場合。`trust-client` は下記)。削除するフォルダの中の隠しファイルも一緒に消えます。FileBrowser にゴミ箱はないので、削除は元に戻せません。
221
+ - 上書きで、書きかけのファイルが残ることはありません。書き込み・コピー・圧縮は、対象の隣の一時的な名前(`report.mcp-tmp-….txt` など)に作ってから、成功したときだけ置き換えます。同じソースの中の移動と名前変更は、一度に置き換わります。*別の*ソースへの移動による上書きは選べません。タイムアウトなどで一時ファイルが残った場合は、結果でその名前と、新しい内容が入っているかを伝えます。確かめる前に消さないでください。
222
+ - 確認画面を閉じる・拒否する・時間内に答えないと、操作全体がキャンセルされます。確認画面を開いている間にアシスタントの依頼が中断された場合は、あとから承認しても何も実行しません。
223
+ - フォルダの上書き、ファイルとフォルダの置き換え、既存のフォルダへの展開、別のソースへの移動による上書きは選べません(名前を変えて保存するか、キャンセルのみ)。FileBrowser はフォルダをコピーすると既存のフォルダに統合し、中の同じ名前のファイルを(隠しファイルも含めて)黙って置き換えるためです。
224
+ - 圧縮・展開で元のファイルを消すことはありません。消したい場合は、結果を確かめてから `fb_delete` を使ってください。
225
+ - クライアントが Elicitation に対応していなければ、既定(`FILEBROWSER_CONFIRM_POLICY=strict`)では、アシスタントが求めても上書きと削除を拒否します。名前を変えて保存することはできます。この組み合わせでは、既存のファイルをその場で編集することはできず、`fb_delete` は一覧に出ません。`trust-client` にすると、確認画面の代わりに 2 段階の承認を経て実行します。1 回目の呼び出しは変更の一覧と使い捨ての `approvalCode` を返し(有効期間は `FILEBROWSER_CONFIRM_TIMEOUT_MS`。同じ引数で、対象が変わっていないときだけ有効)、そのコードを付けた 2 回目の呼び出しだけが実行されます。その間にアシスタントが利用者に確認するはずですが、確認したかどうかはサーバーには確かめられません。
226
+
227
+ **外部に出る前の確認**
228
+
229
+ - 共有リンクの作成は、`FILEBROWSER_CONFIRM_POLICY` にかかわらず必ず確認します。確認に対応していないクライアントでは共有リンクを作れません(`fb_create_share` は一覧に出ません)。
230
+ - 別のソースへの書き込みと、共有されているフォルダやファイルへの書き込みでも確認します。`strict` では、確認に対応していないクライアントではできません。
231
+ - 検出できるのは、MCP 用ユーザー自身が作った共有だけで、トークンに `share` 権限があるときに限ります。普段のアカウントで作った共有は見えないので、共有しているフォルダは MCP 用ユーザーのスコープに含めないでください。
232
+ - フォルダの共有が無効(既定)のときは、アーカイブ(`.zip`、`.tar.gz` など)も共有できません。フォルダを圧縮すると中の隠しファイルも入るためです。フォルダを指すリンクもフォルダとして扱います。
233
+
234
+ ### 読み取り系
235
+
236
+ | ツール | 説明 |
237
+ |---|---|
238
+ | `fb_list_sources` | アクセスできるソース、そこでの自分の権限、書き込めるか、トークンで共有できるかを返す |
239
+ | `fb_list_dir` | ディレクトリ直下のファイル・フォルダを返す(`limit` と `offset` で続きを取れる)。隠しファイルや除外されたファイルは出ないことがある |
240
+ | `fb_get_info` | ファイル・フォルダのメタデータ(サイズ、種類、更新日時など)を返す |
241
+ | `fb_read_file` | UTF-8 のテキストファイルを読む。1 回に `FILEBROWSER_MAX_READ_BYTES` まで。続きは `offset` で読む。更新日時も返す |
242
+ | `fb_search` | ファイル名で検索する(ワイルドカード、期間、件数上限に対応) |
243
+ | `fb_find_duplicates` | 重複ファイルを検出する |
244
+
245
+ ### 書き込み系(`FILEBROWSER_READ_ONLY=true` のときは使えません)
246
+
247
+ | ツール | 説明 |
248
+ |---|---|
249
+ | `fb_create_folder` | フォルダを作成する |
250
+ | `fb_write_file` | テキストファイルを新規作成する。上書きには確認が必要。`fb_read_file` の `modified` を `expectedModified` に渡すと、読んだあとで変更されたファイルを上書きしない。アシスタントが最後まで読んでいないファイルには警告が出る |
251
+ | `fb_move` | 1 つ以上の項目を移動する |
252
+ | `fb_copy` | 1 つ以上の項目をコピーする(元は残る) |
253
+ | `fb_rename` | 1 つの項目の名前を変える(新しい名前だけを指定する) |
254
+ | `fb_archive` | ファイル・フォルダをサーバー上で zip / tar.gz に圧縮する |
255
+ | `fb_unarchive` | アーカイブをサーバー上の新しいフォルダに展開する |
256
+
257
+ ### 削除系(`FILEBROWSER_ALLOW_DELETE=true` のときだけ使えます)
258
+
259
+ | ツール | 説明 |
260
+ |---|---|
261
+ | `fb_delete` | 確認のあとで、最大 20 件のファイル・フォルダを削除する |
262
+
263
+ ### 共有系(`FILEBROWSER_ALLOW_SHARE=true` のときだけ使えます)
264
+
265
+ 共有リンクはファイルを FileBrowser の外から見られるようにするため、既定では無効です。共有 URL のホストは FileBrowser の設定 `http.externalUrl` で決まります。外部から使うアドレスを設定しておいてください。
266
+
267
+ | ツール | 説明 |
268
+ |---|---|
269
+ | `fb_list_shares` | MCP 用ユーザーが作った共有リンクを一覧表示する。リンクそのものではなく、それぞれの ID を返す |
270
+ | `fb_create_share` | 利用者の確認のあとで共有リンクを作成し、その URL を返す。有効期限(最大 `FILEBROWSER_MAX_SHARE_DAYS` 日)は必須で、パスワードとダウンロード上限は任意。ソース全体の共有は拒否する。フォルダとアーカイブの共有には `FILEBROWSER_ALLOW_FOLDER_SHARE=true` が必要 |
271
+ | `fb_delete_share` | 自分の共有リンクを ID で削除する |
272
+
273
+ ---
274
+
275
+ ## 制限事項
276
+
277
+ - ユーザー・グループ・アクセスルールの管理には対応していません。
278
+ - **確認画面への対応はクライアントによって違います。** ターミナルの Claude Code(CLI)では確認画面が出ます。VS Code 版の Claude Code(拡張機能)では、確認画面を表示しないままキャンセルが返ることがわかっています。そのため、上書き・削除・共有リンクの作成はすべてキャンセルで終わります(何も変更されません)。これらの操作は CLI で行ってください(VS Code の統合ターミナルでも動きます)。拡張機能は確認画面に対応していると申告しているので、`trust-client` だけでは解決しません。`FILEBROWSER_ELICITATION=off` を足すと、確認画面なしで拡張機能からも実行できるようになりますが、**危険**です([環境変数](#環境変数)の注意を参照)。
279
+ - バイナリファイルの読み取り、アップロード、ダウンロードにはまだ対応していません。
280
+ - 公開共有リンク(`/public/...`)をソースとして使うことはできません。
281
+ - ファイルサイズはサーバーが返した値をそのまま返します。FileBrowser の設定でソースに `useLogicalSize: true` を指定していない場合、サイズはディスク使用量です(小さいファイルでも `4096` など)。
282
+ - 書き込み前の確認は書き込みの直前に行うため、その間に他の人が加えた変更は上書きされることがあります。サイズと更新日時(秒単位)が変わらない変更も見逃します。
283
+ - コピーするフォルダの中身や、展開するアーカイブの中のファイル名は、名前の規則で検証しません。また FileBrowser は展開時に名前の末尾の空白を取り除くため、アーカイブの中で名前が重なることがあります。
284
+ - `fb_read_file` が読めるのは 10 MiB までの UTF-8 のテキストだけです。バイナリと、ほかの文字コード(Shift_JIS など)のテキストは拒否します。
285
+ - リクエストがタイムアウト・中断しても、FileBrowser はサーバー上で処理を続けます。状態を確かめてから次の操作をしてください。
286
+ - 書き込み系(移動・コピー・圧縮・展開を含む)は、実行中と確認待ちの間に進捗を通知します。削除と共有リンクの確認待ち、重複検出では、まだ通知しません。クライアントによっては、独自のタイムアウト(60 秒が多い)でツールの呼び出しを打ち切ります。
287
+ - **このサーバーでは防げないこと**:
288
+ - アシスタントがファイルを読んで、その内容を別の場所に書いたり、MCP クライアントのほかのツールで外に送ったりすること。ユーザーのスコープ、`FILEBROWSER_WRITABLE_SOURCES`、クライアントの設定で範囲を狭めてください。
289
+ - 新しいファイルの作成は確認なしで行われます。MCP 用ユーザーのスコープに、Web で配信されるフォルダや同期されるフォルダを含めないでください。
290
+ - コピーの繰り返しや大きな展開で、ディスクがいっぱいになることがあります。サーバー側のクォータを使ってください。
291
+ - クライアントが確認画面に自動で答える場合(エージェントの SDK のフックや、自動承認のモードなど)、確認による保護は働きません。人が答えたかどうかは、サーバーからは見分けられません。
292
+ - 確認が多いと、中身を読まずに承認しがちになります。確認を出すのは、何かを失うか外に出るおそれがあるときだけにしていますが、毎回中身を確かめてください。
293
+ - ほかのユーザーが作った共有は検出できません。ディスク上で重なる場所を指すソースは見分けられず、`FILEBROWSER_ALLOWED_SOURCES` はソースの名前だけで判定します。
294
+
295
+ ---
296
+
297
+ ## 開発者向け
298
+
299
+ 実装の設計: [docs/design.md](docs/design.md)
300
+
301
+ 開発環境(Docker): [docs/development.md](docs/development.md)
302
+
303
+ リリースの手順: [docs/release.md](docs/release.md)
304
+
305
+ ---
306
+
307
+ ## セキュリティ
308
+
309
+ 脆弱性は、[SECURITY.md](SECURITY.md) の手順で非公開で報告してください。公開の issue には書かないでください。
310
+
311
+ ---
312
+
313
+ ## 免責事項
314
+
315
+ 本ソフトウェアは「現状のまま」提供され、いかなる保証もありません。正式な条件は [Apache License, Version 2.0](LICENSE) の第 7 条・第 8 条を参照してください。
316
+
317
+ - 本ソフトウェアの使用によって生じた損失や損害について、作者と貢献者は責任を負いません。データの損失・破損・上書き・削除、(共有リンクなどによる)意図しない公開、サービスの停止なども含みます。
318
+ - AI アシスタントは指示を読み違え、意図しない操作をすることがあります。確認画面、読み取り専用モード、削除・共有ツールの無効化などの安全機能は危険を減らしますが、なくすことはできません。また、このサーバーでは防げない危険もあります([制限事項](#制限事項)を参照)。
319
+ - どの操作を許可するか、どの確認を承認するか、MCP 用ユーザーにどの設定や権限を与えるかは、利用者の責任で判断してください。
320
+ - このサーバーから触れられるデータは、別にバックアップを取っておいてください。大切なファイルに使う前に、テスト用のデータで試してください。
321
+ - 非公式のプロジェクトです。このサーバーが原因の問題を FileBrowser Quantum プロジェクトに報告しないでください。
322
+
323
+ ---
324
+
325
+ ## ライセンス
326
+
327
+ [Apache License, Version 2.0](LICENSE) で提供します。同梱している FileBrowser Quantum の API 仕様など、第三者の著作物の出典は [NOTICE](NOTICE) を参照してください。
328
+
329
+ ---
330
+
331
+ ## 参考
332
+
333
+ - [FileBrowser Quantum ドキュメント](https://filebrowserquantum.com/en/docs/)
334
+ - [FileBrowser Quantum(GitHub)](https://github.com/gtsteffaniak/filebrowser)
335
+ - [Model Context Protocol](https://modelcontextprotocol.io/)