MM

makabakaxy/mcp2cli

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

65 stars 质量 64 趋势 14MIT

MCP -> CLI + SKILLs。通过 MCP 服务器维护 SKILL 参数。

概览

也称为:· · ·将MCP服务器转换为CLI和代理SKILLs。 例如,安装zereight/gitlab-mcp——它会暴露14个类别(合并请求、问题、流水线、维基等)。每个工具模式都会在每个请求中注入你的AI对话上下文中。我们直接用Claude API来衡量: 在 mcp2cli 转换后,你的 AI 代理就不再看到 122 个工具定义。它会读取一个小的技能文件,调用 CLI 命令,比如 mcp2cli gitlab mr create --project-id 123 ---title “Fix bug”,来完成任务。 除了节省令牌,一些项目还同时维护CLI和MCP服务器(例如GitLab的MCP服务器与glab CLI)。保持两个接口同步是一项维护负担,且不可避免地导致功能漂移。MCP2CLI消除了这种需求——一个MCP服务器,一个生成的CLI,始终保持一致。 如果你已经用Claude、Cursor或Codex配置了MCP服务器: 就这样。

概述(AI 翻译)

也称为:mcp2skill ·mcp到cli ·mcp到skill ·mcpcli 将MCP服务器转换为CLI和代理技能。

为什么

例如,安装zereight/gitlab-mcp——它会在14个类别(合并请求、问题、流水线、维基等)中暴露122个工具。每个工具模式都会在每个请求中注入你的AI对话上下文中。我们直接用Claude API来衡量:

每个请求输入令牌 之前(原始MCP) 之后(mcp2cli)
您的留言 20 20
工具定义(122个工具) 27,969 —
技能文件(1个文件) — ~800
总计 27,989 ~820
减少 ~97%

在mcp2cli convert之后,你的AI代理就不再看到122个工具定义。取而代之的是读取一个小技能文件,并调用像mcp2cli gitlab mr create --project-id 123 --title "Fix bug"这样的CLI命令来完成任务。

除了节省令牌,一些项目还会同时维护CLI和MCP服务器(例如GitLab的MCP服务器与glab的CLI)。保持两个接口同步是维护负担,且不可避免地导致功能漂移。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

mcp2cli/mcp2skill

Also known as: mcp2skill · mcp-to-cli · mcp-to-skill · mcpcli Convert MCP servers into CLI and Agent SKILLs.

Why

For example, install zereight/gitlab-mcp — it exposes 122 tools across 14 categories (merge requests, issues, pipelines, wikis, etc.). Every tool schema gets injected into your AI conversation context on every request. We measured this directly against the Claude API:

Per-request input tokens Before (raw MCP) After (mcp2cli)
Your message 20 20
Tool definitions (122 tools) 27,969 —
Skill file (1 file) — ~800
Total 27,989 ~820
Reduction ~97%

After mcp2cli convert, your AI agent stops seeing 122 tool definitions. Instead, it reads one small skill file, and calls CLI commands like mcp2cli gitlab mr create --project-id 123 --title "Fix bug" to get the job done.

Beyond token savings, some projects maintain both a CLI and an MCP server in parallel (e.g. the GitLab MCP server vs. the glab CLI). Keeping two interfaces in sync is a maintenance burden and inevitably leads to feature drift. mcp2cli eliminates the need — one MCP server, one generated CLI, always consistent.

Quick Start

pip install mcp-to-cli

If you already have an MCP server configured in Claude, Cursor, or Codex:

mcp2cli list              # See which MCP servers are available
mcp2cli convert gitlab-mcp

That’s it. Your MCP server is now a CLI, and the compressed skill files are synced to your AI clients.

Tip: After install or convert, you can edit ~/.agents/mcp2cli/servers.yaml to update env vars (API keys, endpoints, etc.) without re-running the full setup.

How It Works

mcp2cli convert gitlab-mcp runs a 3-phase pipeline:

┌──────────────┐      ┌──────────────┐      ┌──────────────┐
│  1. Extract  │─────>│  2. Generate │─────>│   3. Sync    │
│              │      │              │      │              │
│  Read config │      │ AI-generate  │      │ Copy skills, │
│  from Claude,│      │ CLI + skill  │      │ disable MCP  │
│  Cursor,Codex│      │              │      │              │
└──────┬───────┘      └──────┬───────┘      └──────┬───────┘
       v                     v                     v
 mcp_servers.json    cli.yaml + SKILL.md    ~/.claude/skills/
  1. Extract — Reads your MCP server config from Claude (~/.claude.json) / Cursor (~/.cursor/mcp.json) / Codex (~/.codex/config.toml)
  2. Generate — Connects to the MCP server, discovers all tools, and uses AI to generate a CLI command tree (cli.yaml) and a compressed skill file (SKILL.md)
  3. Sync — Copies skill files to your AI clients and disables the raw MCP server
在 GitHub 查看完整 README

推荐工具

换一个关键词,或者移除筛选条件。

安装

npx skillfish add makabakaxy/mcp2cli
新手?先看 mcpskill.org 教程 →