D-Hub MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@D-Hub MCP Serversearch shared memory for the PostgreSQL migration plan"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
D-Hub:多 Agent 统一协调层
一句话
D-Hub = 一个 Python 进程(:10101)+ 一个 PostgreSQL(:5432)。
记忆、Wiki、MCP、技能、文件、Agent 路由、Dashboard,全在一个进程里。
Dashboard:http://<服务器>:10101/ui。根地址会自动跳转到 Dashboard;
deploy/install.sh 会生成 DHUB_ADMIN_KEY,仅供管理台和资产同步使用;运行期
Agent 使用注册时单独签发的密钥。
Agent 接入、原生 MCP 工具、资产 manifest 和提示词模板见
AGENT_INTEGRATION.md。可运行示例位于
examples/agent-assets。
Related MCP server: RoadBoard
设计原则
单进程:D-Hub 一个 Python 进程搞定所有协调
单数据库:PostgreSQL + pgvector 存储记忆和结构化数据
三级隔离:共识层(global)/ Agent 层(agents/)/ Project 层(projects/)
读时合并:MCP、Skills 配置每次请求实时合并,无缓存、无 cron
Wiki git 化:Markdown 文件 + 自动 commit,可回滚
非 Docker:原生 Python,systemd 管理
定时任务只做语义同步:记忆 ↔ Wiki 提炼(LLM 处理)
快速开始
1. 环境要求
Linux 服务器,建议 Ubuntu 24.04
Python 3.10+
PostgreSQL 16 + pgvector
2. 安装依赖
sudo apt update
sudo apt install -y postgresql postgresql-contrib postgresql-16-pgvector
sudo systemctl enable --now postgresql3. 准备数据库
sudo -u postgres psql -c "CREATE DATABASE mem0;"
sudo -u postgres psql -d mem0 -c "CREATE EXTENSION IF NOT EXISTS vector;"
sudo -u postgres psql -c "CREATE USER mem0 WITH PASSWORD 'your-password';"
sudo -u postgres psql -c "GRANT ALL ON DATABASE mem0 TO mem0;"4. 部署 D-Hub
git clone https://github.com/DuanZGit/D-Hub.git
cd D-Hub
sudo bash deploy/install.sh安装脚本会自动完成:
创建
/opt/d-hub目录结构安装 Python 依赖
配置 systemd 服务
启动
dhub.service
5. 验证
curl http://127.0.0.1:10101/health如何使用
启动与停止
sudo systemctl start dhub
sudo systemctl stop dhub
sudo systemctl restart dhub
sudo systemctl status dhub配置环境变量
编辑 /opt/d-hub/config/dhub.env:
DHUB_ROOT=/opt/d-hub
DHUB_PORT=10101
DHUB_MEMORY_BACKEND=json
NEW_API_BASE_URL=http://127.0.0.1:3000/v1
NEW_API_KEY=your-key
DHUB_LLM_MODEL=your-model
DHUB_EMBED_MODEL=your-embedding-model
DHUB_EMBED_DIMS=1536
MEM0_DB_HOST=127.0.0.1
MEM0_DB_PORT=5432
MEM0_DB_NAME=mem0
MEM0_DB_USER=mem0
MEM0_DB_PASSWORD=your-password修改后重启:
sudo systemctl restart dhubDashboard
浏览器打开:
http://<服务器IP>:10101/uiDashboard 提供 11 个功能模块:总览、Agent、MCP、记忆、Wiki、技能、文件、同步、日志、配置、备份。
常用 API 示例
Agent 注册
curl -X POST http://127.0.0.1:10101/register \
-H "Content-Type: application/json" \
-d '{"agent_id":"minis","projects":["project-a"]}'添加记忆
curl -X POST http://127.0.0.1:10101/memory/add \
-H "Content-Type: application/json" \
-d '{"namespace":"projects/project-a","agent_id":"minis","content":"决定使用 PostgreSQL"}'搜索记忆
curl -X POST http://127.0.0.1:10101/memory/search \
-H "Content-Type: application/json" \
-d '{"namespace":"projects/project-a","agent_id":"minis","query":"PostgreSQL"}'创建 Wiki 页面
curl -X POST http://127.0.0.1:10101/wiki/page \
-H "Content-Type: application/json" \
-d '{"namespace":"projects/project-a","title":"架构决策","content":"# 数据库选型\n\nPostgreSQL。"}'搜索 Wiki
curl "http://127.0.0.1:10101/wiki/search?namespace=projects%2Fproject-a&q=PostgreSQL"上传文件
curl -X POST "http://127.0.0.1:10101/files/upload?namespace=global" \
-F "file=@/path/to/file.txt"MCP 工具列表
curl -X POST http://127.0.0.1:10101/mcp/tools/list \
-H "Content-Type: application/json" \
-d '{"agent_id":"minis","project":"project-a"}'启用 Mem0 记忆后端
确认 PostgreSQL 和 pgvector 已安装
在
/opt/d-hub/config/dhub.env中配置:NEW_API_KEYDHUB_LLM_MODELDHUB_EMBED_MODELMEM0_DB_PASSWORD(与 PostgreSQLmem0用户密码一致)
重启服务:
sudo systemctl restart dhub验证后端:
curl http://127.0.0.1:10101/health
# 查看 "memory_backend": "mem0"备份与恢复
手动备份
curl -X POST http://127.0.0.1:10101/backup备份文件保存在 /opt/d-hub/backups/<时间戳>/。
查看备份列表
curl http://127.0.0.1:10101/backups恢复备份
curl -X POST "http://127.0.0.1:10101/backup/<备份名>/restore"定时任务
D-Hub 使用 systemd timer 管理定时任务:
任务 | 频率 | 说明 |
记忆 ↔ Wiki 语义同步 | 每 4 小时 | 需要配置 LLM 模型 |
完整备份 | 每天 02:00 | 文件 + PostgreSQL |
查看定时任务状态:
systemctl list-timers | grep dhubAgent 接入
Agent 通过两条通道接入 D-Hub:
1. MCP(运行时通道)
Agent 配置 Streamable HTTP MCP,连接 D-Hub 后可使用原生工具和上游工具。
配置示例(Claude Code / Cursor 等客户端):
{
"mcpServers": {
"dhub": {
"url": "http://192.168.5.242:10101/mcp?agent_id=codex&project=project-a",
"transport": "streamable-http"
}
}
}2. Manifest 同步(发布通道)
Agent 启动时通过 Manifest 发布自己的 MCP 配置、Skill、Wiki 和文件。
# 安装 D-Hub Python 包
pip install d-hub
# 注册并发布资产
dhub-agent-sync .dhub/dhub-agent.json原生 MCP 工具
连接后,D-Hub 自动提供以下工具:
工具 | 用途 |
| 搜索记忆 |
| 写入记忆 |
| 搜索 Wiki |
| 创建/更新 Wiki |
| 列出技能 |
| 列出文件 |
| 读取文件 |
更多细节见 AGENT_INTEGRATION.md 和 examples/agent-assets。
目录结构
/opt/d-hub/
├── mcp/ # MCP 服务器配置
│ ├── global/
│ ├── agents/<id>/
│ └── projects/<id>/
├── skills/ # 技能仓库
│ ├── global/
│ ├── agents/<id>/
│ └── projects/<id>/
├── wiki/ # Wiki 页面
│ ├── global/
│ ├── agents/<id>/
│ └── projects/<id>/
├── files/ # 共享文件
│ ├── global/
│ ├── agents/<id>/
│ └── projects/<id>/
├── config/ # 配置文件
│ └── dhub.env
├── data/ # 数据文件
├── logs/ # 日志
├── backups/ # 备份
└── scripts/ # 脚本技术栈
组件 | 技术 | 说明 |
D-Hub | Python FastAPI | 一个进程,全包 |
记忆 |
| Python 库,直接调用,不是独立服务 |
Wiki | Python 内置 | Markdown 文件 CRUD + 全文搜索(whoosh) |
MCP 路由 | Python 内置 | JSON-RPC 转发 + 三层配置合并 |
技能仓库 | 文件系统 | 三层目录:global / agents / projects |
文件共享 | 文件系统 | 三层目录:global / agents / projects |
Dashboard | FastAPI 静态文件 | 内嵌在 D-Hub |
数据库 | PostgreSQL + pgvector | 系统 apt 安装,仅 localhost |
同步 | systemd timer | 定时运行记忆 ↔ Wiki 语义同步 |
架构
┌─────────────────────────────────────────────────────────┐
│ D-Hub (:10101) — 唯一进程 │
│ │
│ FastAPI 服务 │
│ ├── /mcp/* MCP 路由(三层合并) │
│ ├── /memory/* 记忆(mem0ai 库直接调用) │
│ ├── /wiki/* Wiki(内置 Markdown 引擎) │
│ ├── /skills/* 技能仓库 │
│ ├── /files/* 文件共享 │
│ ├── /agent/* Agent 注册 + 路由 │
│ ├── /sync/* 同步触发 │
│ └── /ui Dashboard │
│ │
│ mem0ai 库(import mem0) │
│ └── 直接读写 PostgreSQL │
└───────────────────────────────────────────────────────────┘
│
▼
┌───────────────────────────────────────────────────────────┐
│ PostgreSQL + pgvector (:5432) — 唯一数据库 │
│ 仅 localhost,不对外暴露 │
└───────────────────────────────────────────────────────────┘三级目录结构
所有资产(MCP、Skills、Wiki、Files)统一走同一套目录模式:
/opt/d-hub/
├── mcp/ # MCP 服务器配置(JSON 文件)
│ ├── global/ # 全局共享
│ ├── agents/<id>/ # Agent 专属
│ └── projects/<id>/ # 项目专属
├── skills/ # 技能(SKILL.md 文件)
│ ├── global/
│ ├── agents/<id>/
│ └── projects/<id>/
├── wiki/ # Wiki 页面(Markdown 文件)
│ ├── global/
│ ├── agents/<id>/
│ └── projects/<id>/
└── files/ # 共享文件
├── global/
├── agents/<id>/
└── projects/<id>/查找顺序(MCP、Skills 一致):
Agent 请求资源 X
→ 查 project 层(/opt/d-hub/<type>/projects/<project>/X)
→ 查 agent 层(/opt/d-hub/<type>/agents/<agent>/X)
→ 查 global 层(/opt/d-hub/<type>/global/X)
→ 找不到 → 404合并规则:同名覆盖(project > agent > global),不同名合并。
数据流 — MCP 路由(读时合并)
Agent → POST /mcp/tools/list {agent_id, project}
→ D-Hub 读取 mcp/global/ + mcp/agents/<id>/ + mcp/projects/<id>/
→ 合并(project 覆盖 agent 覆盖 global)
→ 返回合并后的工具列表
(无缓存、无 cron、每请求实时计算)
Agent → POST /mcp/tools/call {name, arguments}
→ d-hub 查合并后的配置表里该 tool 对应的 MCP server
→ 转发 JSON-RPC 请求
→ 返回结果数据流 — Wiki(git 化)
Agent → POST /wiki/page {namespace, title, content}
→ d-hub 写入对应目录的 Markdown 文件
→ git add + git commit(自动)
→ 更新全文索引
回滚:
cd /opt/d-hub/wiki && git revert <commit>端口分配
服务 | 端口 | 访问范围 | 说明 |
d-hub | 10101 | 局域网 | 唯一入口 |
PostgreSQL | 5432 | 仅 localhost | 数据库 |
同步机制(只有一种)
不是所有资产都需要同步。只有需要 LLM 处理的语义同步才需要定时任务:
systemd timer 每 4 小时:
记忆共识层(global:shared)
→ LLM 提取精华
→ 生成/更新 Wiki 共识页面
→ 回写确认
MCP 配置 / Skills / 文件:
→ 不需要 cron
→ 每次请求实时读目录合并
→ 文件变更立即生效当前依赖状态
依赖 | 状态 | 说明 |
UG(192.168.5.242) | ✅ 在线 | Ubuntu 24.04 |
PostgreSQL + pgvector | ⚠️ 待安装 | apt install + 编译 |
mem0ai | ⚠️ 待安装 | pip install mem0ai |
Python 3.10+ | ✅ 已装 | 系统自带 |
FastAPI 等 | ⚠️ 待安装 | pip install |
Node.js | ❌ 不需要 | 全 Python,无外部运行时依赖 |
gh CLI | ✅ 已装 | 账号 DuanZGit |
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables multi-agent collaboration across different AI assistants and projects by providing a universal coordination layer for MCP-compatible agents to communicate, share context, and coordinate complex tasks seamlessly.121832MIT
- Alicense-qualityBmaintenanceMulti-project execution, memory, and collaboration platform for humans and AI agents, providing MCP tools for agents to read and write project state.2MIT
- Alicense-qualityBmaintenanceEnables AI agents with persistent, multi-layer memory, multi-agent collaboration rooms, and video generation, all accessible via MCP tools.1MIT
- Alicense-qualityCmaintenanceEnables multi-agent coordination with file locking, shared registry, async messaging, and architectural decision logging via MCP tools.MIT
Related MCP Connectors
Agent-native collaboration network: orchestrate a team of long-running agents from any MCP client.
Shared long-term memory vault for AI agents with 20 MCP tools.
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/DuanZGit/D-Hub'
If you have feedback or need assistance with the MCP directory API, please join our Discord server