Skip to content

Commit

Permalink
feat(mcp): 实现 MCP客户端功能并集成到 NextChat
Browse files Browse the repository at this point in the history
- 新增 MCP 客户端模块,实现与 MCP服务器的连接和通信
- 在聊天组件中集成 MCP 功能,支持调用外部工具
- 添加 MCP 市场页面,展示可用的 MCP 客户端- 在全局配置中增加 MCP相关设置
- 优化 Dockerfile,支持 MCP 客户端运行
  • Loading branch information
kiritoko1029 committed Jan 20, 2025
2 parents 5fdb0de + b2b6fd8 commit d68a8b3
Show file tree
Hide file tree
Showing 29 changed files with 2,568 additions and 9,379 deletions.
5 changes: 5 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ CODE=your-password
# You can start service behind a proxy. (optional)
PROXY_URL=http://localhost:7890

# Enable MCP functionality (optional)
# Default: Empty (disabled)
# Set to "true" to enable MCP functionality
ENABLE_MCP=

# (optional)
# Default: Empty
# Google Gemini Pro API key, set if you want to use Google Gemini Pro API.
Expand Down
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
public/serviceWorker.js
public/serviceWorker.js
app/mcp/mcp_config.json
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,8 @@ dev
*.key.pub

masks.json
/websocket-server/node_modules

# mcp config
app/mcp/mcp_config.json

/websocket-server/node_modules
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,16 @@ ENV PROXY_URL=""
ENV OPENAI_API_KEY=""
ENV GOOGLE_API_KEY=""
ENV CODE=""
ENV ENABLE_MCP=""

COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/.next/server ./.next/server

RUN mkdir -p /app/app/mcp && chmod 777 /app/app/mcp
COPY --from=builder /app/app/mcp/mcp_config.json /app/app/mcp/

EXPOSE 3000

CMD if [ -n "$PROXY_URL" ]; then \
Expand All @@ -56,6 +61,7 @@ CMD if [ -n "$PROXY_URL" ]; then \
echo "localnet ::1/128" >> $conf; \
echo "[ProxyList]" >> $conf; \
echo "$protocol $host $port" >> $conf; \
cat /etc/proxychains.conf; \
proxychains -f $conf node server.js; \
else \
node server.js; \
Expand Down
16 changes: 15 additions & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<h1 align="center">NextChat</h1>

一键免费部署你的私人 ChatGPT 网页应用,支持 GPT3, GPT4 & Gemini Pro 模型。
一键免费部署你的私人 ChatGPT 网页应用,支持 Claude, GPT4 & Gemini Pro 模型。

[NextChatAI](https://nextchat.dev/chat?utm_source=readme) / [企业版](#%E4%BC%81%E4%B8%9A%E7%89%88) / [演示 Demo](https://chat-gpt-next-web.vercel.app/) / [反馈 Issues](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [加入 Discord](https://discord.gg/zrhvHCr79N)

Expand Down Expand Up @@ -262,6 +262,10 @@ Stability API密钥

自定义的Stability API请求地址

### `ENABLE_MCP` (optional)

启用MCP(Model Context Protocol)功能


## 开发

Expand Down Expand Up @@ -315,6 +319,16 @@ docker run -d -p 3000:3000 \
dogtititi/chatgpt-next-web-earlybird
```

如需启用 MCP 功能,可以使用:

```shell
docker run -d -p 3000:3000 \
-e OPENAI_API_KEY=sk-xxxx \
-e CODE=页面访问密码 \
-e ENABLE_MCP=true \
yidadaa/chatgpt-next-web
```

如果你的本地代理需要账号密码,可以使用:

```shell
Expand Down
Loading

0 comments on commit d68a8b3

Please sign in to comment.