dsh-minimal-mcp
dsh-minimal-mcp
将 deepseek-harness 的**极简模式(minimal agent preset)**的面向模型工具包装成一个 MCP server,供任意外部 agent(Claude Desktop、Trae、Cursor、LangChain 等)通过标准 MCP 协议接入调用。
极简模式(apps/cli/config/agent-presets/minimal/agent.cordis.yml)是 deepseek-harness 官方提供的最小双工具编码智能体,仅暴露两个工具:
bash— 持久 bash(PTY 会话,跨调用共享 cwd / 环境变量 / 函数 / 后台任务)str_replace_editor—view/create/str_replace/insert文件编辑
本实现自研复刻并对齐原版语义(@deepseek-ai/dsh-tool-bash-persistent 与 @deepseek-ai/dsh-tool-str-replace-editor),不依赖完整 harness 运行时,跨平台、轻量、可独立运行。
工具语义(与原版对齐)
bash
真实 PTY 持久 shell,命令间状态持久。
非零退出码追加注释:
[exit code: N]。输出超过上限截断并标记
<response clipped>。超时返回部分输出并重置 shell。
str_replace_editor
view:文件按cat -n风格加行号;目录列出非隐藏项、向下两级。create:仅当路径不存在时创建,否则报错。str_replace:old_str必须唯一逐字匹配,多匹配 / 零匹配报错。insert:insert_line0-based,插入不额外加尾换行。
Related MCP server: devcontainer-mcp
安装与构建
pnpm install
pnpm run build首次安装会执行
postinstall脚本,修复node-pty预编译二进制在 macOS 上的执行权限(缺失会导致posix_spawnp failed)。
运行
node dist/index.js环境变量
变量 | 默认 | 说明 |
|
| bash 与文件系统工具的工作目录 |
|
| 单条命令超时(毫秒),超时自动重置 shell 防卡死 |
|
| 命令 / 文件输出保留字符上限 |
|
| 用于 spawn 的 shell 路径 |
接入配置
以 Claude / 通用 MCP 客户端为例,在你的 MCP 配置中加入:
{
"mcpServers": {
"dsh-minimal": {
"command": "node",
"args": ["/absolute/path/to/dsh-mcp-tools/dist/index.js"],
"env": {
"DSH_CWD": "/your/workspace"
}
}
}
}一次服务调用暴露两个工具:bash 与 str_replace_editor,即为 deepseek-harness 极简模式的编码能力全集。
目录结构
src/
index.ts # MCP server 入口,注册两个工具(stdio 传输)
config.ts # 环境变量解析与描述文本
bash.ts # 持久 bash(node-pty)
editor.ts # str_replace_editor
scripts/
fix-node-pty-perms.mjs # 安装后修复 node-pty 二进制权限说明
传输方式为 stdio(MCP 标准,面向本地 agent)。如需 streamable-HTTP 可扩展。
原版 bash 描述中提到"可通过镜像访问 apt/pip 包"等环境信息,本实现保留该描述文本但实际网络能力取决于运行环境。
This server cannot be deployed
Maintenance
Related MCP Connectors
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
MCP server for agentverse documentation, generated by doc2mcp.
Remote MCP server for supportsheep: run AI interviews and manage support content for your blog.
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
1
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA lightweight, stdio-based MCP server enabling AI assistants to perform local file system operations like reading, writing, searching, and executing commands.3,012 npmMIT
- AlicenseAqualityFmaintenanceA minimal MCP server that exposes a single bash tool to execute commands inside a devcontainer, returning real output and exit codes.1MIT
- FlicenseAqualityDmaintenanceA simple MCP server that exposes a terminal tool, allowing AI agents to execute shell commands.1-
- FlicenseNot gradedqualityBmaintenanceContainerized MCP server for coding agents with tools for file editing, shell commands, process management, Git, browser automation, and project snapshots.-