DeepSeek Harness 是一个针对 DeepSeek V4-Pro / V4-Flash 的第三方协议适配项目。

它不是 DeepSeek 官方客户端,也不是新的大模型,而是夹在 DeepSeek API 与 Claude Code、Cline、Roo Code、Cherry Studio 等 AI 工具之间的一层“适配器”,主要解决多轮推理、Tool Calling、流式输出、上下文和缓存等兼容问题。

目前项目提供 4 种主要使用方式:

  • Python Library
  • dsh 命令行工具
  • MCP Server
  • Claude Code / Agent Skill

如果主要用于 AI 编程,我更推荐 MCP + DeepSeek V4-Flash 这套组合。


DeepSeek Harness 安装教程:让 DeepSeek V4 更稳定地接入 MCP、Claude Code 与 AI 编程工具

一、安装前准备

至少需要:

  • Python 3
  • Node.js / npm
  • DeepSeek API Key
  • 一个支持 MCP 的 AI 客户端

项目已经明确支持或适配 Claude Desktop、Cline、Roo Code、ChatWise、Cherry Studio 等 MCP 客户端。

DeepSeek API Key 可以从 DeepSeek Platform 获取。DeepSeek 官方目前的 Agent 集成文档也已经围绕 V4-Pro 和 V4-Flash 展开。


二、最推荐:通过 MCP 安装 DeepSeek Harness

实际上不需要把整个项目下载下来。

只需要:

1
npx -y @deepseek-harness/mcp

项目当前提供的 MCP 包为:

1
@deepseek-harness/mcp

它通过标准 stdio MCP 协议运行。

然后在支持 MCP 的客户端配置中加入:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
  "mcpServers": {
    "deepseek-harness": {
      "command": "npx",
      "args": ["-y", "@deepseek-harness/mcp"],
      "env": {
        "DEEPSEEK_API_KEY": "你的 DeepSeek API Key"
      }
    }
  }
}

保存并重新启动客户端即可。

官方仓库给出的 MCP 配置也是这种方式。

DeepSeek Harness MCP 会提供几个主要工具:

1
2
3
4
deepseek_chat
deepseek_chat_stream
validate_message_history
estimate_cache_hit

其中后两个主要负责消息历史和缓存检查,本身不需要消耗 DeepSeek API 配额。


三、安装命令行版本

如果想先测试 DeepSeek Harness 是否能正常工作,可以安装 CLI:

1
pip install deepseek-harness-cli

Windows PowerShell 设置 API Key:

1
$env:DEEPSEEK_API_KEY="你的API Key"

Linux / macOS:

1
export DEEPSEEK_API_KEY="你的API Key"

然后运行:

1
dsh doctor

如果环境正常,就可以进入交互模式:

1
dsh chat

开启 Thinking:

1
dsh chat -r

还可以检查已有消息:

1
dsh validate messages.json

或者估算缓存命中:

1
dsh estimate messages.json

这些命令都来自项目当前 CLI 实现。


四、Python 项目安装

如果你正在开发自己的 Agent,可以直接安装 Python Library:

1
pip install deepseek-harness

简单测试:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
from deepseek_harness import DeepSeekHarness

client = DeepSeekHarness(
    disable_thinking_by_default=True
)

response = client.chat(
    model="deepseek-v4-pro",
    messages=[
        {
            "role": "user",
            "content": "Hello"
        }
    ],
    max_tokens=4096
)

print(response["message"]["content"])

Python 方式更适合:

  • 自己开发 AI Agent
  • FastAPI 后端
  • LangChain
  • LlamaIndex
  • 自动化程序
  • 企业内部 AI 系统

项目也将 Python Library 作为自定义 Agent 的推荐接入方式。


五、Claude Code 安装 Skill

DeepSeek Harness 本身还提供了一个 Claude Skill。

安装:

1
git clone https://github.com/HenryZ838978/deepseek-harness

然后复制:

1
cp -r deepseek-harness/packages/skill ~/.claude/skills/deepseek-harness

重新启动 Claude Code 后即可加载。

这个 Skill 主要让 Agent 理解 DeepSeek V4 的协议特性,包括:

  • Thinking / reasoning_content
  • Tool Calling
  • 消息历史
  • DeepSeek Prefix Cache
  • API 调用规则

项目提供的 Skill 中还包含 safe_init.py 和协议参考文件。

Windows 用户也可以把:

1
packages/skill

复制到:

1
C:\Users\你的用户名\.claude\skills\deepseek-harness

六、推荐搭配哪些插件?

DeepSeek Harness 本身更像一个“模型协议层”,真正提升 Agent 能力的还是 MCP 和 Skills

我比较推荐下面这套组合:

1. Context7

用途:

1
2
3
4
查询最新开发文档
框架 API
第三方库文档
代码示例

例如开发 Next.js、React、Python 时,可以减少模型使用旧 API 的情况。


2. Filesystem MCP

让 Agent:

1
2
3
4
读取文件
创建文件
修改代码
浏览项目目录

这是 AI 编程最基础的一类 MCP。

如果使用 Cline、Roo Code、Claude Code 等,本身已经拥有完整文件操作能力,就没必要重复安装。


3. Playwright MCP

适合 Web 项目。

可以让 Agent:

1
2
3
4
5
6
打开网页
点击按钮
填写表单
截图
检查页面
测试前端

对于 Codex / Claude Code / DeepSeek 做网站开发非常实用。


4. Git / GitHub

适合:

1
2
3
4
5
查看 Git diff
分析提交记录
管理 Issue
查看 PR
代码审查

如果 AI 经常帮你修改大型项目,Git 能让修改过程安全很多。


5. Sequential Thinking 类工具

适合复杂:

1
2
3
4
Bug 排查
系统架构
大型重构
复杂逻辑分析

不过 DeepSeek V4 本身已经具备 Thinking 能力,因此普通任务没有必要一直开启,否则可能增加 Token 消耗。


七、我更推荐的组合

如果主要目的是 使用 DeepSeek 做 AI 编程,可以这样搭:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
DeepSeek V4-Flash
DeepSeek Harness
Cline / Roo Code / Claude Code
MCP
├─ Context7
├─ Playwright
├─ GitHub
└─ 项目自身工具

日常写代码:

1
DeepSeek V4-Flash

复杂架构、疑难 Bug:

1
DeepSeek V4-Pro

这样通常比所有任务都直接跑 Pro 更合理。


DeepSeek Harness 值不值得安装?

如果只是:

1
2
3
简单聊天
普通 API 调用
单轮问答

其实没必要。

但如果你的场景是:

1
2
3
4
5
6
DeepSeek + Agent
DeepSeek + MCP
DeepSeek + Tool Calling
DeepSeek + AI 编程
长时间连续开发
多轮工具调用

DeepSeek Harness 就比较有价值。

因为它重点解决的不是“让 DeepSeek 变聪明”,而是让 DeepSeek V4 在 Agent 环境中的协议行为更加稳定。

需要特别注意的是:DeepSeek Harness 是社区项目,并非 DeepSeek 官方项目。

DeepSeek 官方目前另外维护了 awesome-deepseek-agent,里面已经收录 Claude Code、Codex、Cline、DeepSeek-TUI、ReasonixOpenCode、Qwen Code 等大量 DeepSeek Agent 集成教程,可以作为后续扩展参考。


GitHub 项目

DeepSeek Harness:

1
https://github.com/HenryZ838978/deepseek-harness

DeepSeek 官方 Agent 集成项目:

1
https://github.com/deepseek-ai/awesome-deepseek-agent

项目当前采用 MIT License。