文件打开服务

一个为Claude AI提供文件打开功能的MCP服务器,支持使用系统默认应用程序打开文件或目录,并可在macOS Finder中显示文件。

  • by TIMBOTGPT
  • JavaScript
  • 本地部署
  • 更新于
在 GitHub 查看 timbotgpt/file-opener-mcp

使用说明

文件打开器MCP服务器

为Claude AI提供文件打开功能的模型上下文协议(MCP)服务器。

特性

  • open_file:使用系统的默认应用程序打开任何文件或目录
  • reveal_infinder:在macOS Finder中显示文件或目录
  • 可选应用程序规范(例如,使用Preview、TextEdit等打开)
  • 跨平台支持(主要针对macOS)
  • 完整的错误处理和验证

安装

快速安装

npm install -g file-opener-mcp

来源

  1. 克隆存储库:

    git clone https://github.com/TIMBOTGPT/file-opener-mcp.git
    cd file-opener-mcp
    
  2. 安装依赖项:

    npm install
    
  3. 测试服务器:

    npm start
    

使用Claude Desktop

将此服务器添加到您的Claude Desktop MCP配置中(claude_desktop_config.json):

{
  "mcpServers": {
    "file-opener": {
      "command": "npx",
      "args": ["-y", "file-opener-mcp"],
      "description": "Open files with system applications"
    }
  }
}

或者,如果在本地安装:

{
  "mcpServers": {
    "file-opener": {
      "command": "node",
      "args": ["/path/to/file-opener-mcp/index.js"],
      "description": "Open files with system applications"
    }
  }
}

可用工具

open_file

使用系统的默认应用程序或指定的应用程序打开文件或目录。

参数:

  • path (必填):文件或目录的完整路径
  • application (可选):要使用的特定应用程序(例如,“预览”、“文本编辑”)

例子:

{
  "name": "open_file",
  "arguments": {
    "path": "/path/to/documents/report.pdf",
    "application": "Preview"
  }
}

reveal_infinder

在macOS Finder中显示文件或目录。

参数:

  • path (必填):文件或目录的完整路径

例子:

{
  "name": "reveal_in_finder",
  "arguments": {
    "path": "/path/to/documents/report.pdf"
  }
}

需求

  • macOS(使用 open 命令)
  • Node.js 16+
  • 支持MCP的Claude桌面

安全

  • 打开前验证文件是否存在
  • 仅执行安全系统 open 命令
  • 正确的错误处理和报告
  • 无需网络访问

许可证

MIT许可证-有关详细信息,请参阅许可证文件

贡献

  1. 分叉存储库
  2. 创建要素分支
  3. 进行更改
  4. 如果适用,添加测试
  5. 提交拉取请求

支持

有关问题和疑问,请使用 GitHub问题 页面。