diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index efd8ddb..9faa157 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -31,6 +31,7 @@ export default defineConfig({ { text: '上传与分享', link: '/guide/upload' }, { text: '管理面板', link: '/guide/management' }, { text: '存储配置', link: '/guide/storage' }, + { text: 'MCP 接入', link: '/guide/mcp' }, ], }, { text: 'API', link: '/api/' }, @@ -64,6 +65,7 @@ export default defineConfig({ { text: '文件上传', link: '/guide/upload' }, { text: '文件分享', link: '/guide/share' }, { text: '文件管理', link: '/guide/management' }, + { text: 'MCP 接入', link: '/guide/mcp' }, ], }, { @@ -148,6 +150,7 @@ export default defineConfig({ { text: 'Getting Started', link: '/en/guide/getting-started' }, { text: 'Upload & Share', link: '/en/guide/upload' }, { text: 'Admin Panel', link: '/en/guide/management' }, + { text: 'MCP Integration', link: '/en/guide/mcp' }, { text: 'Storage', link: '/en/guide/storage' }, ], }, @@ -185,6 +188,7 @@ export default defineConfig({ { text: 'File Upload', link: '/en/guide/upload' }, { text: 'File Sharing', link: '/en/guide/share' }, { text: 'File Management', link: '/en/guide/management' }, + { text: 'MCP Integration', link: '/en/guide/mcp' }, ], }, { diff --git a/docs/en/guide/mcp.md b/docs/en/guide/mcp.md new file mode 100644 index 0000000..f7d72c2 --- /dev/null +++ b/docs/en/guide/mcp.md @@ -0,0 +1,24 @@ +# MCP Integration + +FileCodeBox provides a **Model Context Protocol (MCP)** endpoint over Streamable HTTP. Compatible AI clients can create text or file shares through it. + +## Connection + +Add a remote HTTP server in your MCP client: + +- **Transport**: Streamable HTTP +- **Server URL**: `http://:12345/mcp` +- **Authentication**: no token required by default + +For a local instance, use `http://localhost:12345/mcp`. If the administrator disables guest uploads or enables MCP token validation in the admin settings, configure `Authorization: Bearer ` in the client. Never commit the token to public configuration or source code. + +## Available tools + +- `share_text`: create a text share. Required: `text`; optional: `expire_value`, `expire_style`. +- `share_file`: upload a Base64-encoded file and create a share. Required: `filename`, `content_base64`; optional: `content_type`, `expire_value`, `expire_style`. + +`expire_style` accepts `day`, `hour`, `minute`, `forever`, or `count`; `expire_value` must be greater than zero. Successful calls return a share code, URL, and Markdown link. + +## Security and limits + +MCP uploads follow FileCodeBox's guest-upload switch, admin-token validation, upload-size and file-type limits, and upload rate limits. Expose the endpoint only to trusted AI clients. Use HTTPS for public deployments and keep the admin token secure. diff --git a/docs/guide/mcp.md b/docs/guide/mcp.md new file mode 100644 index 0000000..2b85eb1 --- /dev/null +++ b/docs/guide/mcp.md @@ -0,0 +1,24 @@ +# MCP 接入 + +FileCodeBox 提供 **Model Context Protocol (MCP)** 接口,支持通过 Streamable HTTP 让兼容的 AI 客户端创建文本或文件分享。 + +## 连接配置 + +在 MCP 客户端添加远程 HTTP 服务: + +- **传输方式**:Streamable HTTP +- **服务地址**:`http://:12345/mcp` +- **认证**:默认无需 Token + +例如本机部署时,地址为 `http://localhost:12345/mcp`。若管理员关闭了游客上传,或在管理设置中启用了 MCP Token 校验,请在客户端设置 `Authorization: Bearer <管理员 Token>`。不要把 Token 提交到公开配置或代码仓库。 + +## 可用工具 + +- `share_text`:创建文本分享。必填参数 `text`;可选 `expire_value`、`expire_style`。 +- `share_file`:上传 Base64 文件并创建分享。必填参数 `filename`、`content_base64`;可选 `content_type`、`expire_value`、`expire_style`。 + +过期方式 `expire_style` 支持 `day`、`hour`、`minute`、`forever` 和 `count`,`expire_value` 必须大于 0。调用成功后返回分享码、链接和 Markdown 链接。 + +## 安全与限制 + +MCP 上传遵循 FileCodeBox 的游客上传开关、管理员 Token 校验、上传大小限制、文件类型校验及上传频率限制。仅向可信任的 AI 客户端提供服务地址;使用公网部署时请配置 HTTPS 并妥善保管管理员 Token。 diff --git a/readme.md b/readme.md index 7a7491e..5857536 100644 --- a/readme.md +++ b/readme.md @@ -36,6 +36,11 @@ docker run -d --restart unless-stopped \ ``` 访问 `http://localhost:12345`,完成首次初始化。生产环境建议固定版本号;`latest` 指向最新正式版。 +## AI 客户端与 MCP + +FileCodeBox 支持 **MCP Streamable HTTP**,可从兼容的 AI 客户端创建文本和文件分享。服务端点为 `http://<你的服务器地址>:12345/mcp`(本机部署可用 `http://localhost:12345/mcp`),默认无需 Token。工具包括 `share_text` 和 `share_file`。若关闭游客上传或启用 MCP Token 校验,客户端需配置 `Authorization: Bearer <管理员 Token>`。 + +详见 [MCP 接入指南](https://fcb-docs.aiuo.net/guide/mcp)。 ## 简单,但足够强大 @@ -78,26 +83,6 @@ docker run -d --restart unless-stopped \ - [API 文档](https://fcb-docs.aiuo.net/api/) · 上传、取件与管理接口 - [前端源码](https://github.com/vastsa/FileCodeBoxFronted) · 当前 2024 主题 -## 相关项目 - -如果你也喜欢「盒子」系列的自托管工具,可以看看同作者的: - -### [BokeBox](https://github.com/vastsa/BokeBox/) · 私人 AI 播客盒 - -把视频、链接或文稿丢进去,生成可听完的个人播客,支持自定义主持人设与声音。 - -

- - BokeBox 横幅 - -

- -

- - BokeBox 首页 - -

- ## 参与项目 欢迎 [提交 Issue](https://github.com/vastsa/FileCodeBox/issues/new/choose) 或 Pull Request。项目基于 [LGPL-3.0](./LICENSE) 发布。 diff --git a/readme_en.md b/readme_en.md index 0bccf5c..bccfef2 100644 --- a/readme_en.md +++ b/readme_en.md @@ -36,6 +36,11 @@ docker run -d --restart unless-stopped \ ``` Open `http://localhost:12345` and complete first-run setup. Pin a version in production; `latest` tracks the newest stable release. +## MCP for AI clients + +FileCodeBox supports **MCP over Streamable HTTP**, allowing compatible AI clients to create text and file shares. Use `http://:12345/mcp` (or `http://localhost:12345/mcp` for a local instance). No token is required by default. The available tools are `share_text` and `share_file`. If guest uploads are disabled or MCP token validation is enabled, configure `Authorization: Bearer ` in the client. + +See the [MCP integration guide](https://fcb-docs.aiuo.net/en/guide/mcp). ## Simple, yet capable @@ -78,26 +83,6 @@ Open `http://localhost:12345` and complete first-run setup. Pin a version in pro - [API reference](https://fcb-docs.aiuo.net/en/api/) · upload, retrieval, and administration - [Frontend source](https://github.com/vastsa/FileCodeBoxFronted) · the active 2024 theme -## Related projects - -If you enjoy self-hosted “box” tools, also check out this project from the same author: - -### [BokeBox](https://github.com/vastsa/BokeBox/) · Private AI Podcast Box - -Drop in videos, links, or drafts, and get listen-worthy personal podcasts with custom host persona and voice. - -

- - BokeBox banner - -

- -

- - BokeBox home - -

- ## Contributing [Issues](https://github.com/vastsa/FileCodeBox/issues/new/choose) and pull requests are welcome. FileCodeBox is released under [LGPL-3.0](./LICENSE).