AI Image, Audio, and Video Generation in Claude Code — Introducing lweight MCP Server
AI Image, Audio, and Video Generation in Claude Code — Introducing lweight MCP Server (2026)
Integrating AI content generation into a coding workflow usually means switching between terminals and browser tabs — running code, then jumping to a platform to generate images, then back to the terminal to continue. I built an MCP server to eliminate that context switch entirely: generate XBRUSH images, audio, and video directly from Claude Code, and publish to inblog without ever opening a browser.
At a Glance: lweight MCP is an open-source MCP server package that exposes XBRUSH AI image, audio, and video generation — and inblog blog publishing — as tools callable directly from Claude Code. Setup requires Node.js 18+, a XBRUSH API key, and three lines of MCP configuration.
According to Anthropic's official MCP documentation, the Model Context Protocol was designed as a universal open standard for connecting AI models to external tools and data sources — described as "a USB-C port for AI." Since its release in November 2024, the MCP ecosystem has grown to thousands of community-built servers across diverse integrations.
What Is MCP?
At a Glance: MCP (Model Context Protocol) is an open standard released by Anthropic that lets AI assistants directly access external tools, APIs, and data. Any MCP-compliant server can expose capabilities to any MCP-compliant client — Claude Code, Claude Desktop, Cursor, and others. One server, every compatible client.
Before MCP, connecting an AI assistant to an external API required custom integrations for each service — one implementation per tool, per platform. MCP standardizes the interface. Build a server once, and it works with any MCP-compatible client without modification.
According to the MCP specification published on modelcontextprotocol.io, MCP servers can expose three types of capabilities: tools (callable functions), resources (data the AI can read), and prompts (reusable prompt templates). This standardization enables an open ecosystem where any developer can contribute integrations that work across the entire MCP client landscape.
lweight MCP — Two Core Servers
At a Glance: The lweight MCP package contains two servers. xbrush-api-mcp handles AI content generation across image, audio, and video formats. inblog-mcp handles blog post creation, management, and publishing. Combined, they cover the full workflow from prompt to published post — all inside Claude Code.
| Server | Function | Primary Users | License |
|---|---|---|---|
| xbrush-api-mcp | AI image, audio, and video generation and editing | Developers, content automation | MIT |
| inblog-mcp | Blog post creation, publishing, and management via inblog API | Marketers, bloggers | MIT |
xbrush-api-mcp: Full Tool Reference
At a Glance: xbrush-api-mcp exposes nine tools covering text-to-image generation, inpainting editing, upscaling, background removal, text-to-speech, image-to-video, and AI model lip-sync video creation. Image generation is synchronous; editing operations return a task ID and resolve asynchronously.
Image Generation and Editing (4 tools)
- Text-to-image generation: Synchronous. Returns the image URL directly. Supports selection from XBRUSH's 9+ integrated AI engines.
- Text-instruction editing (inpainting): Asynchronous. Accepts an image URL and editing instruction; returns a task ID. Use the status check tool to retrieve the result.
- Image upscaling: Asynchronous. Enhances resolution of an existing image.
- Background removal: Asynchronous. Automatically separates foreground from background.
Audio Generation
- Text-to-speech synthesis: Converts text to natural-sounding speech. Supports voice style customization.
Video Generation
- Image-to-video conversion: Applies natural motion to a still image.
- AI model lip-sync video (XBRUSH Ad Studio): Synthesizes voice onto an AI avatar model to produce lip-sync advertising video.
Utility Tools (5 tools)
- List available AI engine models
- Check async task status
- Retrieve request history
- Upload files
- Check API health status
Comparing AI Image Generation MCP Servers
At a Glance: The MCP ecosystem now includes several image generation servers. xbrush-api-mcp's key differentiators are multi-engine support (9+ AI engines vs. single-engine alternatives), multimodal output (image, audio, and video from one server), and native integration with inblog-mcp for end-to-end content publishing workflows.
| Factor | xbrush-api-mcp | Single-engine image MCP | Stability AI-type MCP |
|---|---|---|---|
| AI engine count | 9+ (unified access) | 1 | 1 (Stable Diffusion variants) |
| Output types supported | Image, audio, video | Image only | Image primarily |
| Inpainting (editing) | Yes | Absent or limited | Yes |
| Blog publishing integration | inblog-mcp pairing | None | None |
| Async task handling | Yes (task ID + status check) | No (synchronous only) | Varies |
| Cost per image | $0.01 | Varies by server | ~$0.02–$0.04 |
| License | MIT (open source) | Varies | Varies |
Setup
At a Glance: Setup takes three steps: get an API key from xbrush.run, add the server configuration to Claude Code's MCP settings file, and restart Claude Code. No additional dependencies beyond Node.js 18+ are required.
Setup completes in three steps.
Step 1: Get your API key
Sign up at xbrush.run and generate an API key. This uses the same account as the XBRUSH platform.
Step 2: Add to Claude Code MCP configuration
Add the following to Claude Code's MCP settings file (~/.claude/settings.json or a project-local settings file):
{
"mcpServers": {
"xbrush-api-mcp": {
"command": "npx",
"args": ["-y", "@lweight/xbrush-api-mcp"],
"env": {
"XBRUSH_API_KEY": "your-api-key-here"
}
},
"inblog-mcp": {
"command": "npx",
"args": ["-y", "@lweight/inblog-mcp"],
"env": {
"INBLOG_API_KEY": "your-inblog-api-key-here"
}
}
}
}
Step 3: Restart Claude Code
After saving the configuration, restart Claude Code. The MCP servers connect automatically on startup. Use /mcp to verify the connected servers and list available tools.
Requirements: Node.js 18+, Claude Code, XBRUSH API key. Full documentation is available at XBRUSH documentation.
Practical Workflow: Blog Post Automation
At a Glance: Combining xbrush-api-mcp and inblog-mcp enables a complete content pipeline — draft in Claude Code, generate the featured image, upload and publish to inblog — without leaving the terminal. Adding Playwright MCP extends this to include content sourcing from external URLs as a pipeline input.
Several posts on this blog were produced using this exact combination. The workflow:
- Draft and outline the post in Claude Code
- Call
xbrush_generate_imageto generate the featured image with a descriptive prompt - Call
inblog_create_postto upload the draft and image together - Call
inblog_publish_postto make the post live
No browser is opened at any point in this workflow. Iterating on prompts and regenerating images happens entirely in the terminal — the same environment where the rest of the work happens.
Adding Playwright MCP to the stack enables an input layer: scrape a URL for reference content, feed that into XBRUSH image generation, and push the result to inblog. This repository's own content pipeline uses that pattern for certain post types.
For a deeper look at structuring AI image generation as a reusable workflow rather than a one-off prompt, see the post on AI workflow vs single prompt.
The MCP Ecosystem in 2026
At a Glance: Since Anthropic released MCP in November 2024, the ecosystem has expanded rapidly. By early 2026, more than 3,000 community MCP servers are publicly available, and major platforms including Google, Microsoft, Notion, and GitHub have published official MCP servers. MCP is becoming the standard integration layer for AI developer workflows.
According to Anthropic's State of MCP report (early 2026), more than 3,000 MCP servers have been published to the community since the protocol's launch, spanning developer tools, productivity platforms, creative generation, and data analysis. The protocol is converging toward a standard interface for AI-native developer workflows.
Current MCP ecosystem categories:
- Developer tools: GitHub MCP, GitLab MCP, Sentry MCP (repositories, error tracking)
- Productivity: Notion MCP, Google Drive MCP, Slack MCP (documents, communication)
- Data and analytics: PostgreSQL MCP, BigQuery MCP (direct database querying)
- Creative generation: xbrush-api-mcp (image, audio, video)
- Publishing: inblog-mcp (blog post automation)
xbrush-api-mcp is one of the few servers in the creative generation category that covers multimodal output — image, audio, and video — from a single server. Most image generation MCP servers support a single engine and image output only.
Using MCP in Claude Code — Basic Commands
At a Glance: After setting up the MCP configuration and restarting Claude Code, a few basic commands cover most workflows. Use /mcp to check connection status, then make tool calls in natural language or by explicitly naming the tool. Claude Code selects the appropriate tool from context automatically.
After completing the MCP setup and restarting Claude Code, here is how the tools work in practice.
Verify connection
/mcp
Lists connected MCP servers and the available tool names from each server.
Image generation (natural language)
Using xbrush-api-mcp, generate an image: spring-themed cosmetics product photo,
white background, floral props, soft natural light.
Inpainting edit
Replace the background in this image URL with "marble table surface, natural light":
https://raw.githubusercontent.com/.../product-01.jpg
Blog publishing
Using inblog-mcp, save the following as a draft blog post.
Title: [title]
Body: [HTML content]
Featured image: [image URL]
Claude Code parses natural language instructions and selects the appropriate MCP tool from context. Explicitly naming the tool is not required — though it helps when multiple servers have overlapping capabilities.
Building a Full Content Pipeline: Step-by-Step
At a Glance: A complete content pipeline using xbrush-api-mcp and inblog-mcp runs in four steps from a single Claude Code session: draft the post, generate the featured image, create the blog post with the image attached, and publish. Each step calls one MCP tool — no browser, no manual uploads, no context switching.
Here is the step-by-step workflow that this blog uses to publish posts:
Step 1: Draft the post in Claude Code
Write the post outline and HTML content directly in Claude Code. This step uses Claude's standard capabilities, independent of any MCP server.
Step 2: Generate the featured image
Using xbrush-api-mcp's generate_image tool, create an image with this prompt:
"Claude Code terminal interface, AI workflow diagram in background,
dark editor theme, clean technical aesthetic"
Image generation is synchronous — the image URL is returned immediately and can be used in the next step without waiting.
Step 3: Create the blog post draft
Using inblog-mcp's create_post tool, save this as a draft.
blogId: 11170
title: "AI Image Generation in Claude Code — Introducing lweight MCP Server (2026)"
content_html: [HTML body from Step 1]
image: [URL from Step 2]
Step 4: Publish
Using inblog-mcp's publish_post tool, publish the post.
postId: [ID returned by create_post]
Steps 2 through 4 each require two to three lines of instruction. The entire process from draft to live post completes in a single Claude Code session without opening a browser at any point. Several posts on this blog were produced using exactly this workflow.
For context on why structuring generation as a pipeline — rather than running individual prompts — improves output consistency and reuse, see the post on AI workflow vs single prompt.
Handling Async Operations in Automated Pipelines
At a Glance: Inpainting, upscaling, and background removal return a task ID rather than an immediate result. In Claude Code, instructing the model to "wait for completion" triggers automatic polling — no manual polling logic needed. For batch operations, multiple async tasks can be submitted simultaneously and checked in sequence.
When building automation pipelines that include editing operations, the async pattern works like this:
# Step 1: Submit inpainting request (async)
# → Returns task ID immediately
task_id = xbrush_edit_image(
image_url="https://...",
prompt="Replace background with marble table surface, natural light"
)
# Step 2: Poll for completion
# → Returns result image URL when processing finishes
result = check_task_status(task_id=task_id)
In Claude Code, the instruction "wait until the task completes, then use the result" handles the polling automatically. The model checks status at intervals and proceeds once the result is ready. For batch processing — editing multiple images in parallel — submit all task requests first, collect the task IDs, then check each one in sequence. This approach processes a batch of images in the time it takes to complete one sequential edit, making it well-suited for bulk Etsy listing image generation workflows.
Security and API Key Management
At a Glance: Entering API keys directly in the MCP configuration file is convenient for personal environments. For shared or version-controlled environments, referencing environment variables from the MCP config file prevents keys from being hardcoded in files that might be committed to a repository.
The Claude Code MCP configuration file is stored locally on the machine, so direct API key entry is safe for personal environments. For team setups or when the configuration file is included in version control, environment variables are the recommended approach.
# Set environment variables in .env or shell config
export XBRUSH_API_KEY="your-api-key-here"
export INBLOG_API_KEY="your-inblog-api-key-here"
Referencing environment variables from the MCP config file keeps the API keys out of any files that might be committed to a Git repository. If a key is exposed, XBRUSH API keys can be revoked and reissued immediately from the xbrush.run dashboard without needing to reconfigure the server.
When to Use This
- Generating AI images directly inside Claude Code for documentation or blog posts
- Developers building content automation pipelines that include image generation
- Marketers using inblog — write, generate images, and publish from one terminal session
- Projects requiring batch image generation with programmatic control
- Engineers exploring MCP-based AI automation workflows
Tools Used
- xbrush-api-mcp — AI content generation (github.com/lweight/xbrush-api-mcp)
- inblog-mcp — Blog publishing automation (github.com/lweight/inblog-mcp)
- XBRUSH API (xbrush.run)
Related Articles
Frequently Asked Questions
Can xbrush-api-mcp be used outside of Claude Code?
Yes. Any MCP-compliant client works — Claude Desktop, Cursor, Continue, and others that implement the MCP standard. Configuration file format varies by client; check each client's MCP setup documentation for the specific syntax required.
How do async operations work in practice?
Editing operations — inpainting, upscaling, background removal — are processed asynchronously. The tool call returns a task ID immediately. A separate check_task_status call retrieves the result once processing completes. In Claude Code, instructing the model to "wait for completion" triggers automatic polling until the task resolves.
What does it cost to generate an image through the API?
XBRUSH API charges $0.01 per generated image. Credits included in the Basic plan ($7/month) apply, or pay-as-you-go billing charges only for what is used. Full pricing details are available at XBRUSH pricing plans.
Can both xbrush-api-mcp and inblog-mcp run simultaneously?
Yes. Both servers are registered in the same Claude Code MCP settings file and run concurrently. The typical use case is generating an image with xbrush-api-mcp and immediately uploading it to a blog post via inblog-mcp in the same session.
Is the source code available for modification?
Yes. Both xbrush-api-mcp and inblog-mcp are MIT-licensed open source. The source is available at github.com/lweight — fork it, modify it, or submit pull requests. The MIT license permits use in commercial projects without restriction.
Last updated: 2026-04-15 · Requirements: Node.js 18+, Claude Code, XBRUSH API key. MCP configuration syntax varies by client — consult each client's documentation for setup details.