Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Zennの記事を収集するMCPサーバーを作ってみた

Avatar for tree__and__tree tree__and__tree
July 16, 2025
2

 Zennの記事を収集するMCPサーバーを作ってみた

# 作ったもの

https://github.com/YusukeHayashiii/zenn-topic-summarize

# 参考文献

- [Model Context Protocol](https://modelcontextprotocol.io/introduction)
- [mcp-for-beginners](https://github.com/microsoft/mcp-for-beginners)
- [【徹底解説】MCPとは?「AIのUSBポート」](https://qiita.com/syukan3/items/f74b30240eaf31cb2686)
- [modelcontextprotocol/python-sdk](https://github.com/modelcontextprotocol/python-sdk)
- [Claude Codeの設定](https://docs.anthropic.com/ja/docs/claude-code/settings)
- [Gemini CLIの設定](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md)
- [Cursorの設定](https://docs.cursor.com/context/mcp#model-context-protocol-mcp)
- [大手企業のAIツール導入の壁を超えて:サイバーエージェントのCursor活用戦略](https://speakerdeck.com/gunta/da-shou-qi-ye-noaiturudao-ru-nobi-woyue-ete-saibaezientonocursorhuo-yong-zhan-lue)

Avatar for tree__and__tree

tree__and__tree

July 16, 2025
Tweet

Transcript

  1. 2 / 25 自己紹介 名前: 林 佑亮(Hayashi Yusuke) 所属: マーケティングリサーチの会社

    普段やっていること: AI エバンジェリスト(自称) LLM 関連のPoC 社内分析環境構築 ナレッジシェア推進
  2. 5 / 25 MCP とは? Model Context Protocol の略 2024

    年11 月にAnthropic が発表 AI モデルが外部のデータソース・ツールと通信や操 作をするための統一規格 AI モデルをより簡単に機能拡張できるように Confluence のページ作成、編集 ブラウザ操作 データベースへのアクセス など
  3. 6 / 25 MCP の構成要素 ↓今回はこれを作った MCP サーバー: クライアントからのリクエストに処 理し、ツールやデータソース機能を提供するサーバ

    ー Internet Your Computer MCP Protocol MCP Protocol MCP Protocol Web APIs Host with MCP (VScode, IDEs, Tools) MCP Server A MCP Server B MCP Server C Local Data Source A Local Data Source B Remote Services
  4. 9 / 25 MCP サーバー 「zenn-mcp 」 二つのツールから構成されている 1. search_zenn_articles

    : 特定のトピックを指定してZenn の記事を取得 2. get_trending_articles : Zenn のトレンド記事を取得 ` ` ` ` # app/main.py より抜粋 from mcp.server.fastmcp import FastMCP mcp = FastMCP("zenn-mcp") @mcp.tool() def search_zenn_articles(topic: str, max_articles: int = 10) -> str: """Zenn から指定トピックの記事フィードを取得""" # ... 記事取得処理 ... return " 取得結果のMarkdown 文字列" @mcp.tool() def get_trending_articles(max_articles: int = 10) -> str: """Zenn から現在のトレンド記事フィードを取得""" # ... トレンド記事取得処理 ... return " 取得結果のMarkdown 文字列"
  5. 10 / 25 「zenn-mcp 」のアーキテクチャ MCP 実装: FastMCP を採用し、デコレータベースで実装 #

    app/main.py より抜粋 from mcp.server.fastmcp import FastMCP mcp = FastMCP("zenn-mcp") @mcp.tool() @mcp.tool() def search_zenn_articles(topic: str, max_articles: int = 10) -> str: """Zenn から指定トピックの記事フィードを取得""" # ... 記事取得処理 ... return " 取得結果のMarkdown 文字列" def get_trending_articles(max_articles: int = 10) -> str: """Zenn から現在のトレンド記事フィードを取得""" # ... トレンド記事取得処理 ... return " 取得結果のMarkdown 文字列"
  6. 11 / 25 「zenn-mcp 」のアーキテクチャ クローラー: requests + BeautifulSoup4 でZenn

    のフィードを直接パース ` ` ` ` # app/crawler.py より抜粋 import requests from bs4 import BeautifulSoup response = requests.get(feed_url, timeout=self.timeout) response.raise_for_status() soup = BeautifulSoup(response.content, "xml") items = soup.find_all("item") from typing import List, Dict, Optional class ZennCrawler: """Zenn から記事を取得するクローラー""" def fetch_articles_from_feed(self, topic: str, max_articles: int = 10) -> List[Dict]: """Zenn トピックフィードから記事を取得する""" # ... 記事取得処理 ... # ... 記事のリストを出力 ... return articles
  7. 12 / 25 「zenn-mcp 」のセットアップ 作成したサーバーをMCP ホストに認識させるために、サーバーの起動コマンドを記述 Claude Code の場合:

    ~/.claude/.mcp.json Gemini CLI の場合: ~/.gemini/settings.json Cursor の場合: Cursor Settings → ~/.cursor/mcp.json ` ` ` ` ` ` // ~/.claude/.mcp.json { "mcpServers": { "zenn-mcp": { "command": "uv", "args": [ "--directory", "/path/to/zenn_mcp_dev", "run", "app/main.py" ] } } }
  8. 13 / 25 利用イメージ MCP ホストに話しかけるだけで、Zenn の記事を簡単に取得可能 Claude Code でも

    Gemini CLI でも Cursor でも 例1: トピックを指定して記事を検索 Zenn でmcp の最新記事を教えて → search_zenn_articles(topic="mcp") が実行 される 例2: トレンド記事を取得 Zenn のトレンドを教えて → get_trending_articles() が実行される →実践します ` ` ` `
  9. 18 / 25 なぜ作るか MCP の筋がいい? →現状、AI を活用するうえで何らかの機能拡張はほぼ必須で、そこにアプローチできる →AI のできることを増やす=AI

    活用のレベルが上がる →業務改善に繋がりそう&なんか新しいこともできそう →自作できると拡張したい機能を自分で作って使える 「欲しい」と思ったら誰かの実装を待たなくて良い それでもあくまで現状なので、今後どうなるかはわかりません…… が、変化が早い時ほど「いったん触る」が大事っぽそう
  10. 20 / 25 何を作るか 公式サービス系(GitHub, Notion, Slack など)はMCP がすでに出てるor 有志が作ってることが多い

    →一歩踏み込んだものの方が消費期限が長そう →業務特有の操作とか、ちょっとニッチな機能とか →ちょっと調べた感じ、Zenn 絡みのMCP はあまりなさそう
  11. 25 / 25 参考文献 Model Context Protocol mcp-for-beginners 【徹底解説】MCP とは?「AI

    のUSB ポート」 modelcontextprotocol/python-sdk Claude Code の設定 Gemini CLI の設定 Cursor の設定 大手企業のAI ツール導入の壁を超えて:サイバーエージェントのCursor 活用戦略