Some checks failed
Deploy skills-market-server / deploy (push) Has been cancelled
- Added support for clearing version history during skill and agent imports with the `--clear-versions` flag. - Updated import scripts to handle versioning more effectively, ensuring only the latest version is retained when clearing history. - Introduced new checks for user permissions in various API endpoints to restrict access based on roles. - Normalized file paths during merges to ensure consistency across different operating systems. - Updated `.gitignore` to exclude the `scripts/` directory.
Skills Market Server
Skills Market API 服务,使用 Express + MongoDB。
安装 MongoDB
Windows
- 下载 MongoDB Community Edition: https://www.mongodb.com/try/download/community
- 安装后,MongoDB 会作为 Windows 服务自动启动
- 默认端口: 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_EMAIL为初始管理员(root admin);其他管理员只能编辑非 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
Languages
JavaScript
68.6%
HTML
31%
Batchfile
0.4%