技能经理
用于管理人工智能技能的集中式HTTP MCP服务。使AI代理能够通过自动版本控制创建、存储和管理可重用的技能,同时为开发人员提供用于查看和监控的web界面。
技术栈
- 反应19 -用于查看和管理技能的UI
- 顺风CSS v4 -实用程序优先的CSS框架
- 快6 -构建工具和开发服务器
- 荣誉 -API和MCP路由的后端框架
- Cloudflare员工 -边缘计算平台
- Cloudflare D1 -SQLite数据库
特性
- 🤖 用于AI代理集成的MCP(模型上下文协议)服务器
- 📦 ZIP上传 -通过web UI一次上传多种技能
- 📝 使用文件管理进行版本控制的技能
- 🌐 用于编程访问的REST API
- 💻 用于浏览和查看技能的Web UI
- 🔐 写入操作的API密钥身份验证
- ⚡ 部署在Cloudflare的全球边缘网络上
入门指南
先决条件
安装
bun install数据库设置
创建和应用D1迁移:
# For local development
wrangler d1 migrations apply skill-manager-db --local
# For production
wrangler d1 migrations apply skill-manager-db配置
设置MCP API密钥以进行身份验证:
# For production (as a secret)
wrangler secret put MCP_API_KEY
# For local development, add to wrangler.json:
# "vars": { "MCP_API_KEY": "your-api-key" }发展
bun run dev访问Web UI http://localhost:5173
默认API密钥: asdf1234 (用于地方发展)
生产
bun run build
bun run deployMCP集成
技能管理器在以下位置公开MCP服务器 /mcp 用于AI代理集成。
MCP配置
添加到您的MCP客户端配置中(例如,Claude Desktop、Cursor):
{
"mcpServers": {
"skill-manager": {
"url": "https://your-worker.workers.dev/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}可用的MCP工具
skill.create
使用文件创建新技能。
{
"name": "skill.create",
"arguments": {
"name": "my-skill",
"description": "A useful skill",
"files": [
{
"path": "main.py",
"content": "print('Hello')",
"is_executable": true,
"script_language": "python"
}
],
"changelog": "Initial version"
}
}技能更新
更新现有技能(创建新版本)。
{
"name": "skill.update",
"arguments": {
"skill_id": "uuid-here",
"description": "Updated description",
"file_changes": [
{ "type": "add", "path": "new-file.txt", "content": "content" },
{ "type": "update", "path": "main.py", "content": "updated content" },
{ "type": "delete", "path": "old-file.txt" }
],
"changelog": "Added new feature"
}
}skill.list
列出所有具有可选过滤功能的技能。
{
"name": "skill.list",
"arguments": {
"active_only": true,
"limit": 10,
"offset": 0,
"query": "search term"
}
}煎锅
获取有关技能的详细信息。
{
"name": "skill.get",
"arguments": {
"skill_id": "uuid-here",
"version": 1
}
}skill.getfile
获取特定文件的内容。
{
"name": "skill.get_file",
"arguments": {
"skill_id": "uuid-here",
"path": "main.py",
"version": 1
}
}使用curl测试MCP
# Initialize
curl -X POST https://your-worker.workers.dev/mcp \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize"}'
# List tools
curl -X POST https://your-worker.workers.dev/mcp \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
# Create a skill
curl -X POST https://your-worker.workers.dev/mcp \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0",
"id":3,
"method":"tools/call",
"params":{
"name":"skill.create",
"arguments":{
"name":"hello-world",
"description":"A simple hello world skill",
"files":[{"path":"main.py","content":"print(\"Hello, World!\")"}]
}
}
}'ZIP上传功能
通过web UI使用ZIP文件一次上传多种技能。
ZIP结构
ZIP中的每个根级文件夹都代表一种技能:
skills.zip
├── my-first-skill/
│ ├── SKILL.md # Required: skill documentation
│ ├── main.py # Executable files auto-detected
│ └── utils.js
├── another-skill/
│ ├── SKILL.md
│ ├── README.md
│ └── scripts/
│ └── setup.sh
└── data-processor/
├── SKILL.md
└── processor.py上传过程
- 解析:上传ZIP→ 系统提取并验证技能→ 预览验证状态
- 选择:选择要导入的技能(禁用无效技能)
- 导入:在数据库中创建/更新所选技能
验证规则
- ZIP文件最大大小: 10MB
- 每个技能文件夹必须包含 技能.md
- 马克斯 50张图片 每项技能
- 马克斯 200KB 每个文件
- 可执行文件(
.py,.sh,.js,.ts)自动检测 - 跳过二进制文件并发出警告
API使用
# Step 1: Parse ZIP
curl -X POST https://your-worker.workers.dev/api/skills/upload/parse \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@skills.zip"
# Response: { session_id, skills: [{ name, valid, errors, file_count }] }
# Step 2: Import selected skills
curl -X POST https://your-worker.workers.dev/api/skills/upload/process \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"session_id": "uuid-from-parse",
"selected_skills": ["my-first-skill", "data-processor"]
}'
# Response: { total, successful, failed, results: [...] }REST API
公共端点(无需身份验证)
| 方法 | 端点 | 描述 |
|---|---|---|
| 得到 | /api/health | 健康检查 |
| 得到 | /api/skills | 列出技能 |
| 得到 | /api/skills/:id | 获取技能详细信息 |
| 得到 | /api/skills/:id/versions | 获取版本历史记录 |
| 得到 | /api/skills/:id/versions/:v/files/* | 获取文件内容 |
受保护的端点(需要身份验证)
| 方法 | 端点 | 描述 |
|---|---|---|
| 补丁 | /api/skills/:id | 更新技能状态 |
| 职位 | /api/skills/upload/parse | 解析ZIP文件和预览技巧 |
| 职位 | /api/skills/upload/process | 从ZIP导入所选技能 |
| 职位 | /mcp | MCP协议端点 |
查询参数
active_only=true-仅筛选到活动技能limit=50-最大结果(最大100)offset=0-分页偏移query=search-按技能名称搜索version=1-具体版本号
项目结构
├── src/
│ ├── react-app/ # React frontend
│ │ ├── components/ # UI components (Login, SkillUpload, etc.)
│ │ ├── hooks/ # Custom React hooks
│ │ ├── lib/ # API client with auth
│ │ ├── pages/ # Page components
│ │ └── styles/ # CSS styles
│ ├── shared/ # Shared types
│ └── worker/ # Cloudflare Worker backend
│ ├── lib/ # Utilities (auth, validation, upload-validation)
│ ├── repositories/# Data access layer
│ ├── routes/ # MCP, API, and upload routes
│ └── services/ # Business logic (skill, upload, session, zip-parser)
├── migrations/ # D1 database migrations (skills + upload_sessions)
└── wrangler.json # Cloudflare configuration命令
bun run dev # Start development server
bun run build # Build for production
bun run check # Type check + build + dry-run deploy
bun run lint # Run ESLint
bun run deploy # Deploy to Cloudflare许可证
麻省理工学院
