@snahrup/notion-hero-image-mcp
Version:
AI-powered animated hero banner generator for Notion pages. Integrates DALL-E 3, Google Veo 3, Cloudinary CDN, and Notion API.
62 lines • 2.03 kB
JavaScript
import { v2 as cloudinary } from 'cloudinary';
cloudinary.config({
cloud_name: process.env.CLOUDINARY_CLOUD_NAME,
api_key: process.env.CLOUDINARY_API_KEY,
api_secret: process.env.CLOUDINARY_API_SECRET,
});
const definition = {
name: 'upload_to_cloudinary',
description: 'Upload GIF to Cloudinary and return permanent URL',
inputSchema: {
type: 'object',
properties: {
gif_path: {
type: 'string',
description: 'Local path to GIF file'
},
folder: {
type: 'string',
description: 'Cloudinary folder for organization',
default: 'notion-banners'
},
public_id: {
type: 'string',
description: 'Optional public ID for the asset'
}
},
required: ['gif_path']
}
};
const handler = {
'tools/call': async (request) => {
if (request.params.name !== 'upload_to_cloudinary')
return null;
const { gif_path, folder = 'notion-banners', public_id } = request.params.arguments;
const uploadOptions = {
resource_type: 'image',
folder,
overwrite: true,
use_filename: !public_id,
unique_filename: false,
format: 'gif'
};
if (public_id) {
uploadOptions.public_id = public_id;
}
const result = await cloudinary.uploader.upload(gif_path, uploadOptions);
return {
content: [{
type: 'text',
text: JSON.stringify({
cdn_url: result.secure_url,
public_id: result.public_id,
size: result.bytes,
width: result.width,
height: result.height
})
}]
};
}
};
export default { definition, handler };
//# sourceMappingURL=upload-cloudinary.js.map