@cutpro/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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +117 -0
  3. package/dist/index.js +379 -0
  4. package/package.json +49 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CutPro
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,117 @@
1
+ # @cutpro/mcp
2
+
3
+ MCP server that exposes the public CutPro v1 API as tools, so AI clients can drive
4
+ the full clipping flow: **analyze → submit → poll → list clips → render → download**,
5
+ plus balance and templates.
6
+
7
+ Built to work **everywhere** and to be **token-efficient**.
8
+
9
+ ## Tools
10
+
11
+ All 34 v1 endpoints are exposed, grouped by resource:
12
+
13
+ - **Workspace & balance**: `get_workspace`, `get_balance`, `get_balance_history`
14
+ - **Videos & uploads**: `list_videos`, `delete_video`, `start_upload`, `complete_upload`
15
+ - **Clipping**: `analyze_video`, `submit_clipping`, `list_submissions`, `get_submission`, `delete_submission`
16
+ - **Clips**: `list_clips`, `apply_template`, `delete_clip`
17
+ - **Templates**: `list_templates`
18
+ - **Renders**: `render_clip`, `list_renders`, `get_render`, `get_render_download`, `cancel_render`, `get_render_limits`, `start_bulk_download`, `get_bulk_download`
19
+ - **Posts (publishing)**: `create_post`, `list_posts`, `get_post`, `update_post`, `publish_post`, `retry_post_item`, `delete_post_item`, `delete_post`
20
+ - **Connections**: `list_connections`, `get_connection`
21
+
22
+ Each tool carries read-only / write / destructive annotations so clients can plan calls.
23
+
24
+ ## Token efficiency
25
+
26
+ - Results are **compact JSON** (no pretty-print) and **projected** to the fields
27
+ that matter, dropping null/empty values.
28
+ - `list_clips` is **rating-sorted**, capped (`limit`, default 10), and **omits the
29
+ long signed URLs** unless `include_urls: true`.
30
+ - Tools carry read-only / open-world **annotations** so clients can plan calls.
31
+
32
+ ## Setup
33
+
34
+ ```bash
35
+ bun install
36
+ cp .env.example .env # set CUTPRO_API_KEY
37
+ ```
38
+
39
+ API access requires the **Pro** plan. Generate a key at
40
+ [cut.pro/studio/me/api-keys](https://cut.pro/studio/me/api-keys).
41
+
42
+ ## Transports
43
+
44
+ ### stdio (default — all local clients)
45
+
46
+ Works with Claude Code, Claude Desktop, Cursor, Windsurf, VS Code, Cline, Zed, and
47
+ any other local MCP client. The client launches the process; it speaks MCP over
48
+ stdio. Set `CUTPRO_API_KEY` in the client's `env`.
49
+
50
+ **Claude Code**
51
+
52
+ ```bash
53
+ claude mcp add cutpro --env CUTPRO_API_KEY=SUA_CHAVE -- npx -y @cutpro/mcp
54
+ ```
55
+
56
+ **Claude Desktop / Cursor / Windsurf / VS Code** (`mcpServers` config):
57
+
58
+ ```json
59
+ {
60
+ "mcpServers": {
61
+ "cutpro": {
62
+ "command": "npx",
63
+ "args": ["-y", "@cutpro/mcp"],
64
+ "env": { "CUTPRO_API_KEY": "SUA_CHAVE" }
65
+ }
66
+ }
67
+ }
68
+ ```
69
+
70
+ Until published to npm, replace `npx -y @cutpro/mcp` with
71
+ `bun run /path/to/cutpro-mcp/src/index.ts`.
72
+
73
+ ### Streamable HTTP (remote / self-host)
74
+
75
+ ```bash
76
+ MCP_TRANSPORT=http PORT=8787 bun run src/index.ts # serves /mcp
77
+ ```
78
+
79
+ The endpoint is stateless. The key is read **per request** from
80
+ `Authorization: Bearer <key>` or `X-Api-Key` (env key is the fallback), and
81
+ `X-Workspace-Id` is honored, so one deployment can serve many users.
82
+
83
+ ### OAuth 2.1 (browser clients: ChatGPT, Claude.ai)
84
+
85
+ ```bash
86
+ MCP_TRANSPORT=http PORT=8787 MCP_OAUTH=1 MCP_PUBLIC_URL=https://mcp.cut.pro bun run src/index.ts
87
+ ```
88
+
89
+ With `MCP_OAUTH=1` the server becomes a full OAuth 2.1 authorization server
90
+ (metadata discovery, Dynamic Client Registration, PKCE, token + refresh,
91
+ revocation) using the MCP SDK helpers. The flow:
92
+
93
+ 1. The client (ChatGPT/Claude.ai) discovers the server via the `WWW-Authenticate`
94
+ header on the `401` from `/mcp` and registers itself.
95
+ 2. The user is sent to a **consent page** where they paste their CutPro API key.
96
+ 3. The key is validated against the API; on success a code → access token is
97
+ issued. The token maps server-side to that key.
98
+ 4. `/mcp` is protected by bearer auth; each call uses the token's key.
99
+
100
+ `MCP_PUBLIC_URL` is the public endpoint (e.g. `https://mcp.cut.pro`); its origin
101
+ becomes the OAuth issuer. Token/code/client stores are **in-memory** — fine for a
102
+ single instance; back them with Redis/DB for HA.
103
+
104
+ **Hosting**: run it on a dedicated host at the root and point a reverse proxy at it:
105
+
106
+ ```
107
+ your-mcp-host { reverse_proxy localhost:8787 }
108
+ ```
109
+
110
+ To connect to the hosted instance: add `https://mcp.cut.pro` as a custom connector
111
+ in ChatGPT or Claude.ai and complete the consent step.
112
+
113
+ ## Build
114
+
115
+ ```bash
116
+ bun run build # outputs dist/index.js
117
+ ```