Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support MCP( WIP) #5974

Merged
merged 31 commits into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e1c7c54
chore: change md
Leizhenpeng Dec 23, 2024
c3108ad
feat: simple MCP example
Kadxy Dec 28, 2024
664879b
feat: Create all MCP Servers at startup
Kadxy Dec 28, 2024
e1ba8f1
feat: Send MCP response as a user
Kadxy Dec 29, 2024
fe67f79
feat: MCP message type
Kadxy Dec 29, 2024
77be190
feat: carry mcp primitives content as a system prompt
Kadxy Jan 9, 2025
f2a2b40
feat: carry mcp primitives content as a system prompt
Kadxy Jan 9, 2025
0c14ce6
fix: MCP execution content matching failed.
Kadxy Jan 9, 2025
7d51bfd
feat: MCP market
Kadxy Jan 9, 2025
b410ec3
feat: auto scroll to bottom when MCP response
Kadxy Jan 9, 2025
125a71f
fix: unnecessary initialization
Kadxy Jan 9, 2025
e95c94d
fix: inaccurate content
Kadxy Jan 9, 2025
a3af563
feat: Reset mcp_config.json to empty
Kadxy Jan 9, 2025
ce13cf6
feat: ignore mcp_config.json
Kadxy Jan 9, 2025
8aa9a50
feat: Optimize MCP configuration logic
Kadxy Jan 15, 2025
a70e9a3
chore:update mcp icon
Leizhenpeng Jan 15, 2025
be59de5
feat: Display the number of clients instead of the number of availabl…
Kadxy Jan 15, 2025
ac3d940
Merge branch 'feat-mcp' of https://github.com/ChatGPTNextWeb/ChatGPT-…
Leizhenpeng Jan 15, 2025
c89e488
chore: update icon
Leizhenpeng Jan 15, 2025
e440ff5
fix: env not work
Kadxy Jan 15, 2025
07c6349
feat: support stop/start MCP servers
Kadxy Jan 16, 2025
4d63d73
feat: load MCP preset data from server
Kadxy Jan 16, 2025
d4f499e
feat: adjust form style
Kadxy Jan 16, 2025
588d81e
feat: remove unused files
Kadxy Jan 16, 2025
4d535b1
chore: enhance mcp prompt
Leizhenpeng Jan 16, 2025
65810d9
feat: improve async operations and UI feedback
Kadxy Jan 16, 2025
0112b54
fix: missing en translation
Kadxy Jan 16, 2025
bc71ae2
feat: add ENABLE_MCP env var to toggle MCP feature globally and in Do…
Kadxy Jan 18, 2025
bfeea4e
fix: prevent MCP operations from blocking chat interface
Kadxy Jan 18, 2025
611e97e
docs: update README.md
Kadxy Jan 19, 2025
a3d3ce3
Merge branch 'main' into feat-mcp
Kadxy Jan 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ dev
*.key.pub

masks.json

# mcp config
app/mcp/mcp_config.json
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +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 link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Restrict directory permissions for security.

Setting 777 permissions (read, write, execute for all users) on the /app/app/mcp directory is too permissive and poses a security risk. Consider using more restrictive permissions.

Apply this diff to use more restrictive permissions:

-RUN mkdir -p /app/app/mcp && chmod 777 /app/app/mcp
+RUN mkdir -p /app/app/mcp && chown node:node /app/app/mcp && chmod 755 /app/app/mcp
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
RUN mkdir -p /app/app/mcp && chmod 777 /app/app/mcp
RUN mkdir -p /app/app/mcp && chown node:node /app/app/mcp && chmod 755 /app/app/mcp

COPY --from=builder /app/app/mcp/mcp_config.json /app/app/mcp/

EXPOSE 3000

CMD if [ -n "$PROXY_URL" ]; then \
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 \
yidadaa/chatgpt-next-web
```

如需启用 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
Loading