mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-11 19:26:52 +08:00
feat: add ENABLE_MCP env var to toggle MCP feature globally and in Docker
This commit is contained in:
@@ -122,7 +122,7 @@ import { isEmpty } from "lodash-es";
|
||||
import { getModelProvider } from "../utils/model";
|
||||
import { RealtimeChat } from "@/app/components/realtime-chat";
|
||||
import clsx from "clsx";
|
||||
import { getAvailableClientsCount } from "../mcp/actions";
|
||||
import { getAvailableClientsCount, isMcpEnabled } from "../mcp/actions";
|
||||
|
||||
const localStorage = safeLocalStorage();
|
||||
|
||||
@@ -135,15 +135,22 @@ const Markdown = dynamic(async () => (await import("./markdown")).Markdown, {
|
||||
const MCPAction = () => {
|
||||
const navigate = useNavigate();
|
||||
const [count, setCount] = useState<number>(0);
|
||||
const [mcpEnabled, setMcpEnabled] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const loadCount = async () => {
|
||||
const count = await getAvailableClientsCount();
|
||||
setCount(count);
|
||||
const checkMcpStatus = async () => {
|
||||
const enabled = await isMcpEnabled();
|
||||
setMcpEnabled(enabled);
|
||||
if (enabled) {
|
||||
const count = await getAvailableClientsCount();
|
||||
setCount(count);
|
||||
}
|
||||
};
|
||||
loadCount();
|
||||
checkMcpStatus();
|
||||
}, []);
|
||||
|
||||
if (!mcpEnabled) return null;
|
||||
|
||||
return (
|
||||
<ChatAction
|
||||
onClick={() => navigate(Path.McpMarket)}
|
||||
|
Reference in New Issue
Block a user