4.6 KiB
Dify Example: Integrating Doris MCP Server
This document demonstrates how to integrate and use doris-mcp-server in Dify to perform Doris SQL calls via MCP.
Table of Contents
- Prerequisites
- Starting the MCP Server
- Ngrok Tunnel (Optional)
- Installing & Configuring the Plugin in Dify
- Creating a Dify App
- Adding MCP Tools
- Example Calls
Prerequisites
First, install mcp-doris-server:
pip install mcp-doris-server
Starting the MCP Server
Run the startup script:
# Full configuration with database connection
doris-mcp-server \
--transport http \
--host 0.0.0.0 \
--port 3000 \
--db-host 127.0.0.1 \
--db-port 9030 \
--db-user root \
--db-password your_password
If successful, you'll see logs similar to this:
Ngrok Tunnel (Optional)
If your Dify deployment requires a publicly accessible endpoint, you can use the ngrok tool. Ngrok is a third-party service that securely exposes local servers to the internet.
Installing & Configuring the Plugin in Dify
-
In the Dify console, go to Plugin Marketplace, search for, and install MCP‑SSE / StreamableHTTP:

-
After installation, click Configure and set the URL to your public or local address. For example, if you're using
ngrok, this should be the public URLngrokprovides, in the formathttps://<your-domain>/mcp. If Dify can directly access your local server, usehttp://localhost:3000/mcp.{ "doris_mcp_server": { "transport": "streamable_http", "url": "https://<your-domain>/mcp" } } -
Click Save. If configured correctly, you'll see a green Authorized indicator:
Creating a Dify App
Instructions & Tool Configuration
Instruction Block
Paste the following into the Instruction field:
<instruction>
Use MCP tools to complete tasks as much as possible. Carefully read the annotations, method names, and parameter descriptions of each tool. Please follow these steps:
1. Analyze the user's question and match the most appropriate tool.
2. Use tool names and parameters exactly as defined; do not invent new ones.
3. Pass parameters in the required JSON format.
4. When calling tools, use:
{"mcp_sse_call_tool": {"tool_name": "<tool_name>", "arguments": "{}"}}
5. Output plain text only—no XML tags.
<input>
User question: user_query
</input>
<output>
Return tool results or a final answer, including analysis.
</output>
</instruction>
Adding MCP Tools
In the Tools pane, click Add twice to add two entries, both named mcp_sse (they will inherit the transport and URL from the plugin):

Example Calls
List Tables in Database
-
User: What tables are in the database?
-
Result: Dify will call the MCP tool to run
SHOW TABLESand return the list.





