@hsbase/dify-knowledge-mcp
v1.0.1
Published
MCP Server for Dify Knowledge Base - Query Dify datasets directly from AI assistants like Cursor and Claude
Maintainers
Readme
@hsbase/dify-knowledge-mcp
MCP Server for Dify Knowledge Base - Query Dify datasets directly from AI assistants like Cursor and Claude.
Quick Start
npx @hsbase/dify-knowledge-mcpInstallation
Global Install (Optional)
npm install -g @hsbase/dify-knowledge-mcpConfiguration
Cursor
Add to ~/.cursor/mcp.json:
{
"mcpServers": {
"dify-knowledge": {
"command": "npx",
"args": ["-y", "@yupeng39678/dify-knowledge-mcp"],
"env": {
"DIFY_BASE_URL": "http://your-dify-server",
"DIFY_DATASET_API_KEY": "dataset-xxxxx",
"DIFY_DATASET_ID": "your-dataset-id"
},
"timeout": 120
}ƒ
}
}Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"dify-knowledge": {
"command": "npx",
"args": ["-y", "@yupeng39678/dify-knowledge-mcp"],
"env": {
"DIFY_BASE_URL": "http://your-dify-server",
"DIFY_DATASET_API_KEY": "dataset-xxxxx",
"DIFY_DATASET_ID": "your-dataset-id"
}
}
}
}Environment Variables
| Variable | Description | Required |
|----------|-------------|----------|
| DIFY_BASE_URL | Dify server URL (e.g., http://localhost or https://api.dify.ai) | ✅ |
| DIFY_DATASET_API_KEY | Dataset API Key from Dify (starts with dataset-) | ✅ |
| DIFY_DATASET_ID | Knowledge base Dataset ID (UUID format) | ✅ |
How to Get These Values
- DIFY_BASE_URL: Your Dify instance URL
- DIFY_DATASET_API_KEY: Go to Dify → Knowledge → Settings → API Access → Copy the Dataset API Key
- DIFY_DATASET_ID: Go to Dify → Knowledge → Select your dataset → Copy the ID from URL
Available Tools
| Tool | Description |
|------|-------------|
| search_knowledge | Search the knowledge base with keywords |
| ask_knowledge | Ask questions and get detailed answers from the knowledge base |
| reset_conversation | Reset conversation history and start fresh |
Examples
Once configured, you can use these tools in Cursor or Claude:
- "Search the knowledge base for dynamic column configuration"
- "Ask the knowledge base how to set up workflows"
- "Find documentation about element management"
License
MIT
Author
yupeng39678
