Skip to main content
Glama

quickchart-mcp-server

file.ts1.74 kB
import * as fs from "fs"; import * as path from "path"; /** * Get appropriate download path for files */ export function getDownloadPath(outputPath?: string, format: string = "png"): string { // Get the default directory from environment variable const defaultDirConfig = process.env.QUICKCHART_DEFAULT_OUTPUT_DIR; const desktopPath = path.join( process.env.HOME || process.env.USERPROFILE || ".", "Desktop" ); let basePath: string; if (defaultDirConfig && path.isAbsolute(defaultDirConfig) && fs.existsSync(defaultDirConfig)) { // Use absolute path only if it exists basePath = defaultDirConfig; } else { // Fallback to Desktop in home directory for any invalid case basePath = desktopPath; } if (outputPath) { if (path.isAbsolute(outputPath)) { return outputPath; } if (fs.existsSync(basePath)) { return path.join(basePath, outputPath); } // Fallback to Desktop if configured path doesn't exist if (fs.existsSync(desktopPath)) { return path.join(desktopPath, outputPath); } // Final fallback to home directory return path.join( process.env.HOME || process.env.USERPROFILE || ".", outputPath ); } const timestamp = new Date() .toISOString() .replace(/[-:T]/g, "") .split(".")[0]; const filename = `chart_${timestamp}.${format}`; if (fs.existsSync(basePath)) { return path.join(basePath, filename); } // Fallback to Desktop if configured path doesn't exist if (fs.existsSync(desktopPath)) { return path.join(desktopPath, filename); } // Final fallback to home directory return path.join( process.env.HOME || process.env.USERPROFILE || ".", filename ); }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TakanariShimbo/quickchart-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server