Sora
STDIOMCP server integrating OpenAI's Sora 2 API for video generation and remixing capabilities
MCP server integrating OpenAI's Sora 2 API for video generation and remixing capabilities
A Model Context Protocol (MCP) server that integrates with OpenAI's Sora 2 API for video generation and remixing.
git clone https://github.com/Doriandarko/sora-mcp cd sora-mcp
npm install
npm run build
claude_desktop_config.example.json to ~/Library/Application Support/Claude/claude_desktop_config.jsonargs path to match your installation directoryOPENAI_API_KEY fieldDOWNLOAD_DIR to your preferred download folderThis project includes two server implementations for different use cases:
stdio-server.ts - For Claude Desktopserver.ts - For Remote AccessWhy two servers? Different MCP clients use different transports. This separation keeps the code clean and optimized for each transport type.
Claude Desktop will automatically start the server when configured. Just make sure:
.env file has your OPENAI_API_KEYThe config uses src/stdio-server.ts which communicates via stdio.
Run the server in development mode with auto-reload:
npm run dev
Or in production mode:
npm run build npm start
The server is already configured!
Setup:
The configuration is at: ~/Library/Application Support/Claude/claude_desktop_config.json
It uses the compiled server and passes your API key via environment variables:
{ "mcpServers": { "sora-server": { "command": "node", "args": ["/ABSOLUTE/PATH/TO/sora-mcp/dist/stdio-server.js"], "env": { "OPENAI_API_KEY": "your-openai-api-key-here", "DOWNLOAD_DIR": "/Users/yourname/Downloads/sora" } } } }
See claude_desktop_config.example.json for a complete example.
Environment Variables:
OPENAI_API_KEY (required) - Your OpenAI API keyDOWNLOAD_DIR (optional) - Custom download folder (defaults to ~/Downloads)To use:
Test your server with the MCP Inspector:
npx @modelcontextprotocol/inspector
Then connect to: http://localhost:3000/mcp
claude mcp add --transport http sora-server http://localhost:3000/mcp
code --add-mcp '{"name":"sora-server","type":"http","url":"http://localhost:3000/mcp"}'
Add to your Cursor MCP settings with stdio transport (similar to Claude Desktop configuration above).
Generate a video from a text prompt.
Parameters:
prompt (required): Text description of the video to generatemodel (optional): Model to use (default: "sora-2")seconds (optional): Video duration in seconds (default: "4")size (optional): Resolution as "widthxheight" (default: "720x1280")input_reference (optional): Path to reference image/videoExample:
{ "prompt": "A calico cat playing a piano on stage", "model": "sora-2", "seconds": "8", "size": "1024x1808" }
Check the status and progress of a video generation job.
Parameters:
video_id (required): ID of the video to checkExample:
{ "video_id": "video_123" }
Returns: Video status including progress (0-100), status (queued/processing/completed), and completion timestamps.
List all your video generation jobs with pagination.
Parameters:
limit (optional): Number of videos to retrieve (default: 20)after (optional): Pagination cursor - get videos after this IDorder (optional): Sort order "asc" or "desc" (default: "desc")Example:
{ "limit": 10, "order": "desc" }
Get a curl command to manually download a completed video.
Parameters:
video_id (required): ID of the video to downloadvariant (optional): Which format to download (defaults to MP4)Example:
{ "video_id": "video_123" }
Returns: Ready-to-use curl command with authentication for downloading the video.
Automatically download and save a completed video to your computer.
Parameters:
video_id (required): ID of the video to saveoutput_path (optional): Directory to save to (defaults to ~/Downloads)filename (optional): Custom filename (defaults to video_id.mp4)Example:
{ "video_id": "video_123", "filename": "my-cat-video.mp4" }
Returns: File path where video was saved. No manual commands needed!
Create a remix of an existing video with a new prompt.
Parameters:
video_id (required): ID of the completed video to remixprompt (required): New text prompt for the remixExample:
{ "video_id": "video_123", "prompt": "Extend the scene with the cat taking a bow to the cheering audience" }
Delete a video job and its assets.
Parameters:
video_id (required): ID of the video to deleteExample:
{ "video_id": "video_123" }
Create a video → Get back a video_id
"Create a video of a sunset over mountains"
Check status → Monitor progress
"Check the status of video video_123"
Save when ready → Auto-download the video file
"Save video video_123"
Claude will automatically download it to your Downloads folder!
Clean up → Delete old videos
"Delete video video_123"
{ "id": "video_123", "object": "video", "model": "sora-2", "status": "queued", "progress": 0, "created_at": 1712697600, "size": "1024x1808", "seconds": "8", "quality": "standard" }
{ "id": "video_456", "object": "video", "model": "sora-2", "status": "queued", "progress": 0, "created_at": 1712698600, "size": "720x1280", "seconds": "8", "remixed_from_video_id": "video_123" }
The server includes comprehensive error handling:
sora-mcp/
├── src/
│   └── server.ts       # Main server implementation
├── dist/               # Compiled JavaScript (generated)
├── package.json        # Dependencies and scripts
├── tsconfig.json       # TypeScript configuration
├── .env               # Environment variables (not in git)
└── README.md          # This file
npm run dev - Run in development mode with tsxnpm run build - Compile TypeScript to JavaScriptnpm start - Run compiled JavaScriptOPENAI_API_KEY (required) - Your OpenAI API keyPORT (optional) - Server port (default: 3000)MIT