Skip to content

HTTP API

Hub Server 提供团队同步和管理接口。本地调试 proxy 只提供 /healthz/mcp;完整团队接口由 Hub Server 提供。

默认 Hub 监听地址由部署配置决定,示例使用:

bash
DEV_MESH_HUB_URL=https://your-devmesh-hub.example.com

认证

接口类型认证
GET /healthzGET /.well-known/devmeshGET /api/v1/groupsPOST /api/v1/join公开。
普通团队 APIAuthorization: Bearer <accessToken>
/mcpStreamable HTTP MCP session headers,按 MCP client 处理。
/api/v1/admin/*当前 Hub 管理面需要由部署层保护,例如内网、反向代理认证或网关鉴权。

错误响应格式:

json
{
  "error": {
    "code": "server.internal_error",
    "message": "Unexpected server error."
  }
}

发现和加入

MethodPathAuth说明
GET/healthzpublic健康检查,返回 service 和 version。
GET/.well-known/devmeshpublic服务发现,返回 base URL、MCP URL、安装命令和最低客户端版本。
GET/api/v1/groupspublic列出可发现的团队组摘要。
POST/api/v1/joinpublic使用邀请 token 加入团队组。
POST/api/v1/auth/rotatebearer轮换当前访问令牌。

POST /api/v1/join

请求体:

json
{
  "inviteToken": "inv_xxx",
  "groupKey": "default",
  "displayName": "Alice",
  "handle": "alice",
  "clientLabel": "Alice laptop",
  "hostname": "workstation",
  "tools": ["codex", "claude"],
  "automation": {
    "autoInit": true,
    "autoReference": true,
    "autoSync": true
  }
}

返回:

json
{
  "memberId": "member_default_alice",
  "clientId": "client_xxx",
  "groupKey": "default",
  "accessToken": "mesh_xxx",
  "syncSigningSecret": "secret",
  "expiresAt": "2026-12-31T00:00:00.000Z"
}

同步和项目

MethodPathAuth说明
POST/api/v1/sync/pushbearer推送本地事件。
GET/api/v1/sync/pull?cursor=<cursor>bearer拉取远端事件。
GET/api/v1/federation/sync-events?groupKey=<group>&cursor=<cursor>&limit=<n>bearer读取带 hash log metadata 的同步事件日志。
GET/api/v1/projectsbearer列出当前成员可访问项目。
POST/api/v1/projectsbearer创建项目。
GET/api/v1/projects/:id/briefbearer生成项目知识 brief。

POST /api/v1/sync/push

请求体:

json
{
  "clientId": "client_xxx",
  "events": [
    {
      "id": "evt_xxx",
      "kind": "knowledge.captured",
      "payload": {},
      "createdAt": "2026-06-10T00:00:00.000Z"
    }
  ]
}

返回:

json
{
  "accepted": 1,
  "rejected": [],
  "cursor": "42"
}

GET /api/v1/sync/pull

返回:

json
{
  "cursor": "43",
  "events": []
}

POST /api/v1/projects

请求体:

json
{
  "id": "devmesh",
  "projectKey": "DevMesh",
  "name": "DevMesh",
  "description": "Local-first memory for coding agents"
}

管理接口

MethodPathQuery / Body说明
GET/api/v1/admin/overview管理总览、计数、近期知识和 MCP URL。
GET/api/v1/admin/groups列出团队组。
POST/api/v1/admin/groupsAdminGroupInput创建或更新团队组。
GET/api/v1/admin/members列出成员。
POST/api/v1/admin/members/:memberId/disable{ reason? }禁用成员。
POST/api/v1/admin/members/:memberId/rotate-token轮换成员 token。
GET/api/v1/admin/invites列出邀请。
POST/api/v1/admin/invitesAdminInviteInput创建邀请。
DELETE/api/v1/admin/invites/:token撤销邀请。
GET/api/v1/admin/projects列出所有项目。
POST/api/v1/admin/projectsAdminProjectInput创建项目。
PUT/api/v1/admin/projects/:groupKey/:id/aclAdminProjectAclInput更新项目 ACL。
GET/api/v1/admin/glossaryquerygroupKeyprojectKeylimit查询词汇表。
POST/api/v1/admin/glossaryAdminGlossaryInput创建词汇条目。
PUT/api/v1/admin/glossary/:idAdminGlossaryInput更新词汇条目。
GET/api/v1/admin/knowledgequerylayerincludeSupersededlimit查询知识。
GET/api/v1/admin/knowledge-edgesgroupKeykindlimit查询知识语义边。
POST/api/v1/admin/knowledge-edgesAdminKnowledgeEdgeInput创建知识语义边。
GET/api/v1/admin/quality-reviewlayerincludeSupersededmaxQualityScoremaxConfidencemaxRatingmaxAdoptionScorestaleDayslimit生成质量审查列表。
GET/api/v1/admin/task-digestprojectKeystatusincludeDoneincludeSupersededlimit生成任务摘要。
GET/api/v1/admin/review-queue查看 review queue。
GET/api/v1/admin/auditgroupKeyactionlimit查看审计日志。

管理请求体

AdminGroupInput

json
{
  "key": "platform",
  "displayName": "Platform",
  "description": "Platform team",
  "joinMode": "invite"
}

AdminInviteInput

json
{
  "groupKey": "platform",
  "token": "inv_custom",
  "expiresAt": "2026-12-31T00:00:00.000Z",
  "maxUses": 10
}

AdminProjectInput

json
{
  "groupKey": "platform",
  "id": "devmesh",
  "projectKey": "DevMesh",
  "name": "DevMesh",
  "description": "Local-first project knowledge"
}

AdminProjectAclInput

json
{
  "visibility": "restricted",
  "members": [
    {
      "memberId": "member_platform_alice",
      "role": "maintainer"
    }
  ]
}

AdminGlossaryInput

json
{
  "term": "daemon",
  "definition": "Project-level background MCP worker",
  "content": "Longer explanation",
  "groupKey": "platform",
  "projectKey": "DevMesh",
  "aliases": ["background worker"],
  "tags": ["runtime"]
}

AdminKnowledgeEdgeInput

json
{
  "kind": "supersedes",
  "fromId": "ki_new",
  "toId": "ki_old",
  "groupKey": "platform",
  "reason": "Newer release decision"
}

MCP over HTTP

MethodPathAuth说明
ALL/mcpMCP sessionStreamable HTTP MCP endpoint。

这个 endpoint 提供与 dmx serve --mcp 相同的 DevMesh MCP tools。工具清单见 MCP 工具

Local-first context memory for AI-assisted engineering teams.