为团队 Agent (OpenCode / Codex / Claude Desktop / Cursor / Claude Code) 提供 Dify 知识库直接检索与沉淀能力。
选择对应 Agent 平台,复制包含完整 MCP 配置、Skill 安装及工具使用规范的自闭环指引:
服务端已自动预填当前部署的 Token。下方所有接入配置已实时注入该凭证,直接点击复制即可使用。
添加到项目根目录 .opencode/opencode.json 或全局配置 ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"dify-knowledge": {
"type": "remote",
"url": "https://dify-mcp.speedstarsunblocked.online/mcp",
"enabled": true,
"headers": {
"Authorization": "Bearer 2143777e9c6e7dcde76c2a0efd1b48ec79d2126953877060d62bbbbe80ac50d2"
}
}
}
}
添加到 Codex 配置文件 ~/.codex/config.toml 或工作区 MCP 配置中:
[mcp_servers.dify_knowledge]
url = "https://dify-mcp.speedstarsunblocked.online/mcp"
type = "http"
http_headers = { "Authorization" = "Bearer 2143777e9c6e7dcde76c2a0efd1b48ec79d2126953877060d62bbbbe80ac50d2" }
添加到 claude_desktop_config.json 中的 mcpServers:
{
"mcpServers": {
"dify-knowledge": {
"url": "https://dify-mcp.speedstarsunblocked.online/mcp",
"headers": {
"Authorization": "Bearer 2143777e9c6e7dcde76c2a0efd1b48ec79d2126953877060d62bbbbe80ac50d2"
}
}
}
}
在 Cursor Settings > Features > MCP 中点击 Add New MCP Server (或写入 .cursor/mcp.json):
Name: dify-knowledge
Type: sse / remote / http
URL: https://dify-mcp.speedstarsunblocked.online/mcp
Headers: Authorization=Bearer 2143777e9c6e7dcde76c2a0efd1b48ec79d2126953877060d62bbbbe80ac50d2
直接在终端执行添加命令:
claude mcp add dify-knowledge https://dify-mcp.speedstarsunblocked.online/mcp --header "Authorization: Bearer 2143777e9c6e7dcde76c2a0efd1b48ec79d2126953877060d62bbbbe80ac50d2"
安装 Skill 后,Agent 会自动遵守团队知识库分类规则、文档命名与检索策略。
curl -fsSL https://dify-mcp.speedstarsunblocked.online/install.sh | bash
irm https://dify-mcp.speedstarsunblocked.online/install.ps1 | iex
保存到 ~/.config/opencode/skills/dify-knowledge/SKILL.md 或 Codex 的 rules 目录:
---
name: dify-knowledge
description: Use when recalling relevant architecture decisions, team handbook rules, business logic, or syncing/updating documents in the team's central Dify Knowledge base via remote MCP.
---
# Team Dify Knowledge Assistant
You are connected to the team's central Dify Knowledge base via remote MCP.
## Available MCP Tools
1. dify_knowledge_search
- When to use: Before writing project code, before writing PRs, during debugging, or when researching team standards, ADRs, architecture decisions, and business rules.
- Arguments:
- datasetName: "team-handbook" or "project-tuantuanrent"
- query: Semantic or keyword search query
- searchMode (optional): "semantic_search" | "hybrid_search" | "keyword_search"
- scoreThreshold (optional): e.g. 0.6
- topK (optional): e.g. 5
2. dify_knowledge_upsert_document
- When to use: When creating, updating, or syncing documentation (ADR, Architecture, API spec, Runbook, Release notes, Business logic) directly to Dify Knowledge.
- Arguments:
- actor: { id: string, type: "agent" | "human" }
- datasetName: Target dataset ("team-handbook" or "project-tuantuanrent")
- sourceId: Unique document key (e.g. "ARCH-PAYMENT-001", "ADR-005", "HANDBOOK-CODE-STYLE")
- title: Document title
- content: Complete Markdown body
- metadata (optional): { document_type?: string, owner?: string, status?: string, ... }
3. dify_knowledge_list_documents
- When to use: To explore what documents exist in a dataset.
- Arguments: { datasetName: string, limit?: number }
4. dify_knowledge_get_document_status
- When to use: Check indexing status of a document by sourceId.
5. dify_knowledge_health
- When to use: Verify connection and dataset availability.
## Dataset Guidelines
- team-handbook: Team-wide engineering standards, code conventions, git workflows, onboarding rules. Document prefix HANDBOOK-*.
- project-tuantuanrent: Tuantuan Rent business rules, architecture, ADRs, database designs, runbooks.
- ARCH-*: Architecture specifications
- ADR-*: Architecture Decision Records
- API-*: API contracts and external integration notes
- RUNBOOK-*: Operational runbooks and troubleshooting guides
- BIZ-*: Business logic and domain models
- RELEASE-*: Release notes and changelog summaries
## Best Practices for Agent
- Search first: Before implementing complex features or refactoring, search existing decisions to avoid breaking constraints.
- Write back: After concluding an important technical design or resolving a tricky incident, proactively offer to document it to Dify Knowledge using dify_knowledge_upsert_document.