將 MCP (Model Context Protocol) 伺服器轉換為 Claude Code Plugin 格式的命令列工具。
- 支援 fastmcp.me 和 smithery.ai 兩大 MCP 來源
- 自動產生 Claude Code 相容的 plugin.json 設定
- 內建 marketplace 管理系統
- 可選的 Gemini LLM 增強解析(更準確的描述和工具識別)
- Python 3.12+
- uv 或 pip
git clone https://github.com/dolphinsue319/mcp2plugin.git
cd mcp2plugin使用 uv run 可直接執行,無需額外安裝步驟。
如需使用 LLM 增強解析功能,請設定 Gemini API Key:
- 前往 Google AI Studio 取得 API Key
- 建立
.env檔案:
cp .env.example .env- 編輯
.env填入 API Key:
GEMINI_API_KEY=your-api-key-here
若不設定 API Key,工具仍可正常運作,但解析結果可能較不精確。
在使用前,先初始化 marketplace:
uv run mcp2plugin init這會建立以下結構:
./
├── .claude-plugin/
│ └── marketplace.json
└── plugins/
可自訂 marketplace 名稱和擁有者:
uv run mcp2plugin init --name "my-plugins" --owner "username"從 fastmcp.me 轉換:
uv run mcp2plugin convert https://fastmcp.me/MCP/Details/217/repomix從 smithery.ai 轉換:
uv run mcp2plugin convert https://smithery.ai/server/slack-o, --output PATH:指定輸出目錄(預設:./plugins)--no-llm:停用 LLM 增強(較快但可能較不精確)
# 指定輸出目錄
uv run mcp2plugin convert https://fastmcp.me/MCP/Details/217/repomix -o /path/to/output
# 停用 LLM 增強
uv run mcp2plugin convert https://fastmcp.me/MCP/Details/217/repomix --no-llm在轉換前,可先查看 MCP 的詳細資訊:
uv run mcp2plugin info https://fastmcp.me/MCP/Details/217/repomix輸出包含:
- MCP 名稱和描述
- 作者資訊
- 連線類型(stdio/http)
- 安裝指令
- 可用的工具列表
- 所需環境變數
uv run mcp2plugin list指定 marketplace 目錄:
uv run mcp2plugin list -m /path/to/marketplace在 Claude Code 中執行:
/plugin marketplace add dolphinsue319/mcp2plugin
或使用本地路徑:
/plugin marketplace add /path/to/mcp2plugin
/plugin install <plugin-name>@mcp2plugin-marketplace
例如:
/plugin install repomix@mcp2plugin-marketplace
# 1. 進入專案目錄
cd ~/my-plugins
# 2. 初始化 marketplace
uv run mcp2plugin init --name "my-mcp-plugins"
# 3. 轉換想要的 MCP
uv run mcp2plugin convert https://fastmcp.me/MCP/Details/217/repomix
uv run mcp2plugin convert https://smithery.ai/server/slack
# 4. 查看已轉換的 plugins
uv run mcp2plugin list
# 5. 在 Claude Code 中使用
# /plugin marketplace add dolphinsue319/mcp2plugin
# /plugin install repomix@mcp2plugin-marketplacehttps://fastmcp.me/MCP/Details/{id}/{name}
範例:
https://fastmcp.me/MCP/Details/217/repomixhttps://fastmcp.me/MCP/Details/123/my-server
https://smithery.ai/server/{name}
範例:
https://smithery.ai/server/slackhttps://smithery.ai/server/google-drive
marketplace-root/
├── .claude-plugin/
│ └── marketplace.json # Marketplace 設定
└── plugins/
└── plugin-name/
└── .claude-plugin/
└── plugin.json # Plugin 設定
{
"name": "repomix",
"description": "將程式碼庫打包成 AI 友好的格式",
"version": "1.0.0",
"author": {
"name": "yamadashy"
},
"homepage": "https://github.com/yamadashy/repomix",
"mcpServers": {
"repomix": {
"command": "npx",
"args": ["-y", "repomix"]
}
}
}MIT License