本仓库实现了终端命令的模型上下文协议(MCP)服务器。借助该服务器,Claude 能够在指定目录中执行终端命令,为用户提供更便捷的操作体验。
git clone https://github.com/algae514/terminal-mcp-server.git
cd terminal-mcp-server
npm install
npm run build
chmod +x start-server.sh
要使用此服务器与Claude配合,您需要更新Claude的配置文件以包含终端MCP服务器。
更新Claude配置文件(通常位于 ~/.config/claude/claude_desktop_config.json 或类似位置),添加以下内容:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/path/to/directory1",
"/path/to/directory2",
"/path/to/directory3"
]
},
"terminal": {
"command": "/path/to/terminal-mcp-server/start-server.sh",
"args": []
}
}
}
/path/to/directory1、/path/to/directory2 等替换为您希望Claude可以访问的目录。/path/to/terminal-mcp-server 替换为实际克隆仓库的位置。配置完成后,Claude 可以通过终端 MCP 服务器在指定目录中执行终端命令。
本服务器基于Node.js和npm构建,通过配置Claude的配置文件,使其能够与Claude进行交互,实现终端命令的执行。
本项目采用 MIT License。