高中生

- 金币
- 1772
- 好评
- 0
- 信誉
- 100
|
本帖最后由 sidesand 于 2026-7-28 23:39 编辑
# DeepSeek++ + MT 管理器 MCP 服务配置教程(Termux + Nginx)
部分deepseek++设置图片参照DeepSeek++ ,新手食用教程,说清楚大佬的模糊回答
本教程适用于 **已 Root 的安卓手机**,通过 Termux 运行 Nginx 反向代理,让 DeepSeek++ 浏览器插件能够连接到 MT 管理器的 MCP 服务。
---
## 一、整体流程概览
```
1. 安装quetta浏览器,或者能够安装Chrome拓展的浏览器,安装 DeepSeek++ 插件(浏览器)
2. 手机安装 Termux 和 Nginx
3. MT 管理器开启 MCP 服务
4. 配置 Nginx 反向代理
5. 启动 Nginx 并验证
6. DeepSeek++ 插件中配置服务 URL
```
---
## 二、详细步骤
### 1. 安装 DeepSeek++ 插件
在quetta浏览器中安装 DeepSeek++ 插件:
- **Chrome 商店地址**:https://chromewebstore.google.co ... ikgcocbpbf?hl=zh-CN
- 如果无法访问,自行搜索其他下载方式(如 .crx 离线安装包)
---
### 2. 手机准备(已 Root)
打开 Termux,更新并安装 Nginx:
```bash
pkg update && pkg upgrade -y
pkg install nginx -y
```
**注意**:如果 Termux 未安装,请先从 F-Droid 或 GitHub 下载安装。
---
### 3. MT 管理器开启 MCP 服务
1. 打开 MT 管理器
2. 进入设置 → 找到 **MCP 服务** 选项
3. 开启 MCP 服务开关
4. 确认通知栏或设置页显示服务已启动(默认端口为 `8787`)
---
### 4. 配置 Nginx 反向代理
编辑 Nginx 配置文件:
```bash
nano /data/data/com.termux/files/usr/etc/nginx/nginx.conf
```
**将原文件内容全部替换为以下配置**(复制粘贴即可):
```nginx
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 9999;
server_name localhost;
#access_log logs/host.access.log main;
# ========== MCP 服务反向代理 ==========
location /mcp {
# 转发到 MT 管理器的 MCP 服务
proxy_pass http://127.0.0.1:8787;
# 关键:清除 Origin 和 Referer 头,解决跨域问题
proxy_set_header Origin "";
proxy_set_header Referer "";
# 传递其他必要的头
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# HTTP 1.1 支持
proxy_http_version 1.1;
proxy_buffering off;
# 超时设置
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
}
# ========================================
location / {
root /data/data/com.termux/files/usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /data/data/com.termux/files/usr/share/nginx/html;
}
}
}
```
**保存并退出**:`Ctrl+O` 保存,`Ctrl+X` 退出。
---
### 5. 启动 Nginx
在 Termux 中执行(**普通用户权限,不要用 su**):
```bash
nginx
```
**如果没有报错,说明启动成功!**
---
### 6. 常见启动报错及解决
| 报错信息 | 原因 | 解决方法 |
|----------|------|----------|
| `bind() to 0.0.0.0:9999 failed (98: Address already in use)` | 端口被占用 | 执行 `pkill -9 nginx` 杀掉旧进程,再执行 `nginx` |
| `nginx: command not found` | Nginx 未安装 | 执行 `pkg install nginx -y` |
| `Permission denied` | 权限不足 | 确保在普通用户下执行,不要用 `su` |
**端口被占用的完整处理流程**:
```bash
pkill -9 nginx
nginx
```
---
### 7. 验证代理是否正常工作
执行以下命令测试:
```bash
curl -v http://localhost:9999/mcp
```
**预期结果**:
- 如果返回内容(哪怕是错误信息或 HTML),说明代理正常运行
- 如果返回 `Connection refused`,说明 Nginx 未正常启动
---
## 三、配置 DeepSeek++ 插件
1. 打开浏览器中的 DeepSeek++ 插件
2. 进入 MCP 服务配置页面
3. **服务 URL** 填写:
```
http://localhost:9999/mcp
```
4. 点击 **授权** 或 **保存**
5. 点击 **测试** 或 **刷新** 按钮
6. 确认状态显示为绿色 **"Ready"** 字样
---
## 四、最终效果
配置完成后,DeepSeek++ 插件可以通过 MCP 协议与 MT 管理器交互,实现文件管理、APK 操作等功能。
---
## 五、常见问题汇总
### Q1:启动 Nginx 报端口被占用,但 `pkill -9 nginx` 没用?
可能是以 root 身份启动的 Nginx 残留。执行:
```bash
su -c "pkill -9 nginx"
nginx
```
### Q2:curl 测试返回 502 Bad Gateway?
说明 Nginx 已启动,但无法连接到 MT 管理器的 MCP 服务。检查:
- MT 管理器是否开启了 MCP 服务
- MT 管理器的端口是否是 `8787`
- 用 `netstat -tlnp | grep 8787` 确认服务正在监听
### Q3:插件测试显示红色错误?
- 确认 URL 是否正确:`http://localhost:9999/mcp`
- 确认 Nginx 是否正在运行:`ps aux | grep nginx`
- 确认防火墙未拦截 9999 端口(手机默认无防火墙)
### Q4:MT 管理器显示的是局域网 IP,不是 127.0.0.1?
如果 `netstat -tlnp | grep 8787` 显示的是 `[::]:8787`(IPv6 全监听),则 `127.0.0.1` 可用。如果显示具体 IP(如 `192.168.1.100:8787`),则将配置中的 `proxy_pass http://127.0.0.1:8787;` 改为 `proxy_pass http://192.168.1.100:8787;`。
---
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|