mcp2skill
](https://golang.org/dl/)  
一个CLI工具,用于转换 模型上下文协议(MCP) 服务器进入 代理技能它从MCP服务器元数据自动生成SKILL.md和工具引用,并提供一个CLI工具与MCP服务器交互。
演示

安装
快速安装
Linux/macOS
curl -sSL https://raw.githubusercontent.com/fenwei-dev/mcp2skill/main/install.sh | bash要卸载,请执行以下操作: rm ~/.local/bin/mcp2skill
视窗
- 下载二进制文件
mcp2skill_windows_{arch}.tar.gz从 : - 提取存档并添加
mcp2skill.exe到你的路径。
来源
go install github.com/fenwei-dev/mcp2skill/cmd/mcp2skill@latest开发版本
git clone https://github.com/fenwei-dev/mcp2skill.git
cd mcp2skill
go build ./cmd/mcp2skill编译后的二进制文件将是 ./mcp2skill.
快速开始
- 配置您的MCP服务器 在
~/.mcp2skill/config.json:
{
"mcp": {
"fetch": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"mcp/fetch"
]
},
"github": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/",
"headers": {
"Authorization": "Bearer {github_pat}"
}
}
}
}- 生成技能包:
mcp2skill generate-skill --server github --output ~/.claude/skills- 使用生成的技能 在您的编码代理中:
- OpenCode - 克劳德代码 - 法典 - Gemini CLI - Qwen代码
配置
配置文件位置
该工具按以下顺序查找配置(项目覆盖全局):
- 自定义配置:通过指定的路径
--config旗帜 - 项目配置:
.mcp2skill/config.json在当前目录或任何父目录中 - 全局配置:
~/.mcp2skill/config.json
配置架构
{
"mcp": {
"server-name": {
"type": "stdio|http",
// For stdio transport:
"command": "path/to/executable",
"args": ["arg1", "arg2"],
"env": {
"VAR_NAME": "value"
},
// For http transport:
"url": "https://api.example.com/mcp",
"headers": {
"Authorization": "Bearer token"
}
}
}
}运输类型
标准
适用于通过标准输入/输出进行通信的MCP服务器。
{
"type": "stdio",
"command": "uvx",
"args": ["mcp-server-fetch"],
"env": {
"FETCH_API_KEY": "sk-..."
}
}超文本传输协议
对于可通过HTTP/S访问的MCP服务器。
{
"type": "http",
"url": "https://api.githubcopilot.com/mcp/",
"headers": {
"Authorization": "Bearer ghp_..."
}
}OAuth
尚未实施。
命令
看 docs/commands.md 获取详细的命令文档。
生成的技能包结构
my-skill/
├── SKILL.md # Main skill documentation with frontmatter
├── references/
│ ├── TOOLS.md # Generated tool reference (if applicable)
│ └── RESOURCES.md # Generated resource reference (if applicable)
└── bin/
└── mcp2skill # Embedded binary (if applicable)技能.md
生成的SKILL.md遵循 代理技能规范 带标准正面:
---
name: my-server
description: Provides access to My MCP Server (v1.0.0) MCP server with tools: tool1, tool2. Use when the user requests My MCP Server functionality.
---
# My MCP Server
This skill provides access to the My MCP Server MCP server.
## MCP Server Info
- **MCP Server:** my-server
- **Server Version:** 1.0.0
- **Server Title:** My MCP Server Title
- **Protocol Version:** 2024-11-05
## Available Tools
This skill provides the following tools:
- **tool1**: Description of tool1
- **tool2**: Description of tool2
## Usage
This skill is automatically invoked when tools from this MCP server are required.
For detailed documentation on each tool's parameters and usage, see [TOOLS.md](references/TOOLS.md).常见用例
从stdio MCP服务器创建技能
# Configure
cat > ~/.mcp2skill/config.json ~/.mcp2skill/config.json <<'EOF'
{
"mcp": {
"github": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/",
"headers": {
"Authorization": "Bearer ghp_..."
}
}
}
}
EOF
# Generate
mcp2skill generate-skill --server github --output ./skills/github当MCP服务器发生变化时更新技能
# Check for updates
mcp2skill update-skill --skill ./skills/fetch
# Review changes in ./skills/fetch/update/
# Apply if satisfied
mcp2skill update-skill --skill ./skills/fetch --confirm创建没有嵌入二进制文件的技能
mcp2skill generate-skill --server fetch --output ./skills/fetch --no-embed这会生成一种引用您全局安装的技能 mcp2skill 二进制而不是嵌入它。
发展
项目结构
mcp2skill/
├── cmd/
│ └── mcp2skill/ # Main CLI entry point
├── internal/
│ ├── cliapp/ # CLI command implementations
│ ├── config/ # Configuration management
│ ├── mcp/ # MCP client wrapper
│ └── skill/ # Skill generation logic
├── go.mod
└── README.md建筑
# Standard build
go build ./cmd/mcp2skill
# Static binary for distribution
CGO_ENABLED=0 go build -ldflags="-s -w" ./cmd/mcp2skill测试
# Run all tests
go test ./...
# Run tests with coverage
go test -cover ./...
# Run specific package tests
go test ./internal/config
go test ./internal/mcp
go test ./internal/cliapp故障排除
“在配置中找不到服务器”
确保您的MCP服务器在配置文件中定义在以下位置之一:
~/.mcp2skill/config.json(全球).mcp2skill/config.json在您的项目目录中- 通过指定的路径
--config旗帜
“无法连接到MCP服务器”
常见原因:
- stdio传输的命令路径不正确
- 缺少必需的环境变量
- http传输的URL或标头无效
- 网络连接问题(针对http)
使用 --verbose 标记以获取更详细的错误消息:
mcp2skill generate-skill --server my-server --verbose“输出目录不为空”
目标目录已包含文件。使用 --force 要覆盖:
mcp2skill generate-skill --server my-server --output ./skills/my-server --force更新不可用
如果 update-skill 报告“无可用更新”,则该技能已与MCP服务器的当前状态同步。
关于现有更新目录的警告
这表示之前的更新已启动但未完成。要么:
- 与一起跑步
--confirm应用待处理的更新 - 与一起跑步
--discard取消它们,重新开始
许可证
看 许可证 了解详情。
