Skip to content

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

Closed
caapap wants to merge 1 commit intolanggenius:mainfrom
caapap:main
Closed

fix: patch mint-mcp to resolve 'Cannot read properties of undefined' error & add MCP integration#530
caapap wants to merge 1 commit intolanggenius:mainfrom
caapap:main

Conversation

@caapap
Copy link
Copy Markdown

@caapap caapap commented Nov 20, 2025

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)

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Nov 20, 2025
@RiskeyL
Copy link
Copy Markdown
Contributor

RiskeyL commented Mar 19, 2026

Thanks for digging into this and for the detailed write-up, @caapap. The root cause analysis is spot on—tool.tool.name without a fallback is indeed the issue in @mintlify/mcp.

However, we're going to close this for a couple of reasons:

  1. This is an upstream bug in @mintlify/mcp, not something the docs repo should patch. The fix belongs in the Mintlify package itself. It may be worth opening an issue on the https://github.com/mintlify/mint.
  2. Adding package.json, package-lock.json, and patch-package to the docs repo introduces maintenance overhead that we'd like to avoid.
  3. Mintlify appears to be integrating MCP support natively into their platform, which may supersede the mint-mcp CLI entirely.

We appreciate the contribution! If you'd like, opening an issue upstream with Mintlify would be the best path to getting this fixed for everyone.

@RiskeyL RiskeyL closed this Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants