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 公式が提供する最小の双工具编码智能体であり、以下の 2 つの工具のみを公開します:
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 持続シェルであり、コマンド間で状態が持続します。
非ゼロ終了コードには注釈を追加:
[exit code: N]。出力が上限を超えた場合は切り詰め、
<response clipped>とマークします。タイムアウト時は部分出力を返し、シェルをリセットします。
str_replace_editor
view:ファイルをcat -nスタイルで行番号付き表示;ディレクトリは非表示項目を除き、下 2 階層まで一覧表示。create:パスが存在しない場合のみ作成し、存在する場合はエラーを返します。str_replace:old_strは一意かつ完全一致である必要があり、複数一致 / ゼロ一致の場合はエラーを返します。insert:insert_lineは 0-based で、挿入時に余分な末尾改行は追加しません。
Related MCP server: devcontainer-mcp
インストールとビルド
pnpm install
pnpm run build初回インストール時に
postinstallスクリプトが実行され、macOS 上でのnode-ptyプリビルドバイナリの実行権限を修復します(欠落するとposix_spawnp failedが発生します)。
実行
node dist/index.js環境変数
変数 | デフォルト | 説明 |
|
| bash とファイルシステムツールの作業ディレクトリ |
|
| 単一コマンドのタイムアウト(ミリ秒)。タイムアウト時はシェルを自動リセットしてフリーズを防止 |
|
| コマンド / ファイル出力の保持文字数の上限 |
|
| spawn に使用するシェルのパス |
接続設定
Claude / 汎用 MCP クライアントを例にすると、MCP 設定に以下を追加します:
{
"mcpServers": {
"dsh-minimal": {
"command": "node",
"args": ["/absolute/path/to/dsh-mcp-tools/dist/index.js"],
"env": {
"DSH_CWD": "/your/workspace"
}
}
}
}1 回のサービス呼び出しで 2 つの工具(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.-