goatedit-mcp 1.0.0

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.
package/README.md ADDED
@@ -0,0 +1,141 @@
1
+ # GoatEdit MCP server (local)
2
+
3
+ Lets an AI assistant connect to your running GoatEdit tab and edit video.
4
+
5
+ This is the **local** server: an stdio MCP process on your own machine. There is
6
+ also a remote one at `https://ai.goatedit.com/mcp` that needs no install — see
7
+ [`docs/MCP.md`](../docs/MCP.md) for both, and for how they fit together.
8
+
9
+ Use this one when you want tools that touch your disk (`list_local_assets`,
10
+ `generate_voiceover`) or when nothing may leave the machine.
11
+
12
+ ## How it works
13
+
14
+ On start it:
15
+
16
+ 1. Listens on `127.0.0.1:9000` — WebSocket for the browser, HTTP for serving local media.
17
+ 2. Advertises editing tools to the AI over stdio.
18
+ 3. Bridges each tool call to the GoatEdit tab, which applies it to live editor state.
19
+
20
+ Connected, the toolbar reads **AI Connected**.
21
+
22
+ Loopback only, deliberately: this server serves local files and accepts edit
23
+ commands, so it must not be reachable from the network. Loopback does not keep
24
+ out other web pages open in the same browser, so on top of that:
25
+
26
+ - the Host header must be loopback, which defeats DNS rebinding;
27
+ - the editor socket and `/media/` accept only `https://ai.goatedit.com` and
28
+ localhost origins (add more with `GOATEDIT_ALLOWED_ORIGINS`);
29
+ - a `/controller` socket (scripts such as `mcp-test.mjs`) must send
30
+ `Authorization: Bearer <token>`. The token is random per run and written to
31
+ `~/.goatedit/mcp-controller-token` (mode 0600).
32
+
33
+ ---
34
+
35
+ ## Setup
36
+
37
+ ### From npm
38
+
39
+ Once published, nothing to clone or build — the package is one bundled file
40
+ with no dependencies:
41
+
42
+ ```bash
43
+ claude mcp add goatedit-local -- npx -y goatedit-mcp
44
+ ```
45
+
46
+ Then skip to step 3. The steps below are for running from this repo.
47
+
48
+ ### Publishing
49
+
50
+ `npm publish` from this folder. `prepublishOnly` compiles (which typechecks)
51
+ and bundles `src/index.ts` plus the shared tool catalogue into
52
+ `bundle/goatedit-mcp.js`; the tarball holds only that, this README and
53
+ `package.json`. Check it first with `npm pack --dry-run`.
54
+
55
+ ### 1. Build
56
+
57
+ ```bash
58
+ npm install
59
+ npm run build
60
+ ```
61
+
62
+ ### 2. Register
63
+
64
+ Claude Code:
65
+
66
+ ```bash
67
+ claude mcp add goatedit-local -- node "$PWD/dist/mcp-server/src/index.js"
68
+ ```
69
+
70
+ Claude Desktop — `~/Library/Application Support/Claude/claude_desktop_config.json`
71
+ (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
72
+
73
+ ```json
74
+ {
75
+ "mcpServers": {
76
+ "goatedit-local": {
77
+ "command": "node",
78
+ "args": ["/absolute/path/to/goatedit-collab/mcp-server/dist/mcp-server/src/index.js"],
79
+ "env": { "GOATEDIT_ASSETS_DIR": "/absolute/path/to/your/media" }
80
+ }
81
+ }
82
+ }
83
+ ```
84
+
85
+ ### 3. Restart the client, then turn Local on in the editor
86
+
87
+ AI menu → **Local** → Turn on. It is off by default, so the tab never dials the
88
+ port unless you ask.
89
+
90
+ **Chrome only.** The tab dials `ws://localhost:9000` from an https page; Chrome
91
+ permits this because localhost is a potentially-trustworthy origin, Firefox and
92
+ Safari do not. Either use Chrome, or run the editor over plain http on localhost.
93
+
94
+ ---
95
+
96
+ ## Configuration
97
+
98
+ | Variable | Default | Meaning |
99
+ |---|---|---|
100
+ | `GOATEDIT_ASSETS_DIR` | `~/Movies` | The one folder this server may list and serve |
101
+ | `GOATEDIT_ALLOWED_ORIGINS` | — | Extra editor origins, comma-separated (production and localhost are always allowed) |
102
+ | `GOATEDIT_CONTROLLER_TOKEN` | random per run | Pin the `/controller` token instead of generating one |
103
+
104
+ `list_local_assets` reads that folder; `/media/<name>` serves from it, and paths
105
+ that resolve outside it are a 404. Generated voiceovers are written there too.
106
+
107
+ ---
108
+
109
+ ## Tools
110
+
111
+ Three tools are local to this server, because they touch this machine:
112
+
113
+ | Tool | Description |
114
+ |---|---|
115
+ | `list_connected_projects` | Every GoatEdit tab attached right now, and which is the default target |
116
+ | `list_local_assets` | Media in `GOATEDIT_ASSETS_DIR`, with URLs the browser can load |
117
+ | `generate_voiceover` | Synthesise narration with macOS `say` and add it to the bin |
118
+
119
+ Every other tool comes from `api/_lib/mcp-tools.ts` — the same catalogue the
120
+ hosted server at ai.goatedit.com/mcp serves. It is imported, not copied, so the
121
+ two transports cannot drift: a tool added there appears here on the next build,
122
+ and both hand the method to the same `executeMcpCommand` inside the tab. Run
123
+ `tools/list` for the current set rather than trusting a table in a README.
124
+
125
+ The one shared tool that is dropped is `get_session_status`, which asks the
126
+ hosted relay about its Realtime session. This server has no session — it has a
127
+ socket table, which `list_connected_projects` reports.
128
+
129
+ Every tool takes an optional `projectId`. One stdio server can hold several tabs
130
+ at once; without it, edits go to the most recently active one.
131
+
132
+ Clip ids change after every split, trim and delete — call `get_timeline` before
133
+ each edit rather than reusing ids from an earlier response.
134
+
135
+ Multiple tabs can be attached at once. Tools default to the most recently active
136
+ project; pass `projectId` from `list_connected_projects` to target a specific one.
137
+
138
+ ## Platform notes
139
+
140
+ `generate_voiceover` needs macOS `say` and reports that plainly elsewhere. Every
141
+ other tool is cross-platform.