@fullstackcraftllc/codevideo-mcp 1.0.2 → 1.2.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 (44) hide show
  1. package/README.md +131 -16
  2. package/dist/index.d.ts +3 -0
  3. package/dist/index.js +3525 -1926
  4. package/dist/index.js.map +7 -0
  5. package/package.json +41 -33
  6. package/bin/darwin-arm64/codevideo-cli +0 -0
  7. package/bin/darwin-x64/codevideo-cli +0 -0
  8. package/bin/linux-x64/codevideo-cli +0 -0
  9. package/bin/win32-x64/codevideo-cli.exe +0 -0
  10. package/dist/src/constants/Constants.d.ts +0 -2
  11. package/dist/src/index.d.ts +0 -2
  12. package/dist/src/prompts/instructions_to_create_a_course.d.ts +0 -1
  13. package/dist/src/prompts/instructions_to_create_lesson_actions.d.ts +0 -1
  14. package/dist/src/prompts/instructions_to_create_lesson_video.d.ts +0 -1
  15. package/dist/src/prompts/instructions_to_translate_actions.d.ts +0 -2
  16. package/dist/src/resources/get_action_names.d.ts +0 -4
  17. package/dist/src/resources/get_example_actions_array_by_keyword.d.ts +0 -1
  18. package/dist/src/resources/get_example_lessons_by_keyword.d.ts +0 -1
  19. package/dist/src/rest-server/index.d.ts +0 -24
  20. package/dist/src/rest-server/job-manager.d.ts +0 -56
  21. package/dist/src/rest-server/mcp-client.d.ts +0 -23
  22. package/dist/src/rest-server/rest-server.d.ts +0 -24
  23. package/dist/src/rest-server/server.d.ts +0 -4
  24. package/dist/src/tools/add_actions_to_lesson.d.ts +0 -2
  25. package/dist/src/tools/add_final_snapshot_to_lesson.d.ts +0 -2
  26. package/dist/src/tools/add_initial_snapshot_to_lesson.d.ts +0 -2
  27. package/dist/src/tools/add_lesson_to_course.d.ts +0 -2
  28. package/dist/src/tools/create_course_with_initial_metadata.d.ts +0 -1
  29. package/dist/src/tools/critique_video_using_gemini.d.ts +0 -2
  30. package/dist/src/tools/get_current_actions.d.ts +0 -3
  31. package/dist/src/tools/get_current_lesson.d.ts +0 -3
  32. package/dist/src/tools/get_empty_lesson_snapshot.d.ts +0 -1
  33. package/dist/src/tools/get_final_lesson_snapshot.d.ts +0 -2
  34. package/dist/src/tools/get_initial_lesson_state_from_github_repo.d.ts +0 -1
  35. package/dist/src/tools/get_initial_lesson_state_from_local_repo.d.ts +0 -1
  36. package/dist/src/tools/is_repeatable_action.d.ts +0 -2
  37. package/dist/src/tools/make_blog_post.d.ts +0 -2
  38. package/dist/src/tools/make_html_web_page.d.ts +0 -2
  39. package/dist/src/tools/make_video_from_actions.d.ts +0 -8
  40. package/dist/src/tools/make_video_from_lesson.d.ts +0 -8
  41. package/dist/src/tools/set_current_actions.d.ts +0 -2
  42. package/dist/src/tools/set_current_lesson.d.ts +0 -2
  43. package/dist/src/tools/validate_actions.d.ts +0 -6
  44. package/dist/src/utils/getBinaryPath.d.ts +0 -1
package/README.md CHANGED
@@ -17,40 +17,129 @@ Conversion:
17
17
  - "Please convert these CodeVideo JSON actions to a video"
18
18
  - "Convert these CodeVideo JSON actions to a blog post"
19
19
  - "Convert these CodeVideo JSON actions to HTML"
20
- - "Can you convert this lesson to one in Spanish?"
20
+ - "Can you convert this English-based lesson to Spanish?"
21
21
 
22
22
  Validation:
23
23
 
24
24
  - "Are these CodeVideo JSON actions valid?"
25
25
 
26
+ ## Requirements
27
+
28
+ - Node.js 22.13 or newer. The MCP keeps its data in SQLite through Node's built-in `node:sqlite`, so nothing native is compiled on install.
29
+ - For videos: the npm package installs the matching native CodeVideo CLI automatically, and rendering also needs Chrome/Chromium and FFmpeg.
30
+ - For narration, one of:
31
+ - **ElevenLabs:** `ELEVEN_LABS_API_KEY` (and optionally `ELEVEN_LABS_VOICE_ID`). The CLI uploads each clip to CodeVideo's S3 bucket, so this also needs `CODEVIDEO_S3_KEY_ID` and `CODEVIDEO_S3_SECRET` with access to it.
32
+ - **Kokoro** (self-hosted, no cloud account): `CODEVIDEO_TTS_PROVIDER=kokoro` and `TTS_SERVICE_URL` pointing at a codevideo-tts (Kokoro) service. Clips are embedded in the video job directly.
33
+
26
34
  ## Usage with Claude Desktop
27
35
 
28
- Simply drop the following into your `claude_desktop_config.json` file:
36
+ Validate the host first with:
37
+
38
+ ```shell
39
+ npx @fullstackcraftllc/codevideo-cli doctor
40
+ ```
41
+
42
+ If Chrome is not detected, run `npx @fullstackcraftllc/codevideo-cli install-browser`. `PATH_TO_CODEVIDEO_CLI` remains available as an optional override for local CLI builds.
43
+
44
+ Add the server under `mcpServers` in your `claude_desktop_config.json` file, next to any others you have:
29
45
 
30
46
  ```json
31
47
  {
32
- // ... other MCP servers
33
- "codevideo-mcp": {
34
- "command": "npx",
35
- "args": [
36
- "-y",
37
- "@fullstackcraftllc/codevideo-mcp@latest"
38
- ],
39
- "env": {
40
- "ELEVENLABS_API_KEY": "your-elevenlabs-api-key",
41
- "ELEVENLABS_VOICE_ID": "your-elevenlabs-voice-id"
48
+ "mcpServers": {
49
+ "codevideo-mcp": {
50
+ "command": "npx",
51
+ "args": [
52
+ "-y",
53
+ "@fullstackcraftllc/codevideo-mcp@latest"
54
+ ],
55
+ "env": {
56
+ "CODEVIDEO_TTS_PROVIDER": "kokoro",
57
+ "TTS_SERVICE_URL": "http://localhost:3000"
58
+ }
42
59
  }
43
- },
44
- // ... other MCP servers
60
+ }
45
61
  }
46
62
  ```
47
63
 
64
+ (Or the ElevenLabs and S3 variables from [Requirements](#requirements) instead of the two Kokoro ones.)
65
+
66
+ ## Usage with Claude Code
67
+
68
+ ```shell
69
+ claude mcp add codevideo -e CODEVIDEO_TTS_PROVIDER=kokoro -e TTS_SERVICE_URL=http://localhost:3000 -- npx -y @fullstackcraftllc/codevideo-mcp@latest
70
+ ```
71
+
72
+ Pass the ElevenLabs and S3 variables with `-e` instead of the two Kokoro ones if you use ElevenLabs.
73
+
74
+ ## Usage with Codex
75
+
76
+ Add the published MCP server to `~/.codex/config.toml`:
77
+
78
+ ```toml
79
+ [mcp_servers.codevideo]
80
+ command = "npx"
81
+ args = ["-y", "@fullstackcraftllc/codevideo-mcp@latest"]
82
+ startup_timeout_sec = 60
83
+ env_vars = ["CODEVIDEO_TTS_PROVIDER", "TTS_SERVICE_URL", "ELEVEN_LABS_API_KEY", "ELEVEN_LABS_VOICE_ID", "CODEVIDEO_S3_KEY_ID", "CODEVIDEO_S3_SECRET", "GEMINI_API_KEY"]
84
+ ```
85
+
86
+ Restart Codex or open a new thread after changing MCP configuration.
87
+
48
88
  Be sure to restart Claude after modifying this config!
49
89
 
50
90
  After restarting Claude Desktop, if installation was successful, you should see `codevideo-mcp` in the list of installed MCPs:
51
91
 
52
92
  ![codevideo-mnp successfully installed in Claude Desktop](./codevideo-mcp-installed.png)
53
93
 
94
+ ## Building a course
95
+
96
+ For anything longer than one lesson, start with the `codevideo_instructions_to_build_course_from_scratch` prompt tool. The course lives in the MCP, keyed by id, so the model writes each lesson's actions once and never carries snapshots or earlier lessons in its context:
97
+
98
+ 1. `codevideo_create_course` returns a `courseId`; `codevideo_add_lesson` adds lessons, each continuing from the previous one's final state by default.
99
+ 2. `codevideo_set_lesson_actions` stores a lesson's actions. To change part of a lesson later, `codevideo_edit_lesson_actions` applies splice-style edits, and `codevideo_get_lesson_actions` reads actions back a slice at a time.
100
+ 3. `codevideo_get_lesson_file_tree`, `codevideo_get_lesson_file` and `codevideo_compile_lesson` read and check the code at the end of a lesson without pulling snapshots.
101
+ 4. `codevideo_validate_course` returns `done: true` once every lesson is valid, continuous, and compiles where it should. Previews and videos refuse to run before that. It also rejects actions that change files with nothing on screen causing them (`file-explorer-create-file` and similar), because in the video the file would just appear. Lessons make files with the mouse (right-click, New File) or with `touch` in the terminal.
102
+ 5. `codevideo_generate_course_previews` writes an HTML page per lesson to review; `codevideo_render_course_videos` then renders every lesson.
103
+ 6. `codevideo_get_course_status` shows where things stand, with an estimated length per lesson; `codevideo_export_course` writes the whole course to a JSON file and returns its path.
104
+
105
+ The model learns the actions from `codevideo_get_action_names`, which lists each one with what it does and what its value takes, straight from codevideo-types.
106
+
107
+ The older single-slot tools (`codevideo_set_current_actions`, `codevideo_set_current_lesson` and the tools that read them) still work for single videos. Every conversation shares their one slot, though, so use the course tools for anything bigger.
108
+
109
+ ## Rendering videos
110
+
111
+ Every video tool (`codevideo_make_video_from_actions`, `codevideo_make_video_from_lesson`, `codevideo_render_lesson_video`, `codevideo_render_course_videos`) queues a render job and returns at once with a `jobId`. A background worker renders the queue one video at a time, and keeps going if you close Claude or Codex.
112
+
113
+ - `codevideo_get_render_job` shows a job's status (queued, running, succeeded, failed, cancelled or interrupted), its latest progress line, the saved file, any error, and the end of the CLI's log.
114
+ - `codevideo_list_render_jobs` lists recent jobs, for one course or all.
115
+ - `codevideo_cancel_render_job` cancels one job, or everything unfinished in a course, stopping the browser too.
116
+
117
+ All four video tools take the same `options`:
118
+
119
+ | Option | Values |
120
+ | --- | --- |
121
+ | `orientation` | `landscape` (default) or `portrait` (1080×1920) |
122
+ | `theme` | `dark` or `light` |
123
+ | `isFileExplorerVisible`, `isTerminalVisible`, `isEditorTabsVisible`, `isMinimapVisible`, `isMouseVisible`, `withCaptions` | `true` / `false`; for portrait, usually hide the explorer, tabs, minimap and mouse |
124
+ | `fontSizePx`, `fileExplorerWidth`, `terminalHeight`, `mouseColor`, `wordWrap`, `defaultLanguage` | IDE layout |
125
+ | `keyboardTypingPauseMs`, `standardPauseMs`, `longPauseMs` | pacing |
126
+ | `voiceId`, `ttsProvider` | narration voice and provider |
127
+ | `renderMode` | `realtime` (default) or `deterministic`; `renderSeed` and `renderWorkers` (1–32) apply to deterministic renders |
128
+ | `isDiagnosticsVisible` | `true` / `false`: TypeScript squiggles in the editor from the start; lessons can also turn them on and off with `editor-show-diagnostics` and `editor-hide-diagnostics` |
129
+
130
+ They also take `open`: whether to open the finished video in your default player. It defaults to on for single videos and off for whole courses.
131
+
132
+ Videos are saved to `CODEVIDEO_OUTPUT_DIR`, or your Desktop.
133
+
134
+ ## Where your data lives
135
+
136
+ Everything is under `~/.codevideo/`, or the folder `CODEVIDEO_HOME` points to:
137
+
138
+ - `codevideo.db`: courses, lessons, the legacy single slot, and the render queue.
139
+ - `jobs/<jobId>/`: each render's project, settings and CLI logs (`stdout.log`, `stderr.log`); `jobs/worker.log` is the worker's own log.
140
+ - `exports/`: course exports.
141
+ - `previews/`: lesson previews.
142
+
54
143
  ## Local Development
55
144
 
56
145
  Clone this repository:
@@ -67,6 +156,13 @@ npm install
67
156
  npm run build
68
157
  ```
69
158
 
159
+ Run the tests (type-check, unit and integration tests with a fake CLI, and the token-flatness check) with:
160
+
161
+ ```shell
162
+ npm run type-check
163
+ npm test
164
+ ```
165
+
70
166
  Then, use the following JSON to run the local version on your Claude Desktop:
71
167
 
72
168
  ```json
@@ -78,12 +174,31 @@ Then, use the following JSON to run the local version on your Claude Desktop:
78
174
  "/path/to/your/clone/of/codevideo-mcp/src/index.ts"
79
175
  ],
80
176
  "env": {
81
- "PATH_TO_CODEVIDEO_CLI": "/path/to/your/codevideo-cli",
177
+ "ELEVEN_LABS_API_KEY": "your-elevenlabs-api-key",
178
+ "ELEVEN_LABS_VOICE_ID": "your-elevenlabs-voice-id"
82
179
  }
83
180
  }
84
181
  // ... other MCP servers
85
182
  ```
86
183
 
184
+ ### Experimental REST server
185
+
186
+ `src/rest-server` holds an experimental REST and agent server (`npm run rest-server`). It isn't part of the published package; its dependencies are dev dependencies, and parts of it (the agent loop, the job manager) are still simulated.
187
+
87
188
  ## Known Issues
88
189
 
89
- - Currently, creating entire courses seems to be a bit flakey and perhaps too large for the context window for Claude. We're working on refining the full course flow. Single lesson, or action array generation both seem to work well.
190
+ - Compile checks can't resolve third-party packages yet: a lesson that imports `react` reports "Cannot find module 'react'", so courses that depend on npm packages can't pass `codevideo_validate_course`.
191
+ - With CLI 0.0.13, a project is passed to the CLI on its command line, so a single lesson is limited to about 120 KiB as JSON (about 30 KB on Windows). The MCP refuses bigger ones with a clear message.
192
+
193
+
194
+ ## Lesson verification
195
+
196
+ `codevideo_compile_lesson` freshly replays a lesson from a cloned initial snapshot and checks its saved end-state projects. It reports `outcome: passed | failed | blocked | unsupported`; legacy `status` is `ok` only for passed. Each project reports its root, declared check (`syntax`, `typecheck`, `build`), checked/supporting/unsupported paths, compiler version, structured errors and prerequisite issues. Missing tools/dependencies and nothing-checkable lessons never pass.
197
+
198
+ Dirty editor buffers and disagreement with a stored final snapshot are reported in `lessonIssues`; the server does not autosave or silently repair snapshots. Save buffers using actions, then reapply edits and recheck. Replay warnings remain warnings. Course completion requires passed verification for every mustCompile lesson and the final lesson. Intermediate mustCompile:false lessons remain available for deliberate errors or discussion.
199
+
200
+ TS/JS verification uses real compiler inputs, local project configuration and available dependency declarations. No generated untyped import shims are used. The existing `diagnostics` field and hover checks remain Monaco-compatible presentation checks and do not establish a project pass. Python guarantees syntax only; Go and C# perform offline builds. Rust is explicitly unsupported. See dynamic AST's README for prerequisites and limitations; native builds are not a security sandbox.
201
+
202
+ No dependency restoration from the network occurs during verification. `CODEVIDEO_HOME` optionally sets the MCP state directory (default ~/.codevideo), including for isolated tests.
203
+
204
+ To test unreleased compiler changes without publishing: build dynamic AST and create a tarball with `npm pack --ignore-scripts`; install it locally with `npm install --no-save --package-lock=false <tarball>`, then run the MCP typecheck, tests and build. If the existing local diagnostics changes in codevideo-types are also unreleased, pack that package and set `CODEVIDEO_TYPES_TARBALL` to its absolute path. Set `CODEVIDEO_DYNAMIC_AST_TARBALL` to the compiler tarball path when running `npm run smoke:packed` to exercise the actual packaged compiler through MCP. Neither package version is changed by this workflow. Before shipping, the corresponding compiler release must be published and the MCP dependency/lockfile updated together.
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+
3
+ export declare function createMcpServer(): McpServer;