DeepSeek MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@DeepSeek MCP ServerWrite a Python function to reverse a linked list"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
DeepSeek MCP Server
一个功能完整的 MCP (Model Context Protocol) 服务器,将 DeepSeek 的全部 AI 能力封装为标准 MCP 工具,可在 Claude Code、Cursor、Windsurf 等支持 MCP 的 AI 编辑器中直接调用。
核心特色:支持三种认证模式,无需 API Key 也能通过网页版账号免费使用 DeepSeek。
功能概览
6 个 MCP 工具
工具 | 说明 | API Key | 网页版 |
| 对话补全 — 代码生成、问答、翻译等 | ✅ | ✅ |
| 深度推理 (R1) — 返回完整推理过程和最终答案 | ✅ | ✅ |
| FIM 代码补全 — 根据代码前后缀生成中间代码 | ✅ | ✅(模拟) |
| 多轮对话 — 携带完整历史上下文 | ✅ | ✅ |
| 模型列表 — 查询当前可用模型 | ✅ | ✅ |
| 文件分析 — 上传文件让 DeepSeek 分析(网页版支持多文件) | ✅(文本/单文件) | ✅(原生上传/多文件) |
两种后端
后端 | 说明 |
官方 API ( | 使用 |
网页版 API ( | 逆向 |
Related MCP server: Deepseek MCP Server
快速开始
前置条件
Node.js >= 18.0.0
安装
git clone <repo-url>
cd deepseek-mcp-server
npm install
npm run build接入 Claude Code
选择以下任一认证模式配置即可。
三种认证模式
模式一:官方 API Key(推荐,功能最全)
从 platform.deepseek.com 获取 API Key。
{
"mcpServers": {
"deepseek": {
"type": "stdio",
"command": "node",
"args": ["D:/PycharmProjects/deepseek-mcp-server/dist/index.js"],
"env": {
"DEEPSEEK_API_KEY": "sk-your-api-key"
}
}
}
}模式二:网页版 User Token(免费,推荐)
无需 API Key,使用 chat.deepseek.com 的免费能力。
获取 Token:
F12 打开开发者工具
Application → Local Storage →
chat.deepseek.com找到
userToken,复制其value值
{
"mcpServers": {
"deepseek": {
"type": "stdio",
"command": "node",
"args": ["D:/PycharmProjects/deepseek-mcp-server/dist/index.js"],
"env": {
"DEEPSEEK_USER_TOKEN": "your-user-token-value"
}
}
}
}模式三:网页版 Email + Password(免费)
自动登录获取 Token。注意:部分账号可能因 WAF 防护导致登录失败,建议优先使用模式二。
{
"mcpServers": {
"deepseek": {
"type": "stdio",
"command": "node",
"args": ["D:/PycharmProjects/deepseek-mcp-server/dist/index.js"],
"env": {
"DEEPSEEK_EMAIL": "your-email@example.com",
"DEEPSEEK_PASSWORD": "your-password"
}
}
}
}环境变量
变量 | 必填 | 说明 |
| 三选一 | 官方 API Key |
| 三选一 | 网页版 User Token |
| 三选一 | 网页版登录账号密码 |
| 否 | 官方 API 地址,默认 |
| 否 | 网页版 API 地址,默认 |
| 否 | 请求超时(ms),默认 |
| 否 | 最大重试次数,默认 |
对话续接(session_key)
所有对话工具(deepseek_chat、deepseek_reasoner、deepseek_multi_turn)均支持通过 session_key 参数续接上一次对话,无需重复发送历史消息:
首次调用不传
session_key,返回结果中会包含一个session_key后续调用传入该
session_key,模型即可理解之前的完整上下文会话缓存有效期为 30 分钟,过期后自动清理
工作原理:
网页版模式:复用同一个
chat_session_id,通过parent_message_id链接消息链,DeepSeek 服务端自动维护上下文官方 API 模式:在服务端缓存完整的
messages历史数组,续接时自动追加并一起发送
# 第 1 轮
deepseek_chat({ message: "请记住:密码是 abc123" })
# → 返回 session_key: "xxx-xxx-xxx"
# 第 2 轮(续接)
deepseek_chat({ message: "密码是什么?", session_key: "xxx-xxx-xxx" })
# → "密码是 abc123"
# 第 3、4、5… 轮均可继续续接,支持任意多轮工具使用示例
对话补全
deepseek_chat({ message: "用 TypeScript 实现快速排序", temperature: 0.7 })深度推理
deepseek_reasoner({ message: "证明根号2是无理数", show_reasoning: true })代码补全
deepseek_fim({ prefix: "function add(a, b) {\n ", suffix: "\n}" })文件分析(单文件)
deepseek_file_analysis({
file_path: "D:/project/design-spec.md",
instruction: "请分析这份设计文档,指出需要改进的地方"
})文件分析(多文件,网页版模式)
deepseek_file_analysis({
file_paths: [
"D:/project/src/main.ts",
"D:/project/src/utils.ts",
"D:/project/src/types.ts"
],
instruction: "请对比分析这几个文件的代码质量和一致性"
})多文件限制(网页版模式): 最多 50 个文件,每个文件最大 100MB。API Key 模式仅支持单文件文本分析。
项目结构
deepseek-mcp-server/
├── src/
│ ├── index.ts # 入口文件,根据认证模式选择客户端
│ ├── config.ts # 配置管理(三种认证模式)
│ ├── client.ts # 官方 API 客户端(带重试、流式处理)
│ ├── web-client.ts # 网页版 API 客户端(PoW 挑战、SSE 解析、文件上传)
│ ├── session-store.ts # 会话缓存管理(session_key 续接)
│ ├── errors.ts # 统一错误处理
│ ├── types.ts # TypeScript 类型定义
│ ├── sha3_wasm_bg.wasm # PoW 挑战求解 WASM 模块
│ └── tools/
│ ├── index.ts # 工具注册入口
│ ├── chat.ts # deepseek_chat
│ ├── reasoner.ts # deepseek_reasoner
│ ├── fim.ts # deepseek_fim
│ ├── multi-turn.ts # deepseek_multi_turn
│ ├── models.ts # deepseek_list_models
│ └── file-analysis.ts # deepseek_file_analysis
├── docs/
│ ├── 01-需求说明文档.md
│ ├── 02-详细设计文档.md
│ └── 03-开发文档.md
├── package.json
├── tsconfig.json
└── .env.example技术实现
官方 API 模式
兼容 OpenAI 格式的标准 REST API
带指数退避的自动重试(429/500/502/503/504)
支持 SSE 流式响应
请求超时控制(AbortController)
网页版 API 模式
逆向
chat.deepseek.com内部 APIPoW 挑战求解:使用 DeepSeek 的 WASM 模块 (
DeepSeekHashV1算法) 自动求解 Proof-of-Work 防滥用挑战自定义 SSE 解析:网页版使用
{"p":"response/content","o":"APPEND","v":"文本"}格式,非标准 OpenAI SSE原生文件上传:通过
/api/v0/file/upload_file上传文件,获取file_id后关联到对话,支持多文件(最多 50 个,每个最大 100MB)
网页版对话完整流程
1. POST /api/v0/chat_session/create → 创建会话
2. POST /api/v0/chat/create_pow_challenge → 获取 PoW 挑战
3. WASM wasm_solve() → 求解 DeepSeekHashV1
4. POST /api/v0/file/upload_file (可选) → 上传文件
5. GET /api/v0/file/fetch_files (可选) → 轮询文件解析状态
6. POST /api/v0/chat/completion → 发送对话(SSE 流式返回)
Header: x-ds-pow-response (Base64 编码)
Body: { chat_session_id, prompt, ref_file_ids, thinking_enabled }开发
# 安装依赖
npm install
# 开发模式运行
DEEPSEEK_API_KEY=sk-xxx npm run dev
# 编译构建
npm run build
# 类型检查
npm run lint
# 使用 MCP Inspector 调试
DEEPSEEK_API_KEY=sk-xxx npx @modelcontextprotocol/inspector node dist/index.js注意事项
网页版模式使用
chat.deepseek.com的内部 API,非官方接口,可能随时变更网页版 FIM 代码补全为对话模拟实现,效果可能不如官方 API 原生 FIM 精准
网页版 User Token 有有效期,过期后需重新获取
每次网页版对话需求解 PoW 挑战,额外约 20-100ms 延迟
session_key会话缓存保存在内存中,MCP 服务器重启后失效(30 分钟 TTL)建议优先使用官方 API Key 以获得最佳稳定性和完整功能
许可证
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/booleamu/deepseek-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server