Skip to main content
Glama
cocrates

@cocrates/video-edit-mcp

by cocrates
README.md
# @cocrates/video-edit-mcp

YAML/JSON **edit spec**으로 영상을 검증·렌더하는 CLI 및 MCP 서버입니다.  
계약: [`spec/edit-spec.md`](./spec/edit-spec.md).  
렌더: **Remotion** (`@remotion/bundler` + `@remotion/renderer`).

## 요구 사항

- Node.js ≥ 20
- **시스템 ffmpeg 별도 설치 불필요** (Remotion 4가 인코딩·프레임 추출에 쓰는 바이너리를 관리)

## 설치

```bash
npm install
npm run build
npm link   # 선택: video-edit-mcp / video-edit 명령을 PATH에 연결
```

`npx @cocrates/video-edit-mcp` → **MCP** (`video-edit-mcp`). CLI는 `video-edit` 또는 `npx --package @cocrates/video-edit-mcp video-edit`.

## 엔트리

| 용도 | 경로 |
|------|------|
| MCP | `dist/mcp/index.js` (`video-edit-mcp`, npx 기본) |
| CLI | `dist/cli/index.js` (`video-edit`) |
| 라이브러리 | `dist/api.js` (`@cocrates/video-edit-mcp`) |

## CLI

명령 이름: **`video-edit`**

```bash
video-edit validate ./examples/cut-concat.yaml
video-edit validate ./examples/cut-concat.yaml --resolve
video-edit render ./edit.yaml
video-edit render ./edit.yaml -o ./out/final.mp4
```

빌드 산출물로 직접 실행:

```bash
node dist/cli/index.js validate ./examples/cut-concat.yaml
node dist/cli/index.js render ./edit.yaml
```

## MCP

Cursor `mcp.json` 예시는 [`examples/cursor-mcp.json`](./examples/cursor-mcp.json).

```json
{
  "mcpServers": {
    "video-edit-mcp": {
      "command": "npx",
      "args": ["-y", "@cocrates/video-edit-mcp"]
    }
  }
}
```

로컬 빌드본을 쓰려면:

```json
{
  "command": "node",
  "args": ["/home/drajin/work/video-edit-mcp/dist/mcp/index.js"]
}
```

연결 전(로컬):

```bash
cd /home/drajin/work/video-edit-mcp && npm install && npm run build
```

| Tool | 설명 |
|------|------|
| `validate_spec` | 스펙 검증 |
| `render_video` | Remotion으로 영상 렌더 |

## 라이브러리

```ts
import { renderEditSpecFile } from "@cocrates/video-edit-mcp";
await renderEditSpecFile("./edit.yaml");
```

## GitHub Release · npm 배포

패키지 이름: **`@cocrates/video-edit-mcp`** (scoped). npm에 퍼블리시하려면 해당 scope 권한이 필요합니다.

### 1. 버전 올리기

```bash
npm version patch   # 0.1.0 → 0.1.1
# 또는 minor / major
npm run build
```

### 2. npm 배포

```bash
npm login
npm publish --access public
```

`files` 필드에 `dist`, `README.md`, `LICENSE`만 포함되므로 **publish 전에 반드시 `npm run build`** 하세요. (`dist/`는 gitignore일 수 있습니다.)

### 3. GitHub Release

```bash
git push origin main --follow-tags

gh release create v0.1.1 \
  --title "v0.1.1" \
  --notes "$(cat <<'EOF'
## Changes
- …

## Install
npm install -g @cocrates/video-edit-mcp@0.1.1
EOF
)"
```

태그/릴리스는 `npm version`이 만든 git tag와 버전을 맞추면 됩니다.

### 권장 순서

1. PR 머지 → `main`  
2. `npm version` + `npm run build` + `npm publish`  
3. `git push --follow-tags` + `gh release create`  

CI에서 publish하려면 Node 18+, `NPM_TOKEN`, (선택) `GITHUB_TOKEN`을 시크릿으로 두면 됩니다.


## 라이선스

Apache License