hjjjj 7bb3ef8d09
Some checks failed
Deploy skills-market-server / deploy (push) Has been cancelled
feat(auth): support multiple root admin emails and enhance admin login verification
- Updated the environment variable configuration to allow multiple root admin emails via `ADMIN_EMAILS`, while maintaining compatibility with the legacy `ADMIN_EMAIL`.
- Modified the admin login verification process to check against the list of root admin emails.
- Enhanced the admin role management in the frontend to reflect the new multiple admin structure.
2026-03-27 17:11:05 +08:00
2026-02-28 17:57:28 +08:00
2026-02-28 17:57:28 +08:00

Skills Market Server

Skills Market API 服务,使用 Express + MongoDB。

安装 MongoDB

Windows

  1. 下载 MongoDB Community Edition: https://www.mongodb.com/try/download/community
  2. 安装后MongoDB 会作为 Windows 服务自动启动
  3. 默认端口: 27017

或使用 Docker

docker run -d -p 27017:27017 --name mongodb mongo:latest

启动服务

# 安装依赖
npm install

# 启动服务
npm start

# 开发模式(自动重启)
npm run dev

API 接口

接口 方法 说明
/api/skills GET 获取 skills 列表
/api/skills/:name GET 获取 skill 详情
/api/skills/:name/download GET 下载 skill增加下载计数
/api/skills/:name/publish POST 发布/更新 skill
/api/skills/:name/versions GET 获取版本历史
/api/skills/:name/versions/:version GET 获取特定版本
/api/skills/:name DELETE 删除 skill
/api/health GET 健康检查
/api/stats GET 统计信息

云端会话 /api/chat/*(需 Bearer JWT与发布 skill 同源鉴权)

接口 方法 说明
/api/chat/sessions GET 列出当前用户的会话
/api/chat/sessions POST 创建会话body 含客户端生成的 id
/api/chat/sessions/:id PATCH 更新会话字段
/api/chat/sessions/:id DELETE 删除会话及其消息
/api/chat/sessions/:id/messages GET 分页消息,view=user(裁剪 tool/thinking 等)或 view=full
/api/chat/sessions/:id/messages POST 追加消息
/api/chat/messages/:messageId PATCH 更新单条消息
/api/chat/sessions/:id/messages/all DELETE 清空该会话全部消息
/api/chat/sessions/:id/messages/from/:fromSort DELETE 删除 sort_order >= fromSort 的消息(截断)

管理员看板 /admin

  • 地址:http://<server>:3001/admin
  • 登录方式:管理员邮箱验证码登录(/api/auth/send-code + /api/admin/login
  • 管理能力:用户列表、角色切换、权限配置(模式可见性 / 技能页 / 智能体页 / SSH 页 / 开发者模式)
  • 相关接口:/api/admin/login/api/admin/users/api/admin/users/:userId/permissions/api/admin/audit-logs
  • 权限规则:ADMIN_EMAILS逗号分隔定义初始管理员root admin兼容旧的 ADMIN_EMAIL);其他管理员只能编辑非 admin 用户,且不能修改自己的权限

环境变量

创建 .env 文件:

PORT=3001
MONGO_URL=mongodb://localhost:27017
DB_NAME=skills_market

MongoDB 数据结构

// skills 集合
{
  "_id": ObjectId("..."),
  "name": "agent-browser",
  "description": "Browser automation...",
  "owner": "user123",
  "downloads": 150,
  "is_public": true,
  "tags": ["browser", "automation"],
  
  // 文件数组
  "files": [
    { "path": "SKILL.md", "content": "---\nname: ..." },
    { "path": "references/commands.md", "content": "# Commands..." },
    { "path": "templates/auth.sh", "content": "#!/bin/bash..." }
  ],
  
  // 版本历史
  "versions": [
    {
      "version": 1,
      "description": "Initial version",
      "files": [ /* 快照 */ ],
      "created_at": ISODate("..."),
      "created_by": "user123"
    }
  ],
  
  "created_at": ISODate("..."),
  "updated_at": ISODate("...")
}
Description
No description provided
Readme 10 GiB
Languages
JavaScript 68.6%
HTML 31%
Batchfile 0.4%