@genwave/svgmaker-mcp
Version:
MCP server for generating, editing, and converting SVG images using SVGMaker API
39 lines • 1.54 kB
JavaScript
import { SVGMakerClient } from '@genwave/svgmaker-sdk';
let svgMaker;
export function initializeSvgmakerService(apiKey, rateLimitRpmStr, baseUrl) {
const rateLimit = rateLimitRpmStr ? parseInt(rateLimitRpmStr, 10) : 2;
const config = {
logging: false, // Disable logging to prevent stdout pollution
rateLimit: rateLimit, // RPM
debug: false, // Enable debug mode
timeout: 60000, // 60s timeout
maxRetries: 0, // Do not retry requests
};
// Add baseUrl to config if provided
if (baseUrl) {
config.baseUrl = baseUrl;
}
svgMaker = new SVGMakerClient(apiKey, config);
}
export async function generateSVG(params) {
if (!svgMaker)
throw new Error('SVGMakerService not initialized.');
const configuredParams = { ...params, svgText: true };
const result = await svgMaker.generate.configure(configuredParams).execute();
return result;
}
export async function editSVG(params) {
if (!svgMaker)
throw new Error('SVGMakerService not initialized.');
const configuredParams = { ...params, svgText: true };
const result = await svgMaker.edit.configure(configuredParams).execute();
return result;
}
export async function convertImageToSVG(params) {
if (!svgMaker)
throw new Error('SVGMakerService not initialized.');
const configuredParams = { ...params, svgText: true };
const result = await svgMaker.convert.configure(configuredParams).execute();
return result;
}
//# sourceMappingURL=svgmakerService.js.map