
Security News
Ruby's Bundler 4.0.18 Extends Cooldown to bundle lock and bundle cache
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.
dify-mcp
Advanced tools
Expose Dify knowledge base retrieval capabilities via MCP (Model Context Protocol), for use in Cursor and other MCP-compatible clients.
Connect to a self-hosted or remote Dify instance over HTTP, with optional dataset allowlisting for access control.
POST /datasets/{dataset_id}/retrievedataset_id valuesgit clone https://github.com/salted-butter-joshua/dify-mcp.git
cd dify-mcp
python3.11 -m venv .venv
# Windows
.venv\Scripts\python.exe -m pip install -e .
# macOS / Linux
.venv/bin/python -m pip install -e .
Verify import:
# Windows
.venv\Scripts\python.exe -c "import dify_mcp; print('OK')"
# macOS / Linux
.venv/bin/python -c "import dify_mcp; print('OK')"
Copy the example env file and edit it:
cp .env.example .env
DIFY_API_BASE=http://your-dify-host/v1
DIFY_API_KEY=dataset-your-api-key
DIFY_ALLOWED_DATASETS=dataset-uuid-1,dataset-uuid-2
DIFY_TIMEOUT=30
DIFY_VERIFY_SSL=false
| Variable | Description |
|---|---|
DIFY_API_BASE | Dify Knowledge API base URL, e.g. http://192.168.1.100/v1 |
DIFY_API_KEY | Knowledge Base API key |
DIFY_ALLOWED_DATASETS | Comma-separated dataset UUIDs to expose (required) |
DIFY_TIMEOUT | HTTP timeout in seconds (default: 30) |
DIFY_VERIFY_SSL | Verify TLS certificates (default: false for self-signed certs) |
Run the health check:
# Windows
.venv\Scripts\python.exe scripts/health_check.py
# macOS / Linux
.venv/bin/python scripts/health_check.py
You do not need to start the MCP server manually. Cursor launches it automatically via stdio.
mcpServers in your MCP config file:
%USERPROFILE%\.cursor\mcp.json~/.cursor/mcp.jsonSee mcp.json.example for a full example.
Windows example:
{
"mcpServers": {
"dify-knowledge": {
"command": "/absolute/path/to/dify-mcp/.venv/Scripts/python.exe",
"args": ["-m", "dify_mcp.server"],
"cwd": "/absolute/path/to/dify-mcp",
"env": {
"DIFY_API_BASE": "http://your-dify-host/v1",
"DIFY_API_KEY": "dataset-your-api-key",
"DIFY_ALLOWED_DATASETS": "dataset-uuid-1,dataset-uuid-2",
"DIFY_TIMEOUT": "30",
"DIFY_VERIFY_SSL": "false"
}
}
}
}
macOS / Linux example:
{
"mcpServers": {
"dify-knowledge": {
"command": "/absolute/path/to/dify-mcp/.venv/bin/python",
"args": ["-m", "dify_mcp.server"],
"cwd": "/absolute/path/to/dify-mcp",
"env": {
"DIFY_API_BASE": "http://your-dify-host/v1",
"DIFY_API_KEY": "dataset-your-api-key",
"DIFY_ALLOWED_DATASETS": "dataset-uuid-1,dataset-uuid-2"
}
}
}
}
dify-knowledge shows as enabled| Tool | Description |
|---|---|
list_datasets | List knowledge bases within the allowlist |
get_dataset | Get metadata for one dataset |
search_knowledge | Retrieve relevant chunks (primary retrieval tool) |
list_documents | List documents in a dataset |
list_document_segments | List text segments for a document |
Cursor (MCP client)
│ stdio
▼
dify-mcp (local process)
│ HTTPS / HTTP
▼
Dify Knowledge API (/v1/datasets/...)
The MCP server runs locally on your machine and calls the Dify API over the network. Dify does not need to reach your machine.
| Issue | Cause | Fix |
|---|---|---|
No matching distribution found for mcp | Python < 3.11 | Use Python 3.11+ in .venv |
| MCP shows error (red) | Wrong Python path, invalid key, or network issue | Check mcp.json paths and env vars |
401 Unauthorized | Invalid API key | Regenerate key in Dify Service API panel |
Dataset not in allowed list | UUID not in DIFY_ALLOWED_DATASETS | Add the dataset UUID to the allowlist |
| Health check missing env vars | .env not found | Ensure .env exists in the project root |
| Connection timeout | Dify unreachable | Check network / VPN / firewall |
dify-mcp/
├── src/dify_mcp/
│ ├── server.py # MCP entry point
│ ├── config.py # Settings and allowlist
│ ├── dify_client.py # Dify Knowledge API client
│ └── formatters.py # Response formatting
├── scripts/
│ └── health_check.py # Connectivity test
├── mcp.json.example # Cursor MCP config template
├── .env.example # Environment variable template
└── Dify-API.md # Local API path reference
Dify-API.md.env or API keys to version controlDIFY_ALLOWED_DATASETS to limit exposuremcp.json env or .env on your machine onlyFAQs
MCP server exposing Dify knowledge base retrieval to Cursor and other MCP clients
The pypi package dify-mcp receives a total of 23 weekly downloads. As such, dify-mcp popularity was classified as not popular.
We found that dify-mcp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.