ShortsGen Docs
MCP Server
Connect Cursor, Claude Desktop, or any MCP-compatible client to ShortsGen. Generate shorts, manage jobs, and publish to Facebook from your AI assistant.
Overview
The ShortsGen MCP (Model Context Protocol) server exposes every user-facing REST API as MCP tools. Third-party applications — Cursor, Claude Desktop, custom agents, or your own backend — can generate shorts, check job status, manage credits, and publish to Facebook on behalf of a ShortsGen user account.
The MCP server lives in the mcp-server/ directory at the repo root. It proxies HTTP requests to your running ShortsGen app — it does not embed pipeline logic directly.
Architecture
MCP Client → MCP Server (stdio or HTTP) → ShortsGen REST API (/api/*) → your account
Prerequisites
- Node.js 20+ installed on the machine running the MCP server.
- A running ShortsGen app — locally with
npm run devor deployed to production. - A ShortsGen account with credits (for generation tools).
- An API key created in the web app (see below). Keys are prefixed with
sg_. - Dependencies installed in both the repo root and
mcp-server/(npm installin each).
Quick start
- Start ShortsGen:
npm run dev - Sign in at /sign-in, open Settings → API keys, and create a key. Copy it immediately — it is shown only once.
- Set environment variables (see below).
- Run
npm run mcpfrom the repo root. - Add the server to Cursor or Claude Desktop (see configuration sections below).
- Test with the
auth_healthorget_creditstool in your MCP client.
Create an API key
API keys authenticate the MCP server (and any programmatic client) as your ShortsGen user. Each key is scoped to your account and can be revoked at any time.
- Sign in and navigate to Settings.
- Scroll to the API keys section.
- Enter a descriptive name (e.g. "Cursor MCP") and click Create key.
- Copy the full key (starts with sg_) and store it securely.
- Set it as
SHORTSGEN_API_KEYin your MCP client configuration.
The MCP server sends Authorization: Bearer sg_… on every request. The app also accepts x-api-key.
Environment variables
Set your app URL once in NEXT_PUBLIC_APP_URL. In MCP client config (Cursor, Claude), pass the same URL as SHORTSGEN_BASE_URL.
| Variable | Required | Description |
|---|---|---|
NEXT_PUBLIC_APP_URL | Yes (app) | Set in your app .env (currently https://clips.adomicarts.com) |
SHORTSGEN_BASE_URL | Yes (MCP) | Set in MCP client config to the same value as NEXT_PUBLIC_APP_URL (https://clips.adomicarts.com) |
SHORTSGEN_API_KEY | Yes* | Your sg_… key from Settings. Not needed for auth_sign_up / auth_sign_in only. |
MCP_HTTP_PORT | No | HTTP transport port (default 3100) |
MCP_HTTP_HOST | No | HTTP bind address (default 127.0.0.1) |
MCP_HTTP_AUTH_TOKEN | Recommended | Separate secret that protects the MCP HTTP endpoint (not the ShortsGen API) |
# App .env — your public app URL
NEXT_PUBLIC_APP_URL=https://clips.adomicarts.com
# MCP client config — use the same URL as SHORTSGEN_BASE_URL
SHORTSGEN_BASE_URL=https://clips.adomicarts.com
# Required for most MCP tools — create in Settings → API keys
SHORTSGEN_API_KEY=sg_your_key_here
# Optional — HTTP transport (default 3100)
MCP_HTTP_PORT=3100
MCP_HTTP_HOST=127.0.0.1
# Recommended — protects the MCP HTTP endpoint itself
MCP_HTTP_AUTH_TOKEN=your-mcp-secretRun the MCP server
stdio transport (default)
Used by Cursor, Claude Desktop, and most local MCP clients. The server communicates over stdin/stdout — no port binding required.
# From the repo root (stdio — Cursor / Claude Desktop)
npm run mcpHTTP transport
For remote third-party apps that connect over the network. Listens on port 3100 by default.
# From the repo root (HTTP — remote clients)
MCP_HTTP_AUTH_TOKEN=your-mcp-secret npm run mcp:httpFrom mcp-server/ directly
# Or from the mcp-server/ directory (loads NEXT_PUBLIC_APP_URL from parent .env)
cd mcp-server
npm install
SHORTSGEN_BASE_URL=https://clips.adomicarts.com SHORTSGEN_API_KEY=sg_your_key npm start
SHORTSGEN_BASE_URL=https://clips.adomicarts.com SHORTSGEN_API_KEY=sg_your_key npm run start:httpCursor setup
Add the MCP server to Cursor via project or global MCP settings. Use the absolute path to your ShortsGen app directory for cwd.
{
"mcpServers": {
"shotsgen": {
"command": "npm",
"args": ["run", "mcp"],
"cwd": "C:/path/to/your/shotsgen/app",
"env": {
"SHORTSGEN_BASE_URL": "https://clips.adomicarts.com",
"SHORTSGEN_API_KEY": "sg_your_key_here"
}
}
}
}- Create or edit
.cursor/mcp.jsonin your project (or use Cursor Settings → MCP). - Paste the configuration above — set SHORTSGEN_BASE_URL to your NEXT_PUBLIC_APP_URL (https://clips.adomicarts.com).
- Ensure ShortsGen is running before using MCP tools.
- Restart Cursor or reload MCP servers from settings.
- Open the MCP panel and verify
shotsgenshows as connected.
Claude Desktop setup
Claude Desktop uses the same stdio configuration. Edit your Claude Desktop MCP config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"shotsgen": {
"command": "npm",
"args": ["run", "mcp"],
"cwd": "/absolute/path/to/app",
"env": {
"SHORTSGEN_BASE_URL": "https://clips.adomicarts.com",
"SHORTSGEN_API_KEY": "sg_your_key_here"
}
}
}
}Restart Claude Desktop after saving. Set SHORTSGEN_BASE_URL to your NEXT_PUBLIC_APP_URL (https://clips.adomicarts.com).
HTTP transport
Start the HTTP server with npm run mcp:http. Clients send MCP Streamable HTTP requests to:
POST http://127.0.0.1:3100/mcp
Authorization: Bearer your-mcp-secret
Content-Type: application/jsonHealth check (no auth required unless MCP_HTTP_AUTH_TOKEN is set on all routes — health is always open):
GET http://127.0.0.1:3100/healthWhen MCP_HTTP_AUTH_TOKEN is set, include Authorization: Bearer <token> on MCP requests. This token is separate from your ShortsGen API key — it only protects the MCP server endpoint.
Authentication
ShortsGen uses Better Auth with an API key plugin. When the MCP server sends a valid API key, the app treats the request as an authenticated session for your user — no browser cookies required.
- Production use: always use an API key via
SHORTSGEN_API_KEY. - Onboarding tools (
auth_sign_up,auth_sign_in,api_key_create) can run without a key to create an account and first key. - Revoke compromised keys immediately in Settings → API keys.
Available tools
Each MCP tool maps to one ShortsGen REST endpoint. Tool responses are JSON returned as text content.
Auth & API keys
| Tool | HTTP endpoint |
|---|---|
auth_health | GET /api/auth/ok |
auth_sign_up | POST /api/auth/sign-up/email |
auth_sign_in | POST /api/auth/sign-in/email |
auth_sign_out | POST /api/auth/sign-out |
auth_get_session | GET /api/auth/get-session |
api_key_create | POST /api/auth/api-key/create |
api_key_list | GET /api/auth/api-key/list |
api_key_delete | POST /api/auth/api-key/delete |
Generation & jobs
| Tool | HTTP endpoint |
|---|---|
generate_shorts | POST /api/generate |
get_job_status | GET /api/status/{jobId} |
get_job_clips | GET /api/clips/{jobId} |
list_jobs | GET /api/jobs |
generate_shorts accepts youtubeUrl, numVariations (1–8), and optional videoSettings (clipLength, exportQuality, captionStyle).
Credits & billing
| Tool | HTTP endpoint |
|---|---|
get_credits | GET /api/credits |
get_usage | GET /api/usage |
create_checkout | POST /api/billing/checkout |
confirm_checkout | POST /api/billing/confirm |
Facebook publishing
| Tool | HTTP endpoint |
|---|---|
get_facebook_config | GET /api/facebook/config |
get_facebook_connect_url | GET /api/facebook/connect (returns OAuth URL) |
get_facebook_status | GET /api/facebook/status |
select_facebook_page | POST /api/facebook/select-page |
disconnect_facebook | DELETE /api/facebook/disconnect |
publish_to_facebook | POST /api/publish/facebook |
Facebook publishing via MCP
Facebook OAuth requires a browser. The MCP flow uses a redirect URL returned by the API:
- Call
get_facebook_connect_url— the response includesredirectUrl. - Open that URL in a browser while signed in to ShortsGen and complete Meta OAuth.
- Call
get_facebook_statusto confirm connection and list Pages. - Call
select_facebook_pagewith the desired pageId. - Generate shorts, then call
publish_to_facebookwith jobId and clipId. Uploads may take several minutes.
See also the Connections page for in-app Facebook setup.
Excluded endpoints
These endpoints are intentionally not exposed as MCP tools:
| Endpoint | Reason |
|---|---|
POST /api/webhook/polar | Polar payment webhook — server-to-server only |
GET /api/webhook/polar | Internal health probe |
GET /api/facebook/callback | Browser OAuth callback — not callable by agents |
Troubleshooting
401 Unauthorized on API tools
Verify SHORTSGEN_API_KEY is set correctly, starts with sg_, and has not been revoked. Confirm SHORTSGEN_BASE_URL matches your NEXT_PUBLIC_APP_URL (https://clips.adomicarts.com).
MCP server fails to start
Run npm install in both the repo root and mcp-server/. Ensure Node.js 20+ is installed. Set NEXT_PUBLIC_APP_URL in your app .env and SHORTSGEN_BASE_URL in MCP config (https://clips.adomicarts.com).
Cursor shows disconnected
Use an absolute path for cwd. Ensure npm run dev is running. Restart Cursor after editing mcp.json. Check Cursor MCP logs for stderr output.
402 Insufficient credits
Purchase credits via the app or use create_checkout / confirm_checkout MCP tools.
HTTP transport connection refused
Confirm npm run mcp:http is running and MCP_HTTP_PORT is not blocked by a firewall. Test with GET /health first.