Home›MCP / Tooling›CLIツールをMCPサーバーに作り替える──単純なツール移植では済まなかった設計転換

CLIツールをMCPサーバーに作り替える──単純なツール移植では済まなかった設計転換A hands-on account of converting a CLI tool into an MCP server, revealing that…

元記事を読むRead original articlezenn.dev(新しいタブで開きます)(opens in a new tab)
AI2 点サマリSummary highlight
  • 既存のCLIツールをMCPサーバーへ移植する過程で、単なる機能の書き換えにとどまらず、ツールの設計思想そのものを見直す必要があった実践的な知見をまとめた記事。
  • インターフェース設計や状態管理など、CLIとMCPの根本的な違いが設計転換を迫る理由を解説している。

A hands-on account of converting a CLI tool into an MCP server, revealing that the migration required rethinking core design principles—not just porting code—due to fundamental differences in interface contracts and state management.

本ページの本文と要約は AI による自動生成です。日本語版と英語版は言語ごとに独立して生成されるため、表現や詳しさが異なる場合があります。正確性は元記事 (zenn.dev) をご確認ください。The body and summaries are AI-generated independently for each language, so wording and detail may differ. Verify accuracy at the original source (zenn.dev).

要約と収集メタデータに基づく AI 解説。元記事全文の転載・翻訳ではありません。AI explainer based on the summaries and collected metadata, not a copy or translation of the full source article.

CLIからMCP

自作のRSSキュレーションCLI「feed-curator-cli」をMCPサーバー「feed-curator-mcp」へ作り替えた実践記録だ。単なる機能移植ではなく、設計思想そのものの見直しが必要だった点を主題としている。

1対1の対応

当初は、CLIのコマンドをMCPツールへ一つずつ置き換える計画だった。具体的には、fetchをfetch_feedsに、generateをgenerate_articleに対応させる構想であり、筆者自身もこの方針から作業を始めたという。

設計転換

実際の移行では、コマンドをツールへ置き換えるだけでは済まなかったと説明されている。CLIとMCPではインターフェース設計や状態管理に根本的な違いがあり、それらを踏まえてツールの設計を捉え直す必要があったとされる。

Converting a CLI Tool

Converting a CLI tool into an MCP server may require more than rewriting existing functionality. This hands-on account matters because it shows how the migration can force a reassessment of the tool’s underlying design principles.

The author began by expecting a straightforward one-to-one conversion. Under that plan, each CLI command would become a corresponding MCP tool: fetch would become fetch_feeds, while generate would become generate_article.

Interface Contracts

The project involved rebuilding the author’s RSS curation CLI, feed-curator-cli, as the MCP server feed-curator-mcp. In practice, replacing commands with tools was not sufficient.

According to the source, fundamental differences between CLI and MCP interface contracts required a broader design shift. The work therefore became a reconsideration of how the tool should be structured, rather than a simple port of its commands or code.

State Management

State management was another area where the CLI and MCP models differed. The account presents interface design and state management as reasons the conversion demanded refactoring and a change in tool-design thinking, not merely a direct functional rewrite.

ポコとTECHガイドPoko & TECH Guide

ポコと当サイトのTECHガイドが、記事の要約と収集した情報から読みどころを語るAI生成の対話です。Poko and TECH Dashboard's own TECH Guide discuss the article's highlights in an AI-generated conversation based on its summary and collected source details.

  1. ポコPokoAIが子プロセスから呼び手側に回るって、役割が逆になったみたい。これって大きい変化?The AI moved from being a child process to the caller side—it sounds like the roles flipped. Is that a big change?
  2. TECHガイドTECH Guideうん、この記事では最大の転換とされているよ。コマンドの置き換えでは足りず、出力やエラー、AIの置き場所まで見直しているんだ。Yes—the piece calls it the biggest shift. Replacing commands wasn’t enough; the output, error handling, and even where the AI sits all had to be reconsidered.
  3. ポコPoko「prepare/save」パターンって、どういう仕組みなの?What does the “prepare/save” pattern mean here?
  4. TECHガイドTECH GuideMCP版では、サーバーがAIを子プロセスとして呼ばず、ホストAIが呼び手になる設計だよ。その組み替えを「prepare/save」と呼んでいるんだ。In the MCP version, the server no longer launches AI as a child process. The host AI becomes the caller, and that redesigned flow is described as the “prepare/save” pattern.
  5. ポコPokoぼくならRSSを集めて、AIと相談しながら記事の下書きまで進めてみたいな。I’d like to collect RSS feeds and work with the AI all the way through an article draft.
  6. TECHガイドTECH Guideその用途に近いね。出力は人向けのMarkdownと機械向けのJSONに分かれるけれど、これは筆者の実例で、すべてのMCP設計に当てはまるとは限らないよ。That’s close to this use case. The output combines human-readable Markdown with machine-readable JSON, but this is one author’s implementation, not a design guaranteed to fit every MCP project.
記事情報・収集記録Article details & collection record
出典Source
Zenn MCPコミュニティCommunity
公開日時 (JST)Published (JST)
収集日時 (JST)Collected (JST)
配信形式Format
ブログBlog
原文言語Source language
JA
重要度の位置づけImportance in this lane
MediumMedium priority(MCP / Tooling 122件中、同等以上 112件)(112 of 122 MCP / Tooling entries are equal or higher)
出典の平均重要度(掲載直近 30 件・最大 30 件)Source average (last 30 listed, up to 30)
2.0 / 31=情報 · 2=中 · 3=高1=Info · 2=Medium · 3=High
情報の寿命Half-life
中期 (チュートリアル)Medium-term (tutorial)

🔗MCP / Tooling の他の記事More from MCP / Toolingもっと見る →View more →

ページ上部へScroll to top