mcp acees error with msg: #15555

Closed
opened 2026-02-21 19:22:17 -05:00 by yindo · 2 comments
Owner

Originally created by @miracletiger on GitHub (Jul 21, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.6.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

when access /tools?category=mcp , get crash page with error as flower:
Image
some web console error:
page-219ab42da211fc3b.js:4 Uncaught TypeError: eP(...)(...).locale(...).fromNow is not a function

✔️ Expected Behavior

mcp page acess ok

Actual Behavior

No response

Originally created by @miracletiger on GitHub (Jul 21, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.6.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce when access /tools?category=mcp , get crash page with error as flower: <img width="1513" height="769" alt="Image" src="https://github.com/user-attachments/assets/c6f37621-be25-41b6-af96-84eca4177905" /> some web console error: page-219ab42da211fc3b.js:4 Uncaught TypeError: eP(...)(...).locale(...).fromNow is not a function ### ✔️ Expected Behavior mcp page acess ok ### ❌ Actual Behavior _No response_
yindo closed this issue 2026-02-21 19:22:17 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jul 21, 2025):

The error happens because the dayjs 'relativeTime' plugin isn't initialized in the MCP frontend code, so calling .fromNow() fails. To fix this, import and extend the plugin before any .fromNow() usage. You can do this either globally (recommended for consistency) or locally in the MCP-related files.

Example for local fix (add at the top of any MCP component or hook that uses .fromNow()):

import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime'
dayjs.extend(relativeTime)

This should be done before any code that calls dayjs().fromNow() or similar. For a more robust solution, consider initializing the plugin in a global setup file or your main app entry point so all components have access to it without repeating the import/extend logic. This approach is used in other Dify frontend components and avoids similar bugs elsewhere in the app.

More details and examples can be found in other components that use dayjs with 'relativeTime' correctly, such as the app publisher and members page components (example).

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Jul 21, 2025): <!-- Answer --> The error happens because the dayjs 'relativeTime' plugin isn't initialized in the MCP frontend code, so calling `.fromNow()` fails. To fix this, import and extend the plugin before any `.fromNow()` usage. You can do this either globally (recommended for consistency) or locally in the MCP-related files. **Example for local fix (add at the top of any MCP component or hook that uses `.fromNow()`):** ```js import dayjs from 'dayjs' import relativeTime from 'dayjs/plugin/relativeTime' dayjs.extend(relativeTime) ``` This should be done before any code that calls `dayjs().fromNow()` or similar. For a more robust solution, consider initializing the plugin in a global setup file or your main app entry point so all components have access to it without repeating the import/extend logic. This approach is used in other Dify frontend components and avoids similar bugs elsewhere in the app. More details and examples can be found in other components that use dayjs with 'relativeTime' correctly, such as the app publisher and members page components [(example)](https://github.com/langgenius/dify/blob/c2c69ffb826fc28dbb825ed18010aba7372c8dbf/web/app/components/app/app-publisher/index.tsx). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/bc5aab74-3e68-4dc8-ad58-59ad0c34918c?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/bc5aab74-3e68-4dc8-ad58-59ad0c34918c?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/bc5aab74-3e68-4dc8-ad58-59ad0c34918c?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/bc5aab74-3e68-4dc8-ad58-59ad0c34918c?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/bc5aab74-3e68-4dc8-ad58-59ad0c34918c?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/bc5aab74-3e68-4dc8-ad58-59ad0c34918c?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/bc5aab74-3e68-4dc8-ad58-59ad0c34918c?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/22762)
Author
Owner

@miracletiger commented on GitHub (Jul 22, 2025):

Image the error is caused by this api
@miracletiger commented on GitHub (Jul 22, 2025): <img width="456" height="204" alt="Image" src="https://github.com/user-attachments/assets/c0ae5836-b048-44de-975f-1c2e4874276c" /> the error is caused by this api
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#15555