loading…
Search for a command to run...
loading…
Enables automated content generation and scheduling for Instagram and Pinterest via the Late API. It allows users to manage publications, generate AI-powered ca
Enables automated content generation and scheduling for Instagram and Pinterest via the Late API. It allows users to manage publications, generate AI-powered captions, and schedule posts or stories using natural language commands.
Automated content publishing for Pinterest and Instagram with AI-powered content generation and scheduling.
sharpscpnpm install
npm run build
.env.example to .env and fill it:cp .env.example .env
.env:prompts/content-prompt.example.txt to prompts/content-prompt.txt and editing itThe project uses only Late API for publishing to Instagram and Pinterest.
.env:LATE_API_KEY=your_key
LATE_PROFILE_ID=your_profile_id
LATE_INSTAGRAM_ACCOUNT_ID=your_instagram_account_id
LATE_PINTEREST_ACCOUNT_ID=your_pinterest_account_id
Late API Benefits:
Supported Platforms: Instagram, Pinterest, Facebook, LinkedIn, Twitter/X, TikTok, YouTube, Reddit, Bluesky, Threads, Google Business, Telegram, Snapchat
The project supports two ways of working:
Before starting, check API connection:
npm run check
This will check:
npm run publish -- --image=IMG_5857.jpg [options]
Image Input:
images/ (relative to project root); you can override with IMAGES_SOURCE_DIR in .env (e.g. an absolute path like /path/to/story-matcher). The system will convert to JPG, center-crop to platform aspect ratios, upload to CDN via SCP, and use the CDN URLs for publishing.CDN_BASE_URL directly (existing behavior).Examples:
# Local image: auto-process + upload + publish to all platforms
npm run publish -- --image=IMG_5857.HEIC
# Publish in 1 hour
npm run publish -- --image=IMG_5857.jpg 1
# Draft with publication date
npm run publish -- --image=IMG_5857.jpg --date="tomorrow 18:00" --draft
# With context
npm run publish -- --image=IMG_5857.jpg 1 --context="City center"
# Instagram post only
npm run publish -- --image=IMG_5857.jpg --post
# Instagram story only
npm run publish -- --image=IMG_5857.jpg --story
# Instagram story + Pinterest pin (comma-separated)
npm run publish -- --image=IMG_5857.jpg --types=story,pin
# Instagram post + Pinterest pin
npm run publish -- --image=IMG_5857.jpg --types=post,pin
# Pinterest pin only
npm run publish -- --image=IMG_5857.jpg --pin
# With draft
npm run publish -- --image=IMG_5857.jpg --story --draft
Options:
--image=<filename> - Image filename (required in CLI mode)--context=<text> - Context for content generation--types=<list> - Content types comma-separated: post, story, pin (e.g., --types=story,pin)--post - Instagram post only (short form for --types=post)--story - Instagram story only (short form for --types=story)--pin - Pinterest pin only (short form for --types=pin)--date=<date> - Publication date (YYYY-MM-DD HH:MM or "tomorrow 18:00")<hours> - Alternative to --date: number of hours from current moment--draft or -d - Create as draftContent Types:
--types=post,story,pin - Specify types comma-separated (e.g., --types=story,pin)--post - Publishes only Instagram post--story - Publishes only Instagram story--pin - Publishes only Pinterest pin (without Instagram)Detailed Documentation:
# Build TypeScript to JavaScript
npm run build
# Build and watch for changes (auto-recompiles on file changes)
npm run watch
When developing with MCP, use automatic recompilation:
# Terminal: Run watch for automatic recompilation
npm run watch
How it works:
watch automatically recompiles TypeScript when files changedist/mcp/mcp-server.js changesImportant: After changing code in src/mcp/ or related modules, changes will apply automatically through watch + MCP restart in Cursor.
🔧 Dev Mode (dry-run):
watch mode, DEV_MODE=true is automatically enablednpm run watch:prod or simply npm run build + commandsMCP (Model Context Protocol) - This is the primary and recommended way to work with the project. Manage publications through AI assistant using natural language directly in Cursor, Claude, or other AI tools.
Build the project:
npm run build
MCP server is automatically available in Cursor (via .cursor/mcp.json)
Use natural language:
"Publish IMG_0802.HEIC tomorrow at 18:00 with context 'Concert hall, evening'"
"Show list of available images"
"Generate content for IMG_1460.JPG"
"Schedule Story for IMG_2228.JPG today at 20:00"
MCP Benefits:
Detailed Documentation:
Alternative way of working through terminal. Detailed documentation: CLI.md
The system can process local source images automatically — convert formats, crop to platform aspect ratios, and upload to CDN.
IMG_123.HEIC (source image from IMAGES_SOURCE_DIR)
│
├─ sharp: read → center-crop 4:5 → .processed/post/IMG_123.jpg
├─ sharp: read → center-crop 9:16 → .processed/story/IMG_123.jpg
├─ sharp: read → center-crop 2:3 → .processed/pin/IMG_123.jpg
│
├─ scp: upload to CDN server
│
└─ CDN URLs used for publishing via Late API
HEIC, JPG, JPEG, PNG, GIF — all converted to JPEG (quality 90).
| Content Type | Ratio | Example Resolution |
|---|---|---|
Instagram Post (post) |
4:5 | 1080×1350 |
Instagram Story (story) |
9:16 | 1080×1920 |
Pinterest Pin (pin) |
2:3 | 1000×1500 |
Place source images in the images directory (default: images/, override with IMAGES_SOURCE_DIR in .env).
Configure SCP upload in .env (all 4 variables required together):
SCP_HOST=cdn.example.com
SCP_USER=deploy
SCP_KEY_PATH=~/.ssh/id_rsa
SCP_REMOTE_BASE_PATH=/var/www/cdn/images
Ensure CDN_BASE_URL is set — used to build public URLs from uploaded files.
Processed images are cached in .processed/. If the output file already exists, processing is skipped. Delete .processed/ to force reprocessing.
If SCP is not configured, the system works as before — pass image filenames or URLs directly, and CDN URLs are built from CDN_BASE_URL. Local image processing is only triggered when a local filename is provided and SCP is configured.
The project is organized on a modular principle for better scalability and support.
src/core/ - Core infrastructure (cache with LRU eviction, retry with exponential backoff, rate limiting, logger, error definitions, config, validation schemas)src/services/ - API services (Late API, CDN uploader)src/generators/ - Content generators (AI-powered with customizable prompts)src/processors/ - Data processors (image pipeline, sharp processor)src/utils/ - Utilities (CDN URL builder, scheduling, date and shared helpers)src/cli/ - CLI commands and entry pointssrc/mcp/ - MCP integration for AI assistantssrc/types/ - TypeScript types and interfacesprompts/ - Content generation prompts (customizable).processed/ - Processed image cache (gitignored)✅ Separation of concerns - Each module is responsible for its area ✅ Singleton pattern - Services are exported as singleton instances ✅ Direct imports - Simplified structure without intermediate index.ts ✅ Scalability - Easy to add new services ✅ Testability - Each module can be tested separately
Two modes of operation:
1. Local processing + SCP upload (recommended):
images/, configurable via IMAGES_SOURCE_DIR).env2. Direct CDN URLs (no local processing):
CDN_BASE_URL in .envpost → {CDN_BASE_URL}/post/{filename}story → {CDN_BASE_URL}/story/{filename}pin → {CDN_BASE_URL}/pin/{filename}The content generation prompt can be customized to match your brand voice and target audience:
Copy the example prompt:
cp prompts/content-prompt.example.txt prompts/content-prompt.txt
Edit prompts/content-prompt.txt with your custom instructions:
The custom prompt is automatically loaded - no code changes needed!
Note: prompts/content-prompt.txt is ignored by git, so your customizations remain private. The example file (content-prompt.example.txt) serves as a template and is version-controlled.
.env fileprompts/content-prompt.txt (already in .gitignore)SCP_KEY_PATH points to your SSH key — ensure it has proper file permissions (chmod 600)npm run checkIMG_5857.jpg ≠ img_5857.jpg)images/, or IMAGES_SOURCE_DIR if set).processed/ for cached output — delete to force reprocessing.env: SCP_HOST, SCP_USER, SCP_KEY_PATH, SCP_REMOTE_BASE_PATHSCP_KEY_PATH and has correct permissions (chmod 600)ssh -i ~/.ssh/id_rsa user@hostCDN_BASE_URL is specified correctlyMIT
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"content-automation-mcp-server": {
"command": "npx",
"args": []
}
}
}