An MCP (Model Context Protocol) server that provides AI-powered image and video generation tools, integrated with Nevermined's payment system for credit management and authentication.
src/
├── services/
│ ├── nevermined/
│ │ ├── config.ts # Nevermined configuration and constants
│ │ ├── manager.ts # Payment and service access management
│ │ └── index.ts # Public module exports
│ └── video/
│ ├── service.ts # Generation service implementation
│ └── index.ts # Public module exports
└── index.ts # Entry point and tools definition
This MCP server provides several tools for media generation:
Before generating any media, ensure you have enough credits by purchasing a plan:
{
"name": "purchase_plan",
"parameters": {
"planDid": "string" // The DID of the plan to purchase
}
}Once you have credits, you can use any of these generation tools:
Generate images from textual descriptions:
{
"name": "text2image",
"parameters": {
"prompt": "string" // Textual description of the desired image
}
}Transform existing images based on text prompts:
{
"name": "image2image",
"parameters": {
"inputImageUrl": "string", // URL of the image to transform
"prompt": "string" // Textual description of the desired transformation
}
}Generate videos from text descriptions:
{
"name": "text2video",
"parameters": {
"prompt": "string", // Textual description of the desired video
"imageUrls": "string[]", // Optional: Reference image URLs
"duration": "number" // Optional: Video duration in seconds
}
}- Nevermined payment system integration
- Credit balance verification before media generation
- Large content handling (>1MB) with URL fallback
- Automatic base64 content conversion for direct display
- Detailed error handling and logging
- Payment management through singleton pattern
- Access token authentication
The server requires only one environment variable:
NVM_API_KEY=your_api_keyOther configuration values (environment, plan DID, agent DID) are hardcoded in config.ts.
npm install
npm run buildThis is an MCP server that needs to be configured in your MCP client configuration. The setup varies depending on your client:
Add this configuration to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"image-video-generator": {
"command": "node",
"args": [
"/path/to/video-generation-mcp/build/index.js"
],
"env": {
"NVM_API_KEY": "YOUR_NVM_API_KEY"
}
}
}For other MCP clients like Cursor, refer to their specific documentation for adding custom MCP servers.
- Media content larger than 1MB will be served as URL only
- Images are returned in JPEG format
- Videos are returned in MP4 format
- Base64 content is limited to 1MB to ensure compatibility with MCP protocol
To contribute to the project:
- Clone the repository
- Install dependencies:
npm install - Build the project:
npm run build - Configure in your MCP client as described in the Usage section
Copyright 2025 Nevermined AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
