Skip to main content
Glama

Excel MCP Server

by zhiwei5576
MIT License
99
41
  • Linux
  • Apple
logCleaner.js1.4 kB
import fs from 'fs'; import path from 'path'; import { getLogPath, getConfig } from './config.js'; export class LogCleaner { constructor() { this.interval = null; const config = getConfig(); this.logDir = getLogPath(); this.retentionDays = config.log.retentionDays; } start() { const config = getConfig(); // 立即执行一次清理 this.cleanOldLogs(); // 设置定时任务 this.interval = setInterval(() => { this.cleanOldLogs(); }, config.log.cleanupInterval * 60 * 60 * 1000); } stop() { if (this.interval) { clearInterval(this.interval); } } cleanOldLogs() { try { const files = fs.readdirSync(this.logDir); const now = new Date(); files.forEach(file => { if (file.endsWith('.log')) { const filePath = path.join(this.logDir, file); const stats = fs.statSync(filePath); const fileAge = (now.getTime() - stats.mtime.getTime()) / (1000 * 60 * 60 * 24); if (fileAge > this.retentionDays) { fs.unlinkSync(filePath); } } }); } catch (error) { console.error('Error cleaning log files:', error); } } }

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/zhiwei5576/excel-mcp-server'

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