An MCP (Model Context Protocol) server for Moho Pro 14 β enabling AI assistants like Claude Desktop and Claude Code to read, write, animate, and visually operate MOHO animation projects.
Fully cross-platform: Windows and macOS.
βββββββββββββββββββββββ File-based IPC ββββββββββββββββββββββββ
β MCP Bridge Server βββββββββββββββββββββΊ β Moho Lua Plugin β
β (TypeScript/Node) β $TMPDIR/moho-mcp/ β (runs inside MOHO) β
ββββββββββ¬βββββββββββββ JSON-RPC 2.0 ββββββββββββββββββββββββ
β MCP Protocol (stdio)
ββββββββββΌβββββββββββββ
β MCP Client/Host β
β (Claude Desktop, β
β Claude Code, etc) β
βββββββββββββββββββββββ
Three components:
- Moho Lua Plugin β File-based IPC server running inside MOHO, handles read/write operations via MOHO's Lua 5.4 API
- MCP Bridge Server β Node.js process bridging MCP protocol (stdio) to file-based JSON-RPC
- Static Knowledge Resources β Keyboard shortcuts and tool reference data from the Moho manual
| Capability | Description |
|---|---|
| Read | Query document structure, layers, bones, animation keyframes, mesh data |
| Write | Set bone/layer transforms, create/delete keyframes, change interpolation, rename layers |
| See | Capture rendered scene frames or full MOHO UI screenshots |
| Interact | Send mouse clicks, drags, and keyboard shortcuts to the MOHO window |
| Know | Built-in reference data for all Moho 14 tools and keyboard shortcuts |
| Tool | Description |
|---|---|
document_getInfo |
Document metadata (name, path, dimensions, FPS, frame range) |
document_getLayers |
Full layer tree with hierarchy |
layer_getProperties |
Detailed layer properties (type, visibility, transform) |
layer_getChildren |
Direct children of a group layer |
layer_getBones |
List bones in a bone layer |
bone_getProperties |
Bone details (position, angle, scale, parent) |
animation_getKeyframes |
Keyframes for a channel on a layer |
animation_getFrameState |
Full layer state at a specific frame |
mesh_getPoints |
Point positions in a vector layer |
mesh_getShapes |
Shape data (fill, stroke, curves) |
| Tool | Description |
|---|---|
bone_setTransform |
Set bone angle/position/scale at a frame (creates keyframes) |
bone_selectBone |
Select a bone in the MOHO UI |
animation_setKeyframe |
Set keyframe value (scalar or vec2) on any channel |
animation_deleteKeyframe |
Remove a keyframe at a specific frame |
animation_setInterpolation |
Set easing mode (linear, smooth, ease_in, ease_out, step) |
document_setFrame |
Navigate to a specific frame on the timeline |
layer_setTransform |
Set layer translation/rotation/scale at a frame |
layer_setVisibility |
Show or hide a layer |
layer_setOpacity |
Set layer transparency at a frame |
layer_setName |
Rename a layer |
layer_selectLayer |
Select a layer in the UI |
| Tool | Description |
|---|---|
document_screenshot |
Capture scene render or full MOHO UI window as PNG |
input_mouseClick |
Click at window-relative coordinates (left/right/middle, single/double) |
input_mouseDrag |
Drag from point A to B with configurable steps |
input_sendKeys |
Send keyboard shortcuts (e.g. ctrl+z, space, a) |
| Tool | Description |
|---|---|
batch_execute |
Execute multiple operations in a single IPC round-trip (~300ms total vs ~300ms each) |
Performance tip: Always prefer
batch_executewhen you need 2+ operations. A batch of 10 operations takes the same time as 1 individual call.
| Resource | URI | Description |
|---|---|---|
| Shortcuts | moho://shortcuts |
All Moho 14 keyboard shortcuts organized by category |
| Tools | moho://tools |
All Moho 14 tools with shortcuts, descriptions, and modifiers |
Copy the moho-plugin/ contents into MOHO's scripts folder, or use the provided install scripts:
Windows: Run install-plugin.bat (or copy manually to C:\Program Files\Moho 14\Resources\Support\Scripts\Menu\)
macOS: Run chmod +x install-plugin.sh && ./install-plugin.sh (or copy manually to /Applications/Moho 14/Moho Pro.app/Contents/Resources/Support/Scripts/Menu/)
Files to copy:
MohoMCP_Server.luaMohoMCP_Poller.luajson.luamoho_mcp/(entire directory)
cd bridge
npm install
npm run build- Open Moho Pro 14 and load a project
- Go to Scripts > MohoMCP Server to start the IPC server
- Start your MCP client (Claude Desktop or Claude Code) β the bridge auto-connects
Add to your Claude Desktop config (claude_desktop_config.json):
{
"mcpServers": {
"moho-mcp": {
"command": "node",
"args": ["C:/path/to/MohoMCP/bridge/dist/index.js"]
}
}
}Place a .mcp.json in your project root:
{
"mcpServers": {
"moho-mcp": {
"command": "node",
"args": ["C:/path/to/MohoMCP/bridge/dist/index.js"]
}
}
}Environment variables:
| Variable | Default | Description |
|---|---|---|
MOHO_MCP_IPC_DIR |
<system-temp>/moho-mcp |
Directory for file-based IPC communication |
Internal timing (in bridge/src/config.ts):
| Setting | Default | Description |
|---|---|---|
| Poll interval | 100ms | How often the bridge checks for response files |
| Request timeout | 10s | Max wait time for a Lua response |
| Render timeout | 30s | Max wait time for screenshot operations |
| Batch timeout per op | 500ms | Additional timeout per operation in a batch |
| Max batch size | 50 | Maximum operations per batch_execute call |
Communication uses JSON files in the system temp directory (%TEMP%\moho-mcp\ on Windows, $TMPDIR/moho-mcp/ on macOS):
- Bridge writes
req_<id>.json(JSON-RPC 2.0 request) - MOHO Lua plugin polls for request files via DrawMe/IsEnabled callbacks
- Lua processes the request, writes
resp_<id>.json - Bridge reads the response, cleans up files
MOHO only processes Lua callbacks during UI repaints. A background process periodically forces viewport redraws (~4 Hz) to keep the polling loop alive even when the user isn't interacting:
- Windows: PowerShell process calling Win32
RedrawWindow() - macOS: AppleScript process nudging the Moho application
- Allow-list validation: Only explicitly registered methods can be called
- Parameter validation: All parameters type-checked before execution
- pcall wrapping: All Lua handlers wrapped in protected calls β a crash in one method won't crash the server
cd bridge
npm install
npm run dev # Watch mode β recompiles on changes
npm test # Run test suite (61 tests)
npm run test:watchMohoMCP/
βββ bridge/ # TypeScript MCP Bridge Server
β βββ src/
β βββ index.ts # Entry point & bootstrap
β βββ config.ts # IPC directory, timeouts
β βββ moho-client.ts # File-based IPC client
β βββ protocol.ts # JSON-RPC 2.0 types
β βββ tools.ts # 26 MCP tool registrations
β βββ resources.ts # Static knowledge resources
β βββ keep-alive.ts # Cross-platform viewport refresh
β βββ platform-capture.ts # Platform dispatch β window capture
β βββ platform-input.ts # Platform dispatch β input simulation
β βββ window-capture.ts # Win32 screenshot capture
β βββ darwin-capture.ts # macOS screenshot capture
β βββ win32-input.ts # Win32 mouse & keyboard
β βββ darwin-input.ts # macOS mouse & keyboard
β βββ __tests__/ # Vitest test suite
β
βββ moho-plugin/ # Lua Plugin for MOHO 14
β βββ MohoMCP_Server.lua # Menu script & DrawMe hooks
β βββ MohoMCP_Poller.lua # Polling utilities
β βββ json.lua # JSON library
β βββ moho_mcp/
β βββ server.lua # File-based IPC server
β βββ protocol.lua # JSON-RPC 2.0 protocol
β βββ validator.lua # Method allow-list & validation
β βββ tools/ # Handler implementations
β βββ document.lua
β βββ layer.lua
β βββ bone.lua
β βββ animation.lua
β βββ mesh.lua
β βββ batch.lua
β
βββ docs/ # Documentation
β βββ installation.md
β βββ tool-reference.md
β
βββ schema/
βββ tools.json # JSON Schema definitions
All 26 tools work identically on both platforms. The bridge auto-detects the OS at runtime and loads the appropriate native backend β no configuration needed.
| Feature | Windows | macOS |
|---|---|---|
| Read tools (document, layers, bones, mesh) | Win32 file IPC | POSIX file IPC |
| Write tools (transforms, keyframes) | Win32 file IPC | POSIX file IPC |
Scene screenshot (mode="scene") |
Moho FileRender | Moho FileRender |
Full UI screenshot (mode="full") |
Win32 PrintWindow API | screencapture -l |
| Mouse input (click, drag) | Win32 user32.dll P/Invoke | cliclick / CoreGraphics via JXA |
| Keyboard input | Win32 keybd_event | AppleScript System Events |
| Keep-alive (viewport refresh) | PowerShell + RedrawWindow | AppleScript process nudge |
| Plugin installer | install-plugin.bat |
install-plugin.sh |
- Windows 10/11
- Moho Pro 14
- Node.js >= 18.0.0
- macOS (tested on Ventura+)
- Moho Pro 14
- Node.js >= 18.0.0
- Accessibility permissions β required for input simulation (System Settings > Privacy & Security > Accessibility > add your terminal / Claude Desktop)
- cliclick (optional, recommended) β
brew install cliclickβ provides more reliable mouse input. Without it, falls back to CoreGraphics via JXA.
MIT β see LICENSE for details.