Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
MCP Clientを活用するための設計と実装上の工夫
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Yudai Hayashi
June 02, 2025
Technology
1.4k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
MCP Clientを活用するための設計と実装上の工夫
MCPOps LT大会で発表した内容になります
connpass:
https://mlops.connpass.com/event/352150/
Yudai Hayashi
June 02, 2025
Transcript
11 slides
© 2025 Wantedly, Inc. MCP Clientを活用するための設計と 実装上の工夫 MCP Ops LT大会
Jun. 2 2025 - Yudai Hayashi
© 2025 Wantedly, Inc. 自己紹介 林 悠大 • 経歴: ◦
2022年に応用物理分野で Ph.D取得 ◦ 2022年にウォンテッドリー株式会社に新卒入社。データサイ エンティストとして推薦システムの開発に従事 @python_walker @Hayashi-Yudai
© 2025 Wantedly, Inc. MCP Client をプロダクト内に実装することによる可能性 Clientを持っておくことで、LLMを “利用して” 価値を提供できる
MCP Server Use プロダクトはLLMに利用される Service w/ MCP Client Use Use MCP Servers プロダクトがLLMを利用する
© 2025 Wantedly, Inc. 今日のメイントピック MCP Clientをチャットアプリに実装した話 • MCP Clientをどのように実装すれば良いのか、その一例を伝えたい
• どういうところが難しくて、工夫が必要だったか紹介したい 今日お話しするコードは ↓の一部です https://github.com/Hayashi-Yudai/aichat 参考資料
© 2025 Wantedly, Inc. アプリケーションの構成 MCP Servers Application LLMs •
ユーザーからリクエストを受け取り、 MCP ServerやLLMとやりとりをする一般的な構成 • MCP ServerからTool一覧を取得してLLMにリ クエストをするときに一緒に渡す • ユーザーメッセージに特定パターンがあるとき に、Promptを呼び出す ◦ e.g. /search が入っていたらある Promptを呼び出す
© 2025 Wantedly, Inc. 実装で工夫する必要があった部分 MCP Servers Application LLMs •
課題 1:MCP Serverとのセッション管理 • 課題 2:複数のMCP Serverの管理
© 2025 Wantedly, Inc. 課題 1:MCP Serverとのセッション管理 Application Front ChatGPT
Gemini … アプリケーションの機能 • ユーザーは何往復もチャットを繰り返すことがで きる • チャットの途中からモデルを切り替えることがで きる チャット継続中に常にセッションを保持しておくのは 大変そう。とは言えリクエストの度にセッションを確 立するのもパフォーマンス的に悪そう ...
© 2025 Wantedly, Inc. 課題 1:MCP Serverとのセッション管理 リクエスト毎に必要な情報はあらかじめ取得しておく • リクエストの度に必要な
Serverの情報は限られている。しかも、それらは普通は静的 ◦ Tools, Prompts, Resourcesの一覧 • Application起動時に全て取得しておけば良さそう • リクエスト処理時には、必要に応じて MCP Serverと接続をする (Tool Call時など) ツールの一覧をインスタンス変数として保持してお く
© 2025 Wantedly, Inc. 課題 2:複数のMCP Serverの管理 • Tool名だけ管理していると、 LLMからTool
Call が来たときに、どのServerに接続すれば良い かわからない ◦ こっちは実はTool一覧をキャッシュするこ とで半分解決している • Tool名に重複があるときに特に問題になる Application Tool 1 を使いたい どのServer?
© 2025 Wantedly, Inc. 課題 2:複数のMCP Serverの管理 Server名とツール名をセットで管理する Server2__Tool 1
を使いたい Tool名の世界 LLMInterface Handler {Server名}__{Tool名}の世界 Server2__Tool 1 Tool 1 Server1__Tool1 Server1__Tool2 … • Handlerを用意、LLMにはツール名を Server__Tool の形式で渡しておく • リクエストが来たら、 Handlerで分解し て適切なServerにリクエスト
© 2025 Wantedly, Inc. まとめ • チャットアプリの中に MCP Clientを実装してみて、工夫が必要だった点をいくつか紹介 •
MCP ServerとのSessionは、アプリ起動時と呼び出しがあるときの 2通りのケースで保持するようにす れば良さそう • 複数のMCP Serverを扱う際には、LLMにリクエストを投げる部分と MCP Serverの間にHandlerを用 意して交通整理をするのが良さそう
More Decks by Yudai Hayashi
See All by Yudai Hayashi
技術キャッチアップ効率化を実現する記事推薦システムの構築
yudai00
4
400
Off-Policy Evaluation and Learning for Matching Markets
yudai00
0
190
ジョブマッチングプラットフォームにおける推薦アルゴリズムの活用事例
yudai00
0
260
ユーザーのプロフィールデータを活用した推薦精度向上の取り組み
yudai00
0
820
人とシゴトのマッチングを実現するための機械学習技術
yudai00
1
160
MCPを理解する
yudai00
18
16k
データバリデーションによるFeature Storeデータ品質の担保
yudai00
1
310
「仮説行動」で学んだ、仮説を深め ていくための方法
yudai00
8
2.2k
相互推薦システムでのPseudo Label を活用したマッチ予測精度向上の取り組み
yudai00
1
1.2k
Other Decks in Technology
See All in Technology
メール到達性を支える、リンク先URLのドメイン評価の扱い方
wind111
0
170
速くなるほど、深く考える AI時代のQAに学ぶ
kobayashiyorimitsu
0
270
共通基盤の実装に Kotlin - Quarkus を選定した理由と採用したアーキテクチャ
nealle
1
140
Del vibe coding a un Desarrollo (agéntico) fiable
jcabot
0
170
お風呂場をサーバルームにしよう
yusuke427
0
360
Kansai WordPress Meetup@大阪『ブロックテーマを作る上で知っておくべきこと
torounit
0
250
HTTP通信に使おうとすると実はめんどくさいfile_get_contents
maguroalternative
0
220
設計手法を「道具」として使いこなすために
a_suenami
6
1.1k
閉域網でのAPI公開の選択肢全部比較!
takano0131
4
560
ラクスル会社紹介資料|エンジニア向け / RAKSUL Introduction for Engineers
raksulrecruiting
0
140
Context parameters で作る!はじめての型クラス
kworkdev
PRO
1
150
DevOps Agentにあらゆるセキュリティインシデントのトリアージを任せた件
jirtosterone
1
190
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3.1k
Un-Boring Meetings
codingconduct
0
500
How to make the Groovebox
asonas
2
2.6k
Unsuck your backbone
ammeep
672
58k
Git: the NoSQL Database
bkeepers
PRO
433
67k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
1
300
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.5k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.2k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
450
The Limits of Empathy - UXLibs8
cassininazir
2
790
GitHub's CSS Performance
jonrohan
1033
470k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1.1k