Cursor + Inliner CLI
Maximize your Cursor workflow with Inliner's CLI and MCP integration. Generate images from the integrated terminal or let Cursor's AI handle it automatically.
Two Ways to Generate Images
MCP Server (AI-Driven)
Let Cursor's AI generate images automatically during conversations.
- AI picks appropriate dimensions
- Seamless conversation flow
- Project-aware generation
CLI (Direct Control)
Run commands directly in Cursor's integrated terminal.
- Precise control over output
- Batch processing support
- CI/CD integration
Setup: MCP Server Integration
Give Cursor's AI direct access to image generation:
Step 1: Get Your API Key
- Log into your Inliner.ai dashboard
- Go to Account > API Keys
- Click Create API Key and copy it
Step 2: Configure MCP in Cursor
Create .cursor/mcp.json in your project root:
.cursor/mcp.json
{
"mcpServers": {
"inliner": {
"command": "npx",
"args": ["@inliner/mcp-server"],
"env": {
"INLINER_API_KEY": "${INLINER_API_KEY}",
"INLINER_DEFAULT_PROJECT": "your-project-namespace"
}
}
}
}
Pro Tip: For global setup (all projects), configure MCP in Cursor Settings > Features > MCP. In conversational flows, generation tools use smart URL slugs by default for concise CDN paths.
Setup: CLI in Cursor Terminal
Use the Inliner CLI directly from Cursor's integrated terminal:
Cursor Terminal (Ctrl+`)
# Set your API key (add to .bashrc/.zshrc for persistence)
export INLINER_API_KEY=inl_your-api-key
# Generate an image
npx @inliner/cli "hero-banner_1200x600.png" -p myproject
# Generate and save to specific path
npx @inliner/cli "product-photo_800x800.png" -p store -o ./public/images/product.png
Workflow Examples
Building a Landing Page
Terminal
# Generate all images for a landing page
npx @inliner/cli "hero-startup-team_1920x1080.png" -p landing -o ./public/hero.png
npx @inliner/cli "feature-analytics_600x400.png" -p landing -o ./public/feature1.png
npx @inliner/cli "feature-dashboard_600x400.png" -p landing -o ./public/feature2.png
npx @inliner/cli "testimonial-avatar_200x200.png" -p landing -o ./public/avatar1.png
Quick Image Edits
Terminal
# Remove background from a photo
npx @inliner/cli edit ./photo.png "remove background" -p myproject -o ./photo-clean.png
# Chain edits with pipes
npx @inliner/cli edit ./logo.png "add shadow" -p brand | \
npx @inliner/cli edit - "resize to 512x512" -p brand -o ./logo-final.png
Behavior Guidance (Prevent Wrong Modality)
In Cursor chat, "make it 600x600" can be interpreted as generating a new image unless you provide source context. Use explicit edit phrasing when you want to modify an existing image.
Cursor prompts for reliable edits
# Good: explicit edit with source
Use edit_image with sourcePath "./demo/elephant-eating-corn_800x600.png"
and editInstruction "resize to 600x600 while preserving scene".
# Good: conversational but explicit
Edit the previous image (do not generate a new one) and resize to 600x600.
# Risky: ambiguous (may generate new image)
Make it 600x600
Using with npm scripts
Add to your package.json:
package.json
{
"scripts": {
"generate:hero": "npx @inliner/cli 'hero_1920x1080.png' -p mysite -o ./public/hero.png",
"generate:og": "npx @inliner/cli 'og-image_1200x630.png' -p mysite -o ./public/og.png",
"generate:all": "npm run generate:hero && npm run generate:og"
}
}
Best Practices
- Use MCP for conversational work — Let Cursor's AI handle image generation while you focus on code
- Use CLI for batch operations — Generate multiple images quickly from terminal
- Store API key in environment — Add to
.bashrcor project.env - Commit MCP config — Share
.cursor/mcp.jsonwith your team (exclude API key) - Be explicit for edits — Include source URL/path and say "edit" to avoid accidental regeneration
Team Tip: Create a shared Inliner team account and distribute API keys to team members. Each person can have their own key while sharing the same credit pool. Learn about team accounts →