这是一个适用于 macOS 的 MCP 服务器,提供高级系统监控和文件搜索功能。
本 MCP 服务器专为 macOS 设计,提供系统性能监控和文件搜索等高级功能。下面将详细介绍其功能、安装步骤、使用方法等内容。
为实现完整功能,服务器需要特定权限:
xcode-select --install
若要在 Claude 桌面中使用此 MCP 服务器,请按以下步骤操作:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.json{
"mcpServers": {
"macos-tools": {
"command": "npx",
"args": [
"@tgomareli/macos-tools-mcp"
],
"env": {}
}
}
}
mcpServers 对象中:{
"mcpServers": {
"existing-server": {
// ... 现有配置
},
"macos-tools": {
"command": "npx",
"args": [
"@tgomareli/macos-tools-mcp"
],
"env": {}
}
}
}
system_performance - 监控系统资源enhanced_search - 高级文件搜索和标签管理你也可以使用 mcp-installer 直接安装,无需手动打开配置文件。在 Claude 中输入以下命令:
Hey Claude, install the MCP server named macos-tools-mcp
// 获取当前系统性能指标
await callTool("system_performance", {
action: "current",
metric: "all"
});
// 获取过去 24 小时的内存使用历史
await callTool("system_performance", {
action: "history",
timeRange: "24h",
metric: "memory"
});
// 获取占用 CPU 最多的进程
await callTool("system_performance", {
action: "processes",
metric: "cpu"
});
// 分析系统并提供性能优化建议
await callTool("system_performance", {
action: "optimize"
});
// 在当前目录的 JavaScript 文件中搜索 TODO 注释
await callTool("enhanced_search", {
action: "search",
query: "TODO|FIXME",
searchType: "regex",
fileTypes: ["js", "ts", "py"],
path: "~/Projects"
});
// 为文件添加标签
await callTool("enhanced_search", {
action: "tag",
path: "~/Documents/important.pdf",
tags: ["urgent", "project-x"]
});
// 搜索带有特定标签的文件
await callTool("enhanced_search", {
action: "search",
searchType: "tags",
tags: ["urgent"],
path: "~/Documents"
});
// 在配置文件中搜索包含特定单词的文件
await callTool("enhanced_search", {
action: "search",
query: "apiKey",
searchType: "content",
fileTypes: ["json", "env"],
path: "~/Projects",
maxResults: 50
});
本项目采用 MIT 许可证,详情请参阅 LICENSE 文件。
在 Claude 桌面中配置好服务器后,可使用以下提示测试所有功能:
Show me my current system performance metrics
What are the top 5 CPU-consuming processes on my system?
Search for TODO comments in JavaScript files in my current directory
Analyze my system and suggest performance optimizations
使用以下综合提示测试所有功能:
I want to test the macOS Tools MCP server. Please help me:
1. **系统性能测试**:
- 显示当前系统性能指标(CPU、内存、磁盘、网络)
- 显示占用 CPU 最多的前 5 个进程
- 显示过去一小时的内存使用历史
- 分析系统并提供优化建议
- 获取占用内存最多的进程
2. **文件搜索测试**:
- 在主目录中搜索包含 "TODO" 或 "FIXME" 注释的所有 JavaScript 和 TypeScript 文件
- 在当前项目目录中查找文件名包含 "test" 的所有文件
- 在配置文件(.json、.env、.yml)中搜索包含 "password" 一词的文件
- 使用正则表达式在文本文件中查找所有电子邮件地址
- 搜索过去 24 小时内修改过的文件
3. **标签管理测试**:
- 为文件 /Users/tornikegomareli/Development/macos-tools-mcp/README.md 添加 "important" 和 "reviewed" 标签
- 搜索所有带有 "important" 标签的文件
- 从 README 文件中移除 "reviewed" 标签
- 为 src 目录中的所有 TypeScript 文件添加 "source-code" 标签
4. **组合操作**:
- 在执行大文件搜索时监控系统性能
- 查找资源密集型进程,然后搜索其日志文件
- 显示当前磁盘使用情况,并搜索大文件(> 100MB)
5. **边界情况**:
- 在不存在的目录中搜索
- 尝试为没有修改权限的文件添加标签
- 请求无效时间范围的性能数据
- 使用无效的正则表达式进行搜索