[PR #530] fix: patch mint-mcp to resolve 'Cannot read properties of undefined' error & add MCP integration #557

Open
opened 2026-02-16 06:15:50 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langgenius/dify-docs/pull/530
Author: @caapap
Created: 11/20/2025
Status: 🔄 Open

Base: mainHead: main


📝 Commits (1)

  • 8f60dc8 fix: add MCP integration and patch mint-mcp tool issue

📊 Changes

4 files changed (+10593 additions, -0 deletions)

View changed files

📝 docs.json (+3 -0)
package-lock.json (+10547 -0)
package.json (+27 -0)
patches/@mintlify+mcp+1.1.216.patch (+16 -0)

📄 Description

What does this PR do?

This PR fixes a critical issue preventing the setup of the MCP (Model Context Protocol) server for Dify documentation. It also adds the necessary MCP configuration to docs.json.

Problem

When running npx mint-mcp add dify-6c0370d8, the installation fails with:

TypeError: Cannot read properties of undefined (reading 'name')

This is caused by a data structure mismatch in the deprecated mint-mcp package where it expects a nested tool.tool object, but the API returns a flat tool object.

Changes

  1. docs.json: Added integrations.mcp configuration pointing to dify-6c0370d8.
  2. patches/@mintlify+mcp+1.1.216.patch: Added a patch file using patch-package to fix the cli-config.js in @mintlify/mcp. This allows the tool to correctly parse the API response by handling both nested and flat tool object structures.
  3. package.json: Added patch-package dependency and postinstall script to ensure the patch is applied automatically after npm install.

How to verify

  1. Run npm install
  2. Run npx mint-mcp add dify-6c0370d8
  3. Verify that the installation succeeds and the MCP server is created at ~/.mcp/dify-6c0370d8

Technical Details

The fix modifies node_modules/@mintlify/mcp/bin/utils/cli-config.js in the initializeToolsFromConfig function to handle both data structures:

// Before: tool.tool.name (fails when tool is flat)
// After: (tool.tool || tool).name (handles both cases)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langgenius/dify-docs/pull/530 **Author:** [@caapap](https://github.com/caapap) **Created:** 11/20/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (1) - [`8f60dc8`](https://github.com/langgenius/dify-docs/commit/8f60dc8d25ce70ef6277e8ee6c612bfcc3fd122e) fix: add MCP integration and patch mint-mcp tool issue ### 📊 Changes **4 files changed** (+10593 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs.json` (+3 -0) ➕ `package-lock.json` (+10547 -0) ➕ `package.json` (+27 -0) ➕ `patches/@mintlify+mcp+1.1.216.patch` (+16 -0) </details> ### 📄 Description ## What does this PR do? This PR fixes a critical issue preventing the setup of the MCP (Model Context Protocol) server for Dify documentation. It also adds the necessary MCP configuration to `docs.json`. ## Problem When running `npx mint-mcp add dify-6c0370d8`, the installation fails with: ``` TypeError: Cannot read properties of undefined (reading 'name') ``` This is caused by a data structure mismatch in the deprecated `mint-mcp` package where it expects a nested `tool.tool` object, but the API returns a flat `tool` object. ## Changes 1. **`docs.json`**: Added `integrations.mcp` configuration pointing to `dify-6c0370d8`. 2. **`patches/@mintlify+mcp+1.1.216.patch`**: Added a patch file using `patch-package` to fix the `cli-config.js` in `@mintlify/mcp`. This allows the tool to correctly parse the API response by handling both nested and flat tool object structures. 3. **`package.json`**: Added `patch-package` dependency and `postinstall` script to ensure the patch is applied automatically after `npm install`. ## How to verify 1. Run `npm install` 2. Run `npx mint-mcp add dify-6c0370d8` 3. Verify that the installation succeeds and the MCP server is created at `~/.mcp/dify-6c0370d8` ## Technical Details The fix modifies `node_modules/@mintlify/mcp/bin/utils/cli-config.js` in the `initializeToolsFromConfig` function to handle both data structures: ```javascript // Before: tool.tool.name (fails when tool is flat) // After: (tool.tool || tool).name (handles both cases) ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 06:15:50 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-docs#557