shipwithmuse

№ 0225Skill

muse-fileapi local file connector

muse-fileapi is a dependency-free local HTTP service exposed via Cloudflare Tunnel that lets Muse, through a custom connector, list, read and write files in whitelisted directories with two-phase writes and an audit log.

muse-fileapi local file connector on github.com
star-power0/muse-fileapiREADME ↗
# muse-fileapi

[English](README.en.md) | 中文

让 Meta Muse 能读写你本机文件的连接器服务。

Muse 住在 Meta 云端的机器里,够不到你的电脑。这个服务在你本机跑一个小 HTTP 接口,再经 Cloudflare Tunnel 暴露出去,Muse 就能通过自定义连接器访问它:列目录、读写改删文件、执行 shell 命令。

> ⚠️ **用你自己的域名!**
> 本项目不提供任何公共服务端点。`https://files.your-domain.com` 这类地址只是占位写法——
> 你必须用**自己的域名 + 自己的 Cloudflare Tunnel** 把本机服务暴露出去。
> 绝不要把 token 告诉任何人,也绝不要提交到 Git(见下方安全设计)。

## 快速开始

1. 安装 [Node.js](https://nodejs.org/)(只需要运行时,无第三方依赖)
2. 复制配置:`config.example.json` → `config.json`,把 `allowedRoots` 改成你想开放的目录
3. 启动:`node server.mjs`(监听 `127.0.0.1:8787`)
4. 用你自己的 Cloudflare Tunnel 把 `127.0.0.1:8787` 暴露到**你自己的域名**
5. 把 `CONNECTOR-BRIEF.md` 的内容喂给 Muse,走它的安全凭据流程输入 token(首次启动时自动生成,见下文"取 token")

## 结构

```
muse-fileapi/
├─ server.mjs           服务本体(单文件,无依赖)
├─ config.json          ← 你要改的就是这个:白名单在这里(不进 git,见 config.example.json)
├─ CONNECTOR-BRIEF.md   喂给 Muse 的连接器说明
└─ .muse-fileapi/       自动生成,不要手动改(不进 git)
   ├─ token             访问令牌(绝不通过 API 暴露)
   ├─ backups/          每次覆盖写入前的自动备份
   ├─ trash/            删除的文件移到这里(可手动恢复)
   └─ audit.jsonl       所有操作的审计日志
```

## 安全设计

| 机制 | 作用 |
|---|---|
| 只监听 `127.0.0.1` | 默认本机可达,公网暴露是单独的显式步骤 |
| Bearer token | 256 位随机;存在 `.muse-fileapi/token`,**不在 config.json 里** |
| 目录白名单 | `allowedRoots` 之外一律 403,含路径穿越 |
| 敏感文件黑名单 | 白名单内也拦 `.env`、密钥、`.ssh`、`.git`、`node_modules` |
| 自我防护 | 拒绝提供 `config.json`、token、备份、回收站、审计日志本身 |
| 两阶段变更 | `prepare` 只算 diff/预览不落盘,`confirm` 才执行;适用于写、改、删、执行命令 |
| 自动备份 | 覆盖已有文件前先存一份 |
| 删除进回收站 | `delete` 只是把文件移到 `trash/`,不是真删,可手动恢复 |
| 审计日志 | 每次读、写、删、执行、拒绝都记录 |

**注意**:隧道一旦启用,这个服务就是**公网可达**的。Token 是唯一的锁,不要分享、不要提交到 Git。**`/run` 端点可以执行任意 shell 命令**——拿到 token 就等于能在你电脑上跑命令,保管级别和密码一样。

## 能力(Muse 能用它做什么)

- 读:列目录、读文件(含分页)、看文件信息、按文件名找(glob)、搜内容(字面量或正则)
- 改:整文件覆盖、精确字符串替换、一次多处替换、末尾追加——覆盖/替换两阶段确认,追加直接执行
- 文件操作:复制、移动/重命名(默认防覆盖)、建目录——直接执行
- 删:两阶段确认,删进回收站
- 跑:执行 shell 命令(Windows 下是 pwsh),比如改完代码跑个 `node --check` 校验——每次都要你点头;
  长任务可用后台模式(`background: true`),随时查输出、随时停(连进程树一起杀)

完整端点说明见 `CONNECTOR-BRIEF.md`。

## 启动(Windows 常驻方案)

**开机自启**:建一个 Windows 计划任务,登录时运行 `start-muse-fileapi.cmd`,无需手动启动,日志追加到 `.muse-fileapi\server.log`。

```powershell
schtasks /Run   /TN muse-fileapi     # 立即启动
schtasks /End   /TN muse-fileapi     # 停止
schtasks /Query /TN muse-fileapi /V  # 查看状态
```

**保活**:`watchdog.ps1` 注册为计划任务(每 5 分钟跑一次),`/health` 不通就重启服务并弹通知。`check-status.cmd` 一键自检(本地/公网/隧道)。

手工前台运行(先停掉计划任务,否则端口占用):

```bash
cd D:\YourWorkspace\muse-fileapi

Also filed under Connectors & MCP

See all →
  1. 0842

    Muse in iMessage via BlueBubbles★

    https://github.com/mvrius/bluebubbles-muse BlueBubbles server on my Mac, Muse hook polling it every ~5s. How it works: the poll driver (bash shim + Python filter) checks for new messages and filters on an allowlist of senders, 1:1 chats, and group GUIDs. A new message from an allowlisted sender wakes Muse into a side chat with the message as context. Replies go back out as normal iMessages through the Mac. Why this instead of a messaging connector: connectors need an approval tap on every send, otherwise similar could be acheived via Messenger connector. Setup: BlueBubbles on the Mac, Tailscale so the agent VM can reach it, run the installer. Repo has the hook scripts, installer, architecture doc, and skill definition. Known issues: I am noticing that sometimes Tailscale connection drops on the Mac. I found that I need to bring down/up tailscale every hour for connection to stay up. A fun example from earlier today, I updated my calendar, moved dinner with my wife by 30 minutes - Muse mesaged the Family chat and informed my wife of the change. Cool findings: - Muse has a Tailscale option, you can connect the VM it runs on in Client model with other machines running Tailscal

    u/Gold-Entry9142

    Reddit post

    Connectors & MCP

  2. 0707

    Todo-app sync built without an official API★

    Still really enjoying @muse. I use Things.app for all of my todos, and though it has cloud sync they (still) haven’t added an official API. I told muse to build it and a minute or two later I have ongoing todo sync from my LLM across all my Apple devices. Wild.

    @holman

    X post

    Connectors & MCP

  3. 0161

    Muse connector platform portal★

    Meta's developer portal for Muse connectors: describe a connector, submit it for functional, security and legal review plus end-to-end testing, and get listed in the Muse directory.

    muse.ai

    Site

    Connectors & MCP

  4. 0152

    Muse Connectors: 150 one-paste skills★

    An open-source collection of 150 auditable connector skills for Muse that install with one pasted prompt, declare their allowed hosts and keep credentials in the user's Muse vault.

    @bluman1

    Skill

    Connectors & MCP

More Skills

See all →
  1. 1073

    Xahau skill for Muse

    Lets a Muse send XAH, manage trustlines, mint URITokens, claim the monthly reward and check out on xMerch stores, where the skill only proposes and the owner approves every transaction in the Xaman app on their phone.

    @terramike

    Skill

    Business & commerce

  2. 1068

    musebook: shared family boards for Muses

    An open protocol plus Muse skill and Cloudflare Workers reference server that lets each family member's Muse join shared boards (groceries, trips, household lists) with per-board identities and an approval card before anything is ordered.

    @amanbthakkar

    Skill

    Errands & personal agent

  3. 1062

    xrpl-muse-skill: let your Muse trade XRP

    A terminal skill for trading any XRP Ledger token pair and minting NFTs, with a hard boundary between proposing and signing; testnet by default, and mainnet needs the Muse vault signer or a protected signer with per-transaction approval.

    @terramike

    Skill

    Business & commerce

  4. 1052

    changelly-buy Muse skill

    A Muse skill that helps people buy crypto (XRP by default) with a card through Changelly, giving CoinGecko spot estimates, prefilled buy links and plain fee disclosure without any API keys.

    @terramike

    Skill

    Business & commerce

Curator picks

  1. 1046

    Medical bills audited line by line, $4,000 saved★

    Got Muse logged in to my medical provider’s portal, he pulled the itemized bills, and questioned every line. So far he’s found several times I’d been double billed, asked for some discounts and has saved me over $4,000. If your moat is bureaucracy, you’re cooked.

    @Ryan_Holdaway

    X post

    Errands & personal agent

  2. 1013

    Shop Pay agentic checkout on every Shopify store★

    We are excited to announce we are partnering deeply with Muse to enable agentic checkout with Shop Pay on all Shopify stores, offering people an easy and delightful way to shop and check out with Muse.

    @tobi

    X post

    Business & commerce

  3. 1009

    Private e-book library app from Google Drive★

    Muse built me a private library for the e-books and articles in my Google Drive. Everything is organized by topic, and each section opens onto its own subcategorized shelves. Each book opens like a real book and is readable in-app

    @chiasmus_cap

    X post

    Apps & websites

  4. 1007

    Plumbing company run by a Muse agent★

    I still can’t believe I can run my plumbing company with an agent so easily. I send this message to my Muse agent while in bed at 6am. And it: updates my job board, texts customer, updates office manager who arrives at 8am in slack Notifies technician

    @HouseHackerJon

    X post

    Agents & automation