Add AI Video Generation to Claude Code with MCP in 5 Minutes
Claude Code is already a powerful AI-assisted development tool. With the Model Context Protocol (MCP), you can extend it with custom capabilities — including generating AI videos and images. This guide shows you how to connect agent-media CLI as an MCP server so Claude can generate media assets on your behalf without ever leaving your development workflow.
What is MCP and why it matters
The Model Context Protocol is an open standard that lets AI assistants interact with external tools and services. Instead of copying commands back and forth between your terminal and chat interface, MCP creates a direct bridge. Claude Code discovers the tools your MCP server exposes, understands what they do, and calls them autonomously when appropriate. For agent-media, this means Claude can submit video generations, check job status, list available models, and verify your credit balance — all through natural language conversation.
What you get after setup
Once connected, Claude Code gains access to all agent-media capabilities as MCP tools. Here is what becomes available:
- +Generate videos — ask Claude to create a video with any supported model (Kling, Sora, Seedance, Veo) and it submits the job for you
- +Generate images — request images from Flux 2 Pro, Flux 2 Flex, or Grok Imagine
- +Check job status — ask "is my video done?" and Claude queries the API for you
- +List models — ask which models are available and their capabilities
- +Check credits — verify your balance before starting expensive generations
Step 1: Install agent-media CLI
If you have not already installed the CLI, do that first. The MCP server is built into the CLI package — there is nothing extra to install.
$ npm install -g agent-media-cli
Step 2: Add the MCP server configuration
Claude Code reads MCP server configurations from a settings file. You need to add an entry that tells Claude how to start the agent-media MCP server. Add the following to your Claude Code MCP settings:
{
"mcpServers": {
"agent-media": {
"command": "npx",
"args": ["-y", "agent-media-cli", "mcp-server"]
}
}
}The npx -y flag ensures the package is available without prompting. When Claude Code starts, it launches the MCP server process and discovers all available tools automatically. You can also use the global install directly:
{
"mcpServers": {
"agent-media": {
"command": "agent-media",
"args": ["mcp-server"]
}
}
}Step 3: Authenticate your account
The MCP server uses the same device key as the CLI. If you have already run agent-media login before, you are all set. If not, run it now:
$ agent-media login
Opening browser for authentication...
Logged in successfully. Device key stored.
The device key is stored locally and the MCP server reads it automatically. You do not need to pass any credentials to Claude Code or set environment variables.
Step 4: Try it out
Restart Claude Code to pick up the new MCP configuration. Then just ask Claude to generate something. Here are some example prompts to try:
"Generate a 5-second video of a cat playing with a ball of yarn using Kling 3.0"
Claude will call the generate tool with model kling3, your prompt, and 5-second duration.
"Create a product shot image of a sleek headphone on a marble surface with dramatic lighting"
Claude will use Flux 2 Pro to generate a high-quality product image at 5 credits.
"How many credits do I have left?"
Claude calls the credits-check tool and reports your current balance and plan.
"Generate a TikTok-style video of someone unboxing a tech gadget, use 9:16 aspect ratio with Seedance"
Claude submits a portrait-oriented video generation optimized for short-form social.
How it works under the hood
When Claude Code starts with the agent-media MCP server configured, the following happens:
- 1Claude Code launches the MCP server process using the configured command (
agent-media mcp-server). - 2The server responds with a list of available tools: generate, check-status, list-models, and credits-check.
- 3When you ask Claude to generate media, it identifies the appropriate tool, constructs the parameters (model, prompt, duration, aspect ratio), and sends a tool call through the MCP protocol.
- 4The MCP server executes the command against the agent-media API using your stored device key and returns the result to Claude.
- 5Claude formats the result (job ID, output URL, credit balance) and presents it in the conversation.
The entire flow happens within your existing Claude Code session. No browser tabs, no terminal switching, no context loss.
Use cases for MCP integration
The combination of Claude Code and agent-media opens up workflows that neither tool provides alone:
Generating assets during development
Building a landing page and need a hero video? Ask Claude to generate one without leaving your editor. It picks the right model, writes the prompt, and gives you the URL to embed — all in one conversation turn.
Prototyping visual concepts
Exploring ideas for a project? Ask Claude to generate a few variations using different models and prompts. Compare the Flux 2 Pro output with Grok Imagine. Iterate on the prompt within the conversation until you get what you need.
Content pipeline integration
Building an automated content pipeline? Have Claude help you write the scripts and test them in real-time. It can generate test videos, check the results, and help you debug the pipeline — all through the MCP connection.
Multi-model comparison
Ask Claude to generate the same prompt across multiple models and compare the results. It can submit parallel jobs, track their status, and present the output URLs side by side so you can pick the best result.
Available MCP tools reference
Here is the complete list of tools that the agent-media MCP server exposes to Claude Code:
| Tool | Description |
|---|---|
| generate | Generate a video or image with any supported model |
| check-status | Check the status of a submitted generation job |
| list-models | List all available models with capabilities and pricing |
| credits-check | Check current credit balance and plan details |
Troubleshooting
If the MCP tools do not appear in Claude Code, check these common issues:
- *Not logged in: Run
agent-media loginbefore starting Claude Code. The MCP server needs a valid device key. - *CLI not found: Ensure agent-media-cli is installed globally or that npx can resolve it. Test with
agent-media --version. - *Config not picked up: Restart Claude Code after adding the MCP configuration. Changes to settings require a fresh session.
- *Insufficient credits: The MCP server will return an error if you do not have enough credits. Check your balance with
agent-media creditsor ask Claude to check for you.
Give Claude the power to create
Five minutes of setup. Seven AI models at your fingertips. Plans start at $19/mo.