mcp-server-commands

by g0t4

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Provides system command execution capabilities on macOS, with specific installation paths for the Claude Desktop app configuration on macOS systems.

工具

工具是法学硕士(LLM)需要申请的,例如 Claude Desktop 应用程序。Claude Sonnet 3.5 巧妙地利用了这两种工具,这让我感到惊喜。

  • run_command - 运行命令,例如hostnamels -alecho "hello world"
    • 以文本形式返回 STDOUT 和 STDERR
  • run_script - 运行脚本!(例如fishbashzshpython
    • 让你的 LLM 运行它编写的代码!
    • 脚本通过 STDIN 传递
    • run_script == run_command + STDIN 上的脚本
    • 克劳德对此非常有创意,即使用cat作为解释器来创建新文件!

警告:请谨慎操作此服务器!在 Claude 桌面应用中,请使用Approve Once (而不是Allow for This Chat ),以便您可以审核每个命令;如果您不信任该命令,请使用Deny 。权限由运行服务器的用户决定。请勿使用sudo运行。

视频演示

提示

提示是供用户包含在聊天历史记录中,即通过Zed的斜线命令(在其 AI 聊天面板中)

  • run_command - 使用命令输出生成提示消息

发展

安装依赖项:

npm install

构建服务器:

npm run build

对于使用自动重建的开发:

npm run watch

安装

要与 Claude Desktop 一起使用,请添加服务器配置:

在 MacOS 上: ~/Library/Application Support/Claude/claude_desktop_config.json在 Windows 上: %APPDATA%/Claude/claude_desktop_config.json

使用已发布的 npm 包

使用此工作流程mcp-server-commands发布到 npm

{ "mcpServers": { "mcp-server-commands": { "command": "npx", "args": ["mcp-server-commands"] } } }

使用本地构建(repo checkout)

{ "mcpServers": { "mcp-server-commands": { // works b/c of shebang in index.js "command": "/path/to/mcp-server-commands/build/index.js" } } }

日志记录

Claude 桌面应用程序将日志写入~/Library/Logs/Claude/mcp-server-mcp-server-commands.log

默认情况下,仅记录重要消息(例如错误)。如果您想查看更多消息,请在配置服务器时将--verbose添加到args中。

顺便说一下,日志会写入STDERR ,因为 Claude Desktop 会将日志路由到日志文件。未来,我希望格式良好的日志消息能够通过STDIO传输写入 MCP 客户端(注意:不是 Claude Desktop 应用)。

调试

由于 MCP 服务器通过 stdio 进行通信,调试起来可能比较困难。我们推荐使用MCP Inspector ,它以包脚本的形式提供:

npm run inspector

检查器将提供一个 URL 来访问浏览器中的调试工具。

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

用于运行命令的 MCP 服务器。

  1. Video walkthrough
    1. Prompts
      1. Development
        1. Installation
          1. Use the published npm package
          2. Use a local build (repo checkout)
          3. Logging
          4. Debugging
        ID: 4vlwa2czqa