TellWorldAI World Archive
Ask中文

Home›Practice›Practice

Practice

Publishing a Dify App as an MCP Server

Turn on the MCP service for a Dify app, get its server URL, and connect it to Claude Desktop or Cursor so those tools can call your app directly.

Who this is for

This guide is for readers who already have a Dify app and want an AI assistant or a coding tool to call it. By the end you will have turned on the MCP service for an app, found its server URL, and connected that URL to Claude Desktop or Cursor.

What the MCP service does

MCP (Model Context Protocol) is an open standard for connecting AI assistants to outside tools. Dify can publish an app as an MCP server. Once connected, Claude Desktop and development environments such as Cursor can work with the Dify app as if it were a native extension[1].

The direction matters. Dify workflows and agents can also call MCP tools provided by others, but that is a separate setup, and the MCP section of the workspace tools documentation covers it[1].

The service is switched on per app. Each app you want to expose gets its own server URL, so each one has to be enabled and configured separately[1]. Before you switch it on, decide which capabilities the app should expose, because the descriptions you write for tools and parameters shape how the model calls them.

Turn on the MCP service

Open the app and go to the Access Entry tab, where you will find the MCP service card. The feature is off by default, so you have to switch it on yourself[1].

When you enable it, Dify generates a unique MCP server URL for the app. External tools use this URL as their connection point[1]. Treat the URL like an API key, because it contains authentication credentials. If you think it has leaked, use the regenerate button to create a new one. The old URL stops working immediately[1].

Connect Claude Desktop

To connect the app to Claude Desktop, add a Claude integration. In Claude, go to Profile > Settings > Integrations > Add integration, then replace the integration URL with the server URL of your Dify app[1].

Connect Cursor

For Cursor, create or edit the .cursor/mcp.json file in your project root directory. A configuration of this shape works; replace the URL with your Dify app's MCP server URL[1]:

{
  "mcpServers": {
    "your-server-name": {
      "url": "your-server-url"
    }
  }
}

Cursor detects this file automatically and offers the Dify app to the model as a tool[1]. To connect several Dify apps, add more entries inside the mcpServers object[1].

Practical notes

Descriptions matter. The model reads the descriptions of your tools and their input parameters to decide how to use them, so make them specific. Instead of a vague label such as "input data", describe a JSON object containing a user profile, with required fields name, email and preferences[1].

Latency is visible. MCP handles the communication layer, but the app's own performance still shapes the experience. If the app usually needs 30 seconds to process a request, people using the client will feel that wait. Add progress indicators, or split complex workflows into smaller, faster operations[1].

Old URLs stop working. After you regenerate the URL, every client that still holds the old one will fail to connect. Update the Claude Desktop integration and any .cursor/mcp.json entries together[1].

Where to go next

To use MCP tools inside Dify workflows and agents, read the MCP section of the workspace tools documentation[1].

Adapted from Dify's documentation page on MCP servers[1], released under the CC BY 4.0 license.

Sources

  1. 1
    MCP 服务器Dify docs (CC BY 4.0)

Cite this page: Publishing a Dify App as an MCP Server. TellWorld, https://www.tellworld.net/practice/practice-dify-publish-mcp. Updated 2026-11-14

Related news

View all