Skip to content

Commit c25e351

Browse files
fix(mcp): fix MCP infinite loading issue (#220)
Co-authored-by: choi sung keun <86150470+cgoinglove@users.noreply.github.com> Co-authored-by: cgoing <neo.cgoing@gmail.com>
1 parent c34861e commit c25e351

35 files changed

+1921
-1323
lines changed

.env.example

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,21 @@ BETTER_AUTH_URL=
2121
# If you don't have PostgreSQL running locally, start it with: pnpm docker:pg
2222
POSTGRES_URL=postgres://your_username:your_password@localhost:5432/your_database_name
2323

24+
# (Optional)
25+
# When running multiple server instances (load balancing, clustering):
26+
# - With Redis: Real-time MCP synchronization + reduced polling
27+
# - Without Redis: Polling-only synchronization (single instance or dev mode)
28+
# redis://localhost:6379
29+
REDIS_URL=
30+
31+
2432
# (Optional)
2533
# === Tools ===
2634
# Exa AI for web search and content extraction (optional, but recommended for @web and research features)
2735
EXA_API_KEY=
2836

2937

38+
# (Optional)
3039
# Whether to use file-based MCP config (default: false)
3140
FILE_BASED_MCP_CONFIG=false
3241

@@ -53,12 +62,14 @@ MICROSOFT_TENANT_ID=
5362
# Set to 1 to force account selection
5463
MICROSOFT_FORCE_ACCOUNT_SELECTION=
5564

56-
65+
# (Optional)
5766
# Set this to 1 to disable email sign in
5867
DISABLE_EMAIL_SIGN_IN=
5968

69+
# (Optional)
6070
# Set this to 1 to disable user sign-ups.
6171
DISABLE_SIGN_UP=
6272

73+
# (Optional)
6374
# Set this to 1 to disallow adding MCP servers.
6475
NOT_ALLOW_ADD_MCP_SERVERS=

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
[![Local First](https://img.shields.io/badge/Local-First-blue)](https://localfirstweb.dev/)
55
[![Discord](https://img.shields.io/discord/1374047276074537103?label=Discord&logo=discord&color=5865F2)](https://discord.gg/gCRu69Upnp)
66

7-
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/cgoinglove/better-chatbot&env=BETTER_AUTH_SECRET&env=OPENAI_API_KEY&env=GOOGLE_GENERATIVE_AI_API_KEY&env=ANTHROPIC_API_KEY&envDescription=Learn+more+about+how+to+get+the+API+Keys+for+the+application&envLink=https://github.com/cgoinglove/better-chatbot/blob/main/.env.example&demo-title=better-chatbot&demo-description=An+Open-Source+Chatbot+Template+Built+With+Next.js+and+the+AI+SDK+by+Vercel.&products=[{"type":"integration","protocol":"storage","productSlug":"neon","integrationSlug":"neon"}])
7+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/cgoinglove/better-chatbot&env=BETTER_AUTH_SECRET&env=OPENAI_API_KEY&env=GOOGLE_GENERATIVE_AI_API_KEY&env=ANTHROPIC_API_KEY&envDescription=BETTER_AUTH_SECRET+is+required+(enter+any+secret+value).+At+least+one+LLM+provider+API+key+(OpenAI,+Claude,+or+Google)+is+required,+but+you+can+add+all+of+them.+See+the+link+below+for+details.&envLink=https://github.com/cgoinglove/better-chatbot/blob/main/.env.example&demo-title=better-chatbot&demo-description=An+Open-Source+Chatbot+Template+Built+With+Next.js+and+the+AI+SDK+by+Vercel.&products=[{"type":"integration","protocol":"storage","productSlug":"neon","integrationSlug":"neon"},{"type":"integration","protocol":"storage","productSlug":"upstash-kv","integrationSlug":"upstash"}])
88

9-
Our goal is to create the best possible chatbot UX — focusing on the joy and intuitiveness users feel when calling and interacting with AI tools.
109

1110
See the experience in action in the [preview](#preview) below!
1211

@@ -63,20 +62,21 @@ Open [http://localhost:3000](http://localhost:3000) in your browser to get start
6362
- [🛠️ Default Tools](#️-default-tools)
6463
- [🌐 Web Search](#-web-search)
6564
- [⚡️ JS Executor](#️-js-executor)
65+
- [📊 Data Visualization Tools](#-data-visualization-tools)
6666
- [Getting Started](#getting-started)
6767
- [Quick Start (Docker Compose Version) 🐳](#quick-start-docker-compose-version-)
6868
- [Quick Start (Local Version) 🚀](#quick-start-local-version-)
6969
- [Environment Variables](#environment-variables)
7070
- [📘 Guides](#-guides)
71-
- [🔌 MCP Server Setup \& Tool Testing](#-mcp-server-setup--tool-testing)
72-
- [🐳 Docker Hosting Guide](#-docker-hosting-guide)
73-
- [▲ Vercel Hosting Guide](#-vercel-hosting-guide)
74-
- [🎯 System Prompts \& Chat Customization](#-system-prompts--chat-customization)
75-
- [🔐 OAuth Sign-In Setup](#-oauth-sign-in-setup)
76-
- [🕵🏿 Adding openAI like providers](#-adding-openai-like-providers)
71+
- [🔌 MCP Server Setup \& Tool Testing](#-mcp-server-setup--tool-testing)
72+
- [🐳 Docker Hosting Guide](#-docker-hosting-guide)
73+
- [▲ Vercel Hosting Guide](#-vercel-hosting-guide)
74+
- [🎯 System Prompts \& Chat Customization](#-system-prompts--chat-customization)
75+
- [🔐 OAuth Sign-In Setup](#-oauth-sign-in-setup)
76+
- [🕵🏿 Adding openAI like providers](#-adding-openai-like-providers)
7777
- [💡 Tips](#-tips)
78-
- [🧠 Agentic Chatbot with Project Instructions](#-agentic-chatbot-with-project-instructions)
79-
- [💬 Temporary Chat Windows](#-temporary-chat-windows)
78+
- [🧠 Agentic Chatbot with Project Instructions](#-agentic-chatbot-with-project-instructions)
79+
- [💬 Temporary Chat Windows](#-temporary-chat-windows)
8080
- [🗺️ Roadmap](#️-roadmap)
8181
- [🙌 Contributing](#-contributing)
8282
- [💬 Join Our Discord](#-join-our-discord)

docs/tips-guides/vercel.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# Vercel Deployment Guide
22

33
1. **Click this button** to start the deployment process:
4-
5-
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/cgoinglove/better-chatbot&env=OPENAI_API_KEY&env=BETTER_AUTH_SECRET&envDescription=Learn+more+about+how+to+get+the+API+Keys+for+the+application&envLink=https://github.com/cgoinglove/better-chatbot/blob/main/.env.example&demo-title=better-chatbot&demo-description=An+Open-Source+Chatbot+Template+Built+With+Next.js+and+the+AI+SDK+by+Vercel.&products=[{"type":"integration","protocol":"storage","productSlug":"neon","integrationSlug":"neon"}])
4+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/cgoinglove/better-chatbot&env=BETTER_AUTH_SECRET&env=OPENAI_API_KEY&env=GOOGLE_GENERATIVE_AI_API_KEY&env=ANTHROPIC_API_KEY&envDescription=BETTER_AUTH_SECRET+is+required+(enter+any+secret+value).+At+least+one+LLM+provider+API+key+(OpenAI,+Claude,+or+Google)+is+required,+but+you+can+add+all+of+them.+See+the+link+below+for+details.&envLink=https://github.com/cgoinglove/better-chatbot/blob/main/.env.example&demo-title=better-chatbot&demo-description=An+Open-Source+Chatbot+Template+Built+With+Next.js+and+the+AI+SDK+by+Vercel.&products=[{"type":"integration","protocol":"storage","productSlug":"neon","integrationSlug":"neon"},{"type":"integration","protocol":"storage","productSlug":"upstash-kv","integrationSlug":"upstash"}])
65

76
2. **Click the "Create" button** on Vercel to begin setting up your project.
87

messages/en.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
"youAreAnExpertIn": "You are an expert in {role}"
4545
},
4646
"Error": {},
47+
"Info": {
48+
"mcpAddingDisabled": "MCP server addition has been disabled by the administrator.",
49+
"vercelSyncDelay": "Running on Vercel\n\nMCP changes may take 10-15 seconds to sync. Please wait a moment after adding, editing, or deleting servers if changes don't appear immediately."
50+
},
4751
"Workflow": {
4852
"title": "Workflow",
4953
"createWorkflow": "Create Workflow",

messages/es.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,10 @@
321321
"mcpServerCustomizationPlaceholder": "ej. Si el valor de entrada es email, siempre ingresa el email en el formato ejemplo@ejemplo.com."
322322
},
323323
"Error": {},
324+
"Info": {
325+
"mcpAddingDisabled": "La adición de servidores MCP ha sido deshabilitada por el administrador.",
326+
"vercelSyncDelay": "Ejecutándose en Vercel\n\nLos cambios de MCP pueden tardar 10-15 segundos en sincronizarse. Por favor espera un momento si los cambios no aparecen inmediatamente después de agregar, editar o eliminar servidores."
327+
},
324328
"Workflow": {
325329
"title": "Flujo de Trabajo",
326330
"createWorkflow": "Crear Flujo de Trabajo",

messages/fr.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,10 @@
321321
"mcpServerCustomizationPlaceholder": "ex. Si la valeur d'entrée est un email, toujours entrer l'email au format exemple@exemple.com."
322322
},
323323
"Error": {},
324+
"Info": {
325+
"mcpAddingDisabled": "L'ajout de serveurs MCP a été désactivé par l'administrateur.",
326+
"vercelSyncDelay": "Fonctionnement sur Vercel\n\nLes modifications MCP peuvent prendre 10-15 secondes à se synchroniser. Veuillez patienter un moment si les changements n'apparaissent pas immédiatement après avoir ajouté, modifié ou supprimé des serveurs."
327+
},
324328
"Workflow": {
325329
"title": "Flux de Travail",
326330
"createWorkflow": "Créer Flux de Travail",

messages/ja.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,10 @@
320320
"mcpServerCustomizationPlaceholder": "例:入力値がメールの場合、常にexample@example.comの形式でメールを入力してください。"
321321
},
322322
"Error": {},
323+
"Info": {
324+
"mcpAddingDisabled": "管理者によりMCPサーバーの追加が無効化されています。",
325+
"vercelSyncDelay": "Vercel上で動作中\n\nMCP変更の同期には10-15秒かかる場合があります。サーバーの追加、編集、または削除後に変更が即座に表示されない場合は、しばらくお待ちください。"
326+
},
323327
"Workflow": {
324328
"title": "ワークフロー",
325329
"createWorkflow": "ワークフローを作成",

messages/ko.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,10 @@
321321
"mcpServerCustomizationPlaceholder": "예) 이 MCP 서버의 툴중에 입력값이 email인 경우 항상 example@example.com 형식으로 입력해주세요."
322322
},
323323
"Error": {},
324+
"Info": {
325+
"mcpAddingDisabled": "관리자에 의해 MCP 서버 추가가 비활성화되었습니다.",
326+
"vercelSyncDelay": "Vercel에서 실행 중\n\nMCP 변경사항은 동기화에 10-15초 정도 소요될 수 있습니다. 서버 추가, 편집 또는 삭제 후 변경사항이 즉시 보이지 않으면 잠시 기다려주세요."
327+
},
324328
"Workflow": {
325329
"title": "워크플로우",
326330
"createWorkflow": "워크플로우 생성",

messages/zh.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,10 @@
322322
"mcpServerCustomizationPlaceholder": "例如:如果输入值是电子邮件,始终以 example@example.com 格式输入电子邮件。"
323323
},
324324
"Error": {},
325+
"Info": {
326+
"mcpAddingDisabled": "管理员已禁用MCP服务器添加功能。",
327+
"vercelSyncDelay": "在Vercel上运行\n\nMCP更改同步可能需要10-15秒。如果添加、编辑或删除服务器后更改未立即显示,请稍等片刻。"
328+
},
325329
"Workflow": {
326330
"title": "工作流",
327331
"createWorkflow": "创建工作流",

package.json

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"docker-compose:ps": "docker-compose -f docker/compose.yml ps",
3636
"docker-compose:update": "git pull && docker-compose -f docker/compose.yml up -d --build",
3737
"docker:pg": "docker run --name better-chatbot-pg -e POSTGRES_PASSWORD=your_password -e POSTGRES_USER=your_username -e POSTGRES_DB=your_database_name -p 5432:5432 -d postgres",
38+
"docker:redis": "docker run --name better-chatbot-redis -p 6379:6379 -d redis:7-alpine",
3839
"docker:app": "docker build -f docker/Dockerfile -t better-chatbot . && docker run -p 3000:3000 -e NO_HTTPS=1 better-chatbot",
3940
"prepare": "husky",
4041
"check": "pnpm lint:fix && pnpm check-types && pnpm test"
@@ -46,7 +47,7 @@
4647
"@ai-sdk/openai-compatible": "^0.2.16",
4748
"@ai-sdk/react": "^1.2.12",
4849
"@ai-sdk/xai": "^1.2.18",
49-
"@modelcontextprotocol/sdk": "^1.17.0",
50+
"@modelcontextprotocol/sdk": "^1.17.1",
5051
"@openrouter/ai-sdk-provider": "^0.4.6",
5152
"@radix-ui/react-accordion": "^1.2.11",
5253
"@radix-ui/react-avatar": "^1.1.10",
@@ -84,8 +85,9 @@
8485
"dotenv": "^16.6.1",
8586
"drizzle-orm": "^0.41.0",
8687
"emoji-picker-react": "^4.13.2",
87-
"framer-motion": "^12.23.10",
88+
"framer-motion": "^12.23.12",
8889
"hast-util-to-jsx-runtime": "^2.3.6",
90+
"ioredis": "^5.7.0",
8991
"json-schema": "^0.4.0",
9092
"lucide-react": "^0.486.0",
9193
"mermaid": "^11.9.0",
@@ -96,42 +98,42 @@
9698
"ogl": "^1.0.11",
9799
"ollama-ai-provider": "^1.2.0",
98100
"pg": "^8.16.3",
99-
"react": "^19.1.0",
100-
"react-dom": "^19.1.0",
101+
"react": "^19.1.1",
102+
"react-dom": "^19.1.1",
101103
"react-markdown": "^10.1.0",
102104
"react-resizable-panels": "^2.1.9",
103105
"recharts": "^2.15.4",
104106
"remark-gfm": "^4.0.1",
105107
"server-only": "^0.0.1",
106-
"shiki": "^3.8.1",
107-
"sonner": "^2.0.6",
108+
"shiki": "^3.9.2",
109+
"sonner": "^2.0.7",
108110
"swr": "^2.3.4",
109111
"tailwind-merge": "^3.3.1",
110112
"ts-edge": "^1.0.4",
111113
"ts-safe": "^0.0.5",
112114
"tw-animate-css": "^1.3.6",
113115
"vaul": "^1.1.2",
114116
"zod": "^3.25.76",
115-
"zustand": "^5.0.6"
117+
"zustand": "^5.0.7"
116118
},
117119
"devDependencies": {
118120
"@biomejs/biome": "1.9.4",
119121
"@tailwindcss/postcss": "^4.1.11",
120122
"@types/json-schema": "^7.0.15",
121123
"@types/node": "^20.19.9",
122-
"@types/pg": "^8.15.4",
123-
"@types/react": "^19.1.8",
124-
"@types/react-dom": "^19.1.6",
124+
"@types/pg": "^8.15.5",
125+
"@types/react": "^19.1.9",
126+
"@types/react-dom": "^19.1.7",
125127
"cross-env": "^7.0.3",
126128
"drizzle-kit": "^0.30.6",
127129
"eslint": "^9.32.0",
128130
"eslint-config-next": "15.3.0",
129131
"husky": "^9.1.7",
130-
"lint-staged": "^16.1.2",
132+
"lint-staged": "^16.1.4",
131133
"rimraf": "^6.0.1",
132134
"tailwindcss": "^4.1.11",
133135
"tsx": "^4.20.3",
134-
"typescript": "^5.8.3",
136+
"typescript": "^5.9.2",
135137
"vite-tsconfig-paths": "^5.1.4",
136138
"vitest": "^3.2.4"
137139
},

0 commit comments

Comments
 (0)