mcp-server
v0.9.0Official MCP server for CodingMantra AI tools and social media publishing and scheduling
The official Model Context Protocol (MCP) server connecting AI assistants (Claude Desktop, Cursor, Cline, and Antigravity) to CodingMantra's generative AI media engines. The server exposes 47 specialized generative, utility and social tools over standard I/O (stdio): 1. Synchronous Image Generation (Immediate Inline Image Output) - generate_product_photo — Generates studio-grade commercial product photos with custom background scenes, ambient occlusion contact shadows, camera optics, resolutions (1K, 2K, 4K), aspect ratios, and dynamic logo/text overlays.
Summary extracted from the README.
@codingmantra/mcp-server
The official Model Context Protocol (MCP) server connecting AI assistants (Claude Desktop, Cursor, Cline, and Antigravity) to CodingMantra's generative AI media engines.
What's New in v0.5.0
- Instagram supports single-image posts and ordered carousels of 2–10 images; Facebook supports up to 10 images in a multi-photo post.
- New
list_social_libraryretrieves reusable complete posts with ordered slides, captions and usage filters.list_social_mediaretains generated-gallery access. - Optional
mediaLayoutprovides common square or portrait canvases using fit or crop, including reusable uploaded media IDs. - Existing single-image publishing and scheduling inputs remain supported.
- Polling exposes processing details and delivery review flags. Never create a replacement post automatically when final delivery is uncertain.
Previous v0.4.0 changes
-
Social publishing and scheduling use the versioned developer API, supporting stable platform-prefixed account IDs, multiple targets, and caller-supplied idempotency keys.
-
New
upload_social_imageandget_social_imagetools support URL, base64, data URI, local files, and reusable media IDs. -
Per-account polling includes provider post IDs; cancellation retains delivery history. HTTP error codes and Retry-After are exposed in structured MCP errors.
-
Migration: publication and scheduling inputs changed from the v0.3 platform/accountId or platforms/content shape to the contract below. Existing drafts, caption generation, analytics, and editing tools remain available.
-
Social media workflows: 19 tools for connected accounts, caption creation, drafts, gallery images, immediate publishing, scheduling, status, cancellation, and analytics. Uses the same CodingMantra API key.
-
Current API coverage: Story Teller, HeyGen Talking Avatar IV, and Jewellery Rate Poster tools.
-
Video contract alignment: Required prompt/model/duration/resolution/aspect ratio, character descriptions, seed, guidance, and local reference-image resolution.
-
Terminal job handling: Polling stops for completed, failed, or cancelled jobs.
-
🖼️ Native MCP Image Output: Generated images (including QR codes, logos, try-on shots, and product photos) return standard MCP
ImageContentso they render directly in your AI assistant's chat window. -
📁 Local File Path Resolution: Pass local paths (e.g.
./shoe.pngor/Users/.../portrait.jpg) directly in tool arguments—the server automatically reads and encodes them as base64 data URIs. -
⚡ Expanded Tool Suite (47 Tools): Expanded image generation support including Passport Photos, Baby Milestones, YouTube Thumbnails, Blog Images, Nano Banana, Professional Photography, Sketch-to-Real, Human Builder, Apparel/Product/Jewelry Try-On, Festival Posts, Upscaling, and Discovery.
-
🎯 Advanced Model & Resolution Parameters: Direct support for
model,modelId,promptId, custom reference images, and server-side credit synchronization. -
🛡️ Graceful Error Handling & 120s Timeout: Informative error diagnostics when API keys are missing or requests time out, with clean stdio protocol execution.
Features & Tool Suite
The server exposes 47 specialized generative, utility and social tools over standard I/O (stdio):
1. Synchronous Image Generation (Immediate Inline Image Output)
-
generate_product_photo— Generates studio-grade commercial product photos with custom background scenes, ambient occlusion contact shadows, camera optics, resolutions (1K, 2K, 4K), aspect ratios, and dynamic logo/text overlays. -
generate_logo— Generates bespoke vector-style or 3D brand logos with customizable typography, colors, industries, and reference images. -
try_on_jewelry— Virtual luxury jewelry try-on with model styling, metal & gemstone preservation, Fresnel light dispersion, and anatomical contact shadows. -
try_on_apparel— Virtual fashion apparel try-on with natural gravitational folds, realistic fabric tension, and ground contact shadows. -
try_on_product— Universal commercial product staging and virtual try-on across footwear, accessories, cosmetics, eyewear, and furniture with 3-point studio lighting. -
generate_festival_post— High-conversion festival marketing graphics, holiday greetings (Diwali, Eid, Christmas, New Year), and promotional banners with product and logo integration. -
build_human— Creates photorealistic AI human models tailored for brand photography, fashion, and marketing with complete demographic, facial, hair, and body customization, plus multi-view character sheets (2×2 grid). -
generate_youtube_thumbnail— High-CTR YouTube thumbnails with rule-of-thirds composition, emotional human expressions, vibrant contrast separation, and legible bold text overlays. -
generate_passport_photo— Converts any portrait into an official, compliant passport or visa identity photo with pixel-level facial identity preservation. -
sketch_to_real— Transforms hand-drawn sketches, line drawings, or product drafts into photorealistic commercial images while preserving ground-truth silhouettes. -
edit_professional_photo— Transforms and grades portraits and personal photos into magazine-grade studio or editorial photography with natural dermal micro-pores and optical depth of field. -
edit_nano_banana— Creative multi-reference image editor and compositor combining multiple subjects, backgrounds, and artistic styles (figurines, chibi, anime, retro, 3D renders). -
generate_blog_image— Generates high-impact, editorial blog hero images, article thumbnails, and banners with clean composition, visual hierarchy, intentional negative space, and exact text overlays. -
generate_baby_milestone— Creates magical baby milestone keepsake portraits with pristine subject preservation, seamless background cutout, and organic milestone text integration. -
upscale_image— Restores a reference image with Pro AI at 4K (60 credits), checks output size and proportions, and returns the image synchronously. Fine details can change; review the result. -
generate_jewellery_rate_poster— Branded gold and silver rate posters using caller-supplied rates, business details, and optional product/logo images.
2. QR Code Tools
generate_qr_code— Full-featured custom QR code generator supporting URLs, plain text, Wi-Fi credentials, vCards, emails, and UPI payment strings with custom styling, colors, and error correction.generate_qr_code_simple— Lightweight single-parameter QR code generation from text or URL.
3. Account & Discovery Utilities
get_user_credits— Checks your current CodingMantra AI wallet credit balance in real time.list_image_models— Queries all available CodingMantra AI image generation models (Gemini Flash, Pro, Grok Imagine 2.0, GPT Image 2.5 Flare), supported resolutions, aspect ratios, and credit costs.
4. Asynchronous Video Tools (with Job Polling)
generate_product_video— Commercial product videography (Google Veo 3.1 & OpenRouter Wan 3.0).generate_apparel_video— Model runway and apparel try-on video showcase.generate_festival_video— Festive event greetings and celebratory motion graphics.generate_jewelry_video— High-end luxury jewelry videography with realistic optical brilliance dispersion.generate_logo_video— 3D logo reveal and motion graphic intros.generate_story_video— Cinematic stories with character descriptions, sound effects, and visual atmosphere.generate_talking_avatar— HeyGen Avatar IV portrait animation with a script, HeyGen voice ID, and performance controls.check_video_job_status— Real-time polling tool to track background video rendering status (pending→processing→completed/failed/cancelled).
All generations automatically deduct credits from your CodingMantra wallet and persist outputs directly to your online media gallery at https://codingmantra.com/my-gallery.
5. Social Content & Scheduling
get_social_workflow— Capabilities, workflow, content guidance, and platform limits.list_social_accounts— Connected Facebook Pages and Instagram accounts; no provider tokens.generate_social_caption— Generate or refine a caption and hashtags using images, brandBrief, and saved brand context. Uses credits.list_social_drafts— Paginated saved drafts (20 per page).save_social_draft— Create or fully replace a draft; uploads local images. Does not schedule or publish.delete_social_draft— Remove a saved draft.list_social_media— Paginate your generated image gallery.upload_social_image— Upload and normalize an image; returns reusable owner-scoped media ID and URL.get_social_image— Read uploaded media metadata.schedule_social_draft— Atomically queue an approved saved draft; reuse draftId safely.schedule_social_post— Queue final content for automatic future delivery to selected accounts.list_social_posts— Filter the posting calendar by status, platform, and date range.get_social_post— Inspect overall/per-account status, errors, retries, job IDs, and provider post IDs.update_social_post— Edit or reschedule a queued post; retry a failed post with a new future time.cancel_social_post— Cancel remaining deliveries; retain history and successful account results.delete_social_post— Delete an eligible schedule record; does not delete a live platform post.publish_social_post— Queue immediate delivery to one or multiple connected accounts; poll to confirm publication.get_social_analytics— Recorded reach, engagement, totals, top posts, and posting activity.
Working with Claude, Codex, Antigravity, and other assistants
Connect accounts once in the Social Media Hub. The same CODINGMANTRA_API_KEY used for media generation identifies the owner of all drafts and schedules; browser cookies and Meta access tokens are not needed in your assistant. Account connection/reconnection remains in the browser. Any assistant supporting standard MCP stdio can discover the tools and their schemas. Responses include text plus structured JSON, UTC ISO timestamps, IDs, and pagination fields.
Try: “Create three Facebook posts for my bakery’s launch. Use a warm voice and these verified opening hours. Save drafts for review, then schedule the approved posts at 9 AM Asia/Kolkata next week.” Or: “Show failed posts, explain their errors, and move this queued post to tomorrow at 6 PM Asia/Kolkata.”
Start with get_social_workflow and list_social_accounts. Use exact returned account IDs. Supply brandBrief to isolate a particular brand; otherwise caption generation uses saved brand context. Provide audience, verified facts, tone, offer, and CTA. Combine caption generation with existing image tools, or write captions directly in your assistant without AI credit charges.
Instagram supports 1–10 images (one image or a carousel), with at most 2,200 characters including hashtags. Facebook supports text and up to 10 images, with 63,206 characters including hashtags. Video/reel publishing and other networks are not implemented. Generated images may use local file paths; the server resolves them and the backend persists them when drafts or schedules are saved.
Publishing and scheduling accept accountIds as one string or up to 20 distinct IDs from list_social_accounts, such as facebook:123456 and instagram:17890000000000000. Account names are labels; use platformAccountId without its prefix only in existing draft/edit/analytics inputs. Those tools retain their legacy schemas.
Each intended post requires a caller-chosen idempotencyKey (8–128 letters, digits, dot, underscore, colon, or hyphen). Preserve the exact key and body on a retry. A new key intentionally creates a new post. Conflicting reuse returns 409; removing the original history returns 410. Both publication and scheduling are asynchronous: queue acceptance does not prove a live post. Poll get_social_post for each account's status, job ID and providerPostId. Provider acceptance followed by response loss can still be ambiguous; inspect provider history before rescheduling.
Call schedule_social_post with a future ISO timestamp containing an explicit UTC offset. Resolve an ambiguous timezone first. publish_social_post uses the same shape without scheduledFor. Drafts remain separate; copy approved caption/images into the request. Standalone scheduling does not consume a saved draft or accept draftId/socialContentId. Use schedule_social_draft for the existing atomic draft-consumption workflow: provide draftId, complete platforms/content and scheduledFor using the draft’s raw platform account IDs. Reusing draftId returns the original schedule. This tool retains the v0.3 scheduling shape for approved saved drafts.
{
"accountIds": ["facebook:123456", "instagram:17890000000000000"],
"caption": "Meet our new collection.",
"hashtags": ["NewCollection"],
"images": [{"url": "https://example.com/product.jpg"}],
"idempotencyKey": "brand-launch-2027-001",
"scheduledFor": "2027-01-15T10:00:00+05:30"
}
Each images item accepts a URL/base64/data-URI/local-path string or {url}, {base64, mimeType?}, {path}, or {mediaId}. upload_social_image takes { "image": <input> }, excluding an existing media ID; it returns a data envelope with media ID, URL, JPEG MIME type, dimensions, bytes, and creation time. For example, upload { "image": { "path": "/path/to/product.png" } }, then use { "mediaId": "returned-uuid" } in a post. get_social_image accepts { "id": "returned-uuid" }. Uploads do not publish or run AI generation.
Source images must be static JPEG/PNG/WebP and no more than 10 MB/40 million pixels. JSON bodies are bounded to 20 MB. HTTPS URLs must be public port 443, return directly, and contain no credentials. Redirects/private destinations are rejected. The backend normalizes images to JPEG; Instagram requires a 4:5–1.91:1 aspect ratio. Dedicated API assets remain independent of gallery deletion. Use media IDs for large or repeated images.
Versioned social responses retain the REST {data: ...} envelope in MCP text and structuredContent. List posts accepts limit 1–100 (default 20), offset 0–10,000, status/platform and ISO date filters. cancel_social_post cancels remaining deliveries and retains history; it does not remove remote posts. Updating or deleting history uses the existing owner-scoped hub API and remains blocked for active/published posts. Editing a keyed post does not free its original key; create an intentional new post with a new key.
Limits are shared across keys per user: 300 reads and 60 writes per minute. API failures provide structured error.code, error.status, and optional error.retryAfter alongside text. Wait for Retry-After on 429 or request-in-progress conflicts; no automatic retry is performed by the MCP server.
Deployment order: deploy the updated web API and Firestore rules, verify the cron worker, then release/use MCP v0.5.0. The package version here is prepared locally; updating source does not publish npm. See social API documentation, OpenAPI contract, and repository docs/social-mcp-api.md.
Video parameters
General video tools require prompt (10–5000 characters), model, timeDuration, resolution, and aspectRatio. Use model-supported settings; Veo requires 8 seconds for 1080p, references, or an end frame. Choose one image mode: main image, frames, or references. Reference images accept URLs, data URIs, or local paths (up to 3 for Veo). Optional settings include characters, seed, guidanceScale, soundEffects, and styleAmbiance.
Talking Avatar requires image (local PNG/JPEG/WebP path or data URI, not a public URL), script, and a HeyGen voiceId. Optional controls include targetDuration (5–120 seconds, default 15), speed (0.5–1.5), performancePreset, expressiveness, motionPrompt, backgroundMode/backgroundColor, captions, title, resolution (720p or 1080p, default 1080p), and aspectRatio (9:16, 1:1, or 16:9, default 9:16). Scripts must fit the duration budget; credits are calculated by the backend. Poll every 15–30 seconds until completed, failed, or cancelled.
Quick Setup
1. Obtain Your API Key
Generate an API key from your CodingMantra Dashboard → My API Keys.
2. Configure Your AI Client
A. Claude Desktop
Add to your claude_desktop_config.json:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"codingmantra": {
"command": "npx",
"args": ["-y", "@codingmantra/mcp-server@latest"],
"env": {
"CODINGMANTRA_API_KEY": "YOUR_CODINGMANTRA_API_KEY"
}
}
}
}
B. Cursor
Add to .cursor/mcp.json in your project or global settings:
{
"mcpServers": {
"codingmantra": {
"command": "npx",
"args": ["-y", "@codingmantra/mcp-server@latest"],
"env": {
"CODINGMANTRA_API_KEY": "YOUR_CODINGMANTRA_API_KEY"
}
}
}
}
C. Cline (VS Code Extension)
In Cline Settings → MCP Servers, add:
{
"codingmantra": {
"command": "npx",
"args": ["-y", "@codingmantra/mcp-server@latest"],
"env": {
"CODINGMANTRA_API_KEY": "YOUR_CODINGMANTRA_API_KEY"
}
}
}
D. Antigravity / Agentic Workspace
Add to .agents/mcp_config.json:
{
"mcpServers": {
"codingmantra": {
"command": "npx",
"args": ["-y", "@codingmantra/mcp-server@latest"],
"env": {
"CODINGMANTRA_API_KEY": "YOUR_CODINGMANTRA_API_KEY"
}
}
}
}
Example Natural Language Prompts
Once configured, restart your AI assistant and try prompts like:
- "How many credits do I have left in my CodingMantra account?"
- "Generate a luxury product photo of this perfume bottle on a dark reflective obsidian pedestal with subtle mist."
- "Virtually try on this diamond necklace on an elegant editorial model wearing a black velvet evening gown."
- "Create a YouTube thumbnail for my video 'Top 10 AI Tools of 2026' with bold text and high contrast."
- "Create a modern minimalist geometric logo for a fintech company called 'Acuity'."
- "Generate a UPI payment QR code for merchant@upi with an amount of 500."
- "Create a 4-second jewelry video showing this diamond ring rotating on a black velvet pedestal with cinematic sunbeam flares, and check its progress until it's finished."
Environment Variables
| Variable | Required | Description | Default |
|---|---|---|---|
CODINGMANTRA_API_KEY |
✅ | Your CodingMantra developer API key (cm_...) |
None |
CODINGMANTRA_API_URL |
❌ | Custom API base URL | https://codingmantra.com/api |
Local Development
# Build TypeScript
npm run build
# Verify stdio contracts with a mock API (no credits spent)
npm test
# Start server directly on stdio
CODINGMANTRA_API_KEY=your_key node build/index.js
License
Private & Proprietary — Part of the CodingMantra Web Portal © 2026. All rights reserved.
MCP transport note: the server accepts messages up to 24 MB so base64 images within the 20 MB API JSON limit fit with the MCP envelope. Individual clients may impose smaller message limits; use local paths, direct HTTPS URLs, and reusable media IDs in that case. Larger messages exceed the transport bound and can close the connection.
Ordered carousels and the Content Library
Instagram accepts one image or 2–10 ordered carousel slides. Facebook accepts up to 10 images as a multi-photo feed post; its presentation is controlled by Facebook and may differ from an Instagram slider. Existing single-image requests and mediaUrl content remain supported. The first image is the cover. A carousel counts as one published Instagram post; publishing quota is per Instagram account in a rolling 24-hour window, read from Meta's content_publishing_limit response rather than assumed globally.
POST /api/v1/social/posts and MCP publish_social_post / schedule_social_post accept ordered images and optional mediaLayout: original, square-fit, square-crop, portrait-fit, or portrait-crop. Fit preserves the complete image with white padding; crop fills a common canvas. Uploaded media IDs also support canvas conversion. Use the same idempotency key and unchanged body on retry. Post responses include postType, imageCount, coverImage, processingMessage, deliveryNeedsReview, and per-account publication permalink. A queued response confirms acceptance; poll get_social_post until delivery completes. When deliveryNeedsReview is true, inspect the account before intentionally creating another post; do not automatically retry with a new key.
GET /api/v1/social/library (API-key authentication) and MCP list_social_library return { data: { items, total, hasMore } }. Each item includes mediaUrl (cover), ordered mediaUrls, type (image, carousel, or video), caption, hashtags, usage, and statuses. Filters: groupBy=post|media (default post), status=unused|scheduled|published, type, platform, raw accountId (requires platform), search, offset, and limit (1–100, default 24). list_social_media continues to read the generated-image gallery. This library is read-only; reuse creates a new post.
The Hub Content Library defaults to Posts, displays slide counts, opens every slide in a navigable preview, and reuses all images in order. Individual media retains the existing deduplicated asset view. The session-authenticated /api/social/library defaults to groupBy=media for compatibility; the Hub explicitly requests post. Saved content POST/PATCH supports mediaUrls (1–10), maintains scalar mediaUrl as the cover, and stores multi-image records as carousel.