Win 10 MCP Server Simple Persistant Logging

MCP运维云端

提供方 trevorwilkerson

运维云端 未标注 无需鉴权 社区 / 第三方 Claude DesktopClaude

一个用于在文件写入时自动创建备份并记录日志的持久化日志系统,适用于防止文件覆盖和数据丢失的场景。

一句话选型结论

按资料字段整理

Win 10 MCP Server Simple Persistant Logging 属于运维云端类 MCP 服务器,传输方式未标注,无需鉴权,可直接接入 Claude Desktop、Claude,没有现成安装命令,需按官方文档接入。接入前先确认权限范围;涉及写入、删除或付款的操作,建议先在测试环境验证。

分类运维云端 传输方式未标注 鉴权无需鉴权 部署方式未标注
GitHub 星标 0 仓库热度,无公开仓库时显示未标注
工具数 未标注 暴露给模型的工具数量
资源 / 提示词 0 / 0 资源与提示词模板数量
维护方 社区 / 第三方 核验等级 仅资料核对

工具与能力

运维云端
数量来自来源目录的标注,具体工具清单以官方文档为准
工具数量未标注暴露给模型可调用的工具个数
资源数量0可读取的资源条目
提示词数量0内置提示词模板数量

能力标签

支持客户端

适用场景

文件备份JavaScript本地部署日志记录数据安全持久化存储文件管理

安装与配置

未标注 无需鉴权
上游未给出传输方式
  1. 1
    准备运行环境

    按官方文档确认运行环境(常见为 Node.js 或 Python),装好后再执行安装命令。

  2. 2
    安装服务

    复制上面的安装命令执行;命令里带占位符的位置,换成自己的密钥或路径。

  3. 3
    写入客户端配置

    在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4
    验证是否可用

    连接成功后随便调一个只读工具,确认能返回结果,再接入正式流程。

典型使用场景

3 类
按分类与标签整理的常见用法,具体以官方文档为准
云资源查询

查实例、存储、账单等云上资源状态。

部署与发布

把部署、重启、回滚这类操作接进对话。

监控与告警

拉取监控指标,异常时让模型帮你判断。

选择建议

选之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 已适配 Claude Desktop、Claude,换客户端不用重新研究配置。
  • 资料标注无需鉴权,装好就能连。

先想清楚的地方

  • 没有现成安装命令,需要按官方文档自己填启动命令和参数。
  • 资料没标注工具数量,实际能力要装好后确认。
  • 版本更新与行为细节以官方仓库为准。

更适合

  • 需要在运维云端场景里让模型直接调用外部能力的人。
  • 已经在用 Claude Desktop、Claude 的用户,接入路径最短。
  • 想先快速试一下、能接受在本地或自有环境跑服务的人。

不太适合

  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
MCP 服务器工具数传输方式部署方式安装命令最后核验
Win 10 MCP Server Simple Persistant Logging当前 未标注 未标注 未标注 无 2026-05-17
lobehub 未标注 stdio · 本地进程 本地部署 有 2026-04-11
TrendRadar 未标注 stdio · 本地进程 本地部署 有 2026-04-13
Ui Tars Desktop 8a825770 未标注 stdio · 本地进程 本地部署 有 2026-05-17
ruflo 未标注 stdio · 本地进程 本地部署 有 2026-04-13
FastGPT 未标注 stdio · 本地进程 本地部署 有 2026-04-11

服务器档案

运维云端
字段来自项目仓库与公开索引,中文说明由本站标注
提供方trevorwilkerson上游标注的维护方 trevorwilkerson
分类运维云端本站按上游分类展示
连接方式未标注上游未给出传输方式
鉴权方式无需鉴权远程服务建议用最小权限凭据
维护方社区 / 第三方核验等级 仅资料核对
包名 / 运行时未标注 · 未标注本地安装时用到的包标识与运行时
部署类型未标注上游给出的部署形态
最近核验2026-05-17上游最后核验时间

详细介绍

6.6 KB
来自项目仓库与上游目录的原文,未做删改

Win-10-MCP-Server——简单持久的日志记录

虽然MCP Inspector显示了MCP服务器的所有通信,但我希望日志能保存在HDD上。
具体来说,因为我修改了index.js中“服务器文件系统/dist”中的“写入文件”案例

问题:Claude变得非常懒惰,可能无法编写它正在处理的整个文件。

例如,它可以写标题,然后说
[其余代码保持不变…]

现在我的文件被覆盖了。..

我做了两件事:

  1. 每次调用write_file工具时,我都会复制一个带有日期时间戳的目标文件(如果存在)。
  2. 记录文件名并将其发送回(返回语句)Claude Desktop App,以便用户看到备份文件名。

然后,我手动使用diff工具来验证发生了什么变化。…稍后修复克劳德的错误

这里是代理的绝佳用例。…提示,提示。.

1.创建 logger.mjs

创建一个名为的新文件 logger.mjs 在项目根目录中:```javascript
// logger.mjs
import fs from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";

// Determine the directory of the current module
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

// Define logs directory relative to the logger.mjs file
const LOG_DIR = path.join(__dirname, "logs");

// Ensure the logs directory exists
async function ensureLogDir() {
try {
await fs.mkdir(LOG_DIR, { recursive: true });
} catch (err) {
console.error("Failed to create logs directory:", err);
}
}

ensureLogDir();

// Define log file path
const LOG_FILE = path.join(LOG_DIR, "KAN_server.log");

/*
* Logs a message to the log file with the specified level.
*
* @param {string} level - The severity level of the log (e.g., INFO, ERROR).
* @param {string} message - The message to log.
/
export async function logToFile(level, message) {
const timestamp = new Date().toISOString();
const line = [${level.toUpperCase()}] ${timestamp} - ${message}\n;

try {
await fs.appendFile(LOG_FILE, line);
} catch (err) {
// If writing fails, log to console.error without disrupting the main flow
console.error("Failed to write to log file:", err);
}

}

// Temporary verification (commented out to prevent interference)
// console.log("Logging to:", LOG_FILE); // Do not use, as it can interfere with JSON responses


### 添加index.js

我更改了我的index.js
它可以在以下目录中找到(Win10):
C: \\用户\\TrevorW\\AppData\\Roaming\\npm\\node_modules@modelcontextprotocol\\服务器文件系统\\dist

### 3.实施 `write_file` 案例

修改 `write_file` 操作,确保它处理文件写入和备份创建,并记录所有相关信息。```javascript
// index.js

// ...imports and schema definitions...

/**
* Validates the provided file path to prevent unauthorized access.
*
* @param {string} filePath - The file path to validate.
* @returns {Promise} - The validated and normalized file path.
* @throws Will throw an error if the path is invalid.
*/
async function validatePath(filePath) {
// Normalize the path to prevent directory traversal
const normalizedPath = path.normalize(filePath);

// Define allowed base directories
const allowedBase = path.resolve(process.cwd(), "Control_Charts");

// Ensure the normalized path starts with the allowed base directory
if (!normalizedPath.startsWith(allowedBase)) {
throw new Error("Invalid file path. Access denied.");
}

// Additional validations can be added here (e.g., file extension checks)

return normalizedPath;
}

/**
* Handles various operations based on the provided operation name and arguments.
*
* @param {string} operation - The name of the operation to perform.
* @param {object} args - The arguments required for the operation.
* @returns {Promise} - The response object to send back.
*/
async function handleOperation(operation, args) {
switch (operation) {
case "write_file": {
try {
// 1. Parse incoming arguments
const parsed = WriteFileArgsSchema.safeParse(args);
if (!parsed.success) {
throw new Error(`Invalid arguments for write_file: ${parsed.error}`);
}

// 2. Validate the path
const validPath = await validatePath(parsed.data.path);

let backupName = null; // Initialize backupName to track if a backup is created

// 3. Backup existing file if it exists
try {
await fs.access(validPath); // Throws if file doesn't exist

// Build date/time string in MMDDYY_HH_MM format
const now = new Date();
const mm = String(now.getMonth() + 1).padStart(2, '0');
const dd = String(now.getDate()).padStart(2, '0');
const yy = String(now.getFullYear()).slice(-2);
const hh = String(now.getHours()).padStart(2, '0');
const mn = String(now.getMinutes()).padStart(2, '0');
const dateString = `${mm}${dd}${yy}_${hh}_${mn}`;

// Build backup file path
const dirName = path.dirname(validPath);
const baseName = path.basename(validPath);
backupName = `${baseName}.${dateString}__CLDBak`; // Assign to backupName
const backupPath = path.join(dirName, backupName);

// Rename original file to create backup
await fs.rename(validPath, backupPath);

// Log the backup creation
await logToFile("INFO", `Backup created at ${backupPath}`);
} catch (err) {
if (err.code !== 'ENOENT') { // ENOENT: File does not exist
// Log unexpected errors during backup
await logToFile("ERROR", `Error accessing or backing up file: ${err.message}`);
throw err; // Re-throw unexpected errors
}
// File doesn't exist; proceed without backup
await logToFile("INFO", `No existing file at ${validPath}. No backup created.`);
}

// 4. Write the new content
await fs.writeFile(validPath, parsed.data.content, "utf-8");
await logToFile("INFO", `Successfully wrote to ${validPath}`);

// 5. Prepare the response
let responseText = `Successfully wrote to ${parsed.data.path}`;
if (backupName) {
responseText += `\nKAN: Backup saved to ${backupName}`;
}

//  THIS IS THE KEY TO MAKE CLAUDE DESKTOP HAPPY
//  The response HAS TO BE in JSON, or will bitch at you
const response = {
content: [{
type: "text",
text: responseText,
}],
};

// 6. Return the response without any additional logging
return response;
} catch (error) {
// Log the error details
await logToFile("ERROR", `write_file operation failed: ${error.message}`);
throw error; // Ensure the error is propagated appropriately
}
}

// ... handle other cases ...      //  Example of the lazyness I am dealing with here ....

default:
throw new Error(`Unknown operation: ${operation}`);
}
}

如果你已经做到了这一点,你可能会说,嘿,Trevor,为什么不使用类似IDE的游标来添加此功能呢。

我的答案是:三个月后我们会有光标吗?在Windows 10完全进入语音模式之前,我可能会学到一些东西。...

常见问题

6 问
答案由本站依据条目字段整理,不引用上游原文
Win 10 MCP Server Simple Persistant Logging 怎么安装?

资料没有给出安装命令,请到官方仓库或文档按说明接入;这类条目多数是生态应用,或尚未发布可安装包。

Win 10 MCP Server Simple Persistant Logging 怎么在 Claude Desktop、Claude 里配置?

它的传输方式未标注,在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,配置才会生效。

Win 10 MCP Server Simple Persistant Logging 收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Win 10 MCP Server Simple Persistant Logging 需要 API Key 吗?

资料标注为无需认证,装好就能连;如果实际调用时报鉴权错误,按官方文档补上凭据。

Win 10 MCP Server Simple Persistant Logging 支持哪些客户端?

资料标注支持 Claude Desktop、Claude;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

Win 10 MCP Server Simple Persistant Logging 能提供哪些能力?

资料显示能力标签包括 持久化存储、JavaScript、Claude、日志记录。具体工具清单以官方文档为准。

热门专题

按标签挑服务器
全部专题 →

服务器信息以作者仓库与官方文档为准;分类、传输方式与鉴权方式的中文说明为中文整理,最近核验 2026-05-17。