ð§ Ultimate MCP Server
ããŒã«ã«ð§ Ultimate MCP Server ã«ã€ããŠ
Ultimate MCP Server ã¯ãè€æ°ãããã€ããŒãžã® LLM å§è²ããã©ãŠã¶ãŒèªååãããã¥ã¡ã³ãåŠçããã¯ãã«æäœãèªç¥ã¡ã¢ãªãŒãªã©å€ãã®æ©èœã AI ãšãŒãžã§ã³ãã«æäŸãã MCP ããŒã¹ã®ãµãŒããŒã§ããè€æ°ã®ããŒã«ãçµã¿åãããŠäœ¿ããšãŒãžã§ã³ãã®éçºè ã察象ãšããã³ã¹ããæ§èœãå質ã®ãã©ã³ã¹ãéèŠããŠèšèšãããŠããŸãã
äž»ãªæ©èœ
- 01ã³ã¹ããèæ ®ãããã«ããããã€ã㌠LLM å§è²
- 02Playwright ã«ãããã©ãŠã¶ãŒèªåå
- 03ã¯ãŒãã³ã°ããšããœãŒããã»ãã³ãã£ãã¯ãæç¶ãèšæ¶ã®èªç¥ã¡ã¢ãªãŒ
- 04ããã¥ã¡ã³ãã®ãã£ã³ã¯åå²ãèŠçŽãæ§é åæœåº
- 05èš±å¯ãã£ã¬ã¯ããªã§å¢çãå®ãããã¡ã€ã«ã·ã¹ãã æäœ
- 06Excel ã¹ãã¬ããã·ãŒãã®èªåå
掻çšã·ãŒã³
- 01èŠçŽãæœåºã¿ã¹ã¯ãäœã³ã¹ãã®ã¢ãã«ãžå§è²ãã
- 02ãšãŒãžã§ã³ãã®è€æ°ã¹ãããã«ãããç¶æ ãšã³ã³ããã¹ããä¿æãã
- 03Web 調æ»ãèªååããçµæãã¬ããŒãã«ãŸãšãã
MCP 察å¿
æ¬ãããžã§ã¯ã㯠MCP ãµãŒããŒã§ããããã®ããŒã«ãæ©èœãæšæºç㪠MCP ããŒã«ãšããŠå ¬éããClaude ãªã©ã® MCP ã¯ã©ã€ã¢ã³ãããåŒã³åºããããã«ããŸãã
èšå®
ããŒã«ã«ãµãŒããŒã®èšå®ã¯ã©ã®ã¯ã©ã€ã¢ã³ãã§ãå ±éã§ããã³ããŒããŠã¯ã©ã€ã¢ã³ãã® MCP èšå®ãã¡ã€ã«ã«è²Œãä»ããŠãã ããã
ãã®ãµãŒããŒã®ããã±ãŒãžããªã¢ãŒããšã³ããã€ã³ãã¯ãŸã ååŸã§ããŠããŸããããããžã§ã¯ãã® README ã®æé ã«åŸã£ãŠãã ããã
ããŒã«
ããŒã«ã«ãµãŒããŒã®ããŒã«ã¯ãã·ã³äžã§èµ·åããŠåããŠååŸã§ããŸããã¡ã³ãããŒã¯ãŸã ããŒã«äžèЧãæäŸããŠããŸããã
詳现
ð§ Ultimate MCP Server
èªç¥èœåã®æ¡åŒµãããŒã«ã®äœ¿çšãã€ã³ããªãžã§ã³ããªãªãŒã±ã¹ãã¬ãŒã·ã§ã³ã®ããã®ãæ°åãã®åŒ·åãªæ©èœãé«åºŠãª AI ãšãŒãžã§ã³ãã«æäŸããå æ¬ç㪠Model Context ProtocolïŒMCPïŒãµãŒããŒ
ã¯ããã« â¢ äž»ãªæ©èœ ⢠䜿çšäŸ ⢠ã¢ãŒããã¯ãã£
ð€ Ultimate MCP Server ãšã¯ïŒ
Ultimate MCP Server ã¯ãå®å šãª AI ãšãŒãžã§ã³ãçšãªãã¬ãŒãã£ã³ã°ã·ã¹ãã ãšããŠæ©èœãããå æ¬ç㪠MCP ãã€ãã£ãã·ã¹ãã ã§ããModel Context Protocol ãéããŠæ°åãã®åŒ·åãªæ©èœãå ¬éããé«åºŠãª AI ãšãŒãžã§ã³ããè±å¯ãªããŒã«ãèªç¥ã·ã¹ãã ãå°éãµãŒãã¹ã®ãšã³ã·ã¹ãã ãå©çšã§ããããã«ããŸãã
é«åºŠãªã¢ãã«ïŒäŸïŒClaude 3.7 SonnetïŒããè²»çšå¯Ÿå¹æã®é«ãã¢ãã«ïŒäŸïŒGemini Flash 2.0 LiteïŒãžã®ã€ã³ããªãžã§ã³ããªã¿ã¹ã¯å§ä»»ãåããŠããŸãããããã¯å¹ åºãæ©èœã®äžåŽé¢ã«ãããŸããããã®ãµãŒããŒã¯è€æ°ã® LLM ãããã€ããŒãžã®çµ±äžãããã¢ã¯ã»ã¹ãæäŸããªãããã³ã¹ããããã©ãŒãã³ã¹ãå質ãæé©åããŸãã
ãã®ã·ã¹ãã ã«ã¯ãçµ±åãããèªç¥ã¡ã¢ãªã·ã¹ãã ããã©ãŠã¶ãŒèªååãExcel æäœãããŒã¿ããŒã¹é£æºãããã¥ã¡ã³ãåŠçãã³ãã³ãã©ã€ã³ãŠãŒãã£ãªãã£ãåç㪠API çµ±åãOCR æ©èœããã¯ãã«æäœããšã³ãã£ãã£é¢ä¿ã°ã©ããSQL ããŒã¿ããŒã¹é£æºãé³å£°æåèµ·ãããªã©ãããŸããŸãªæ©èœãåãã£ãŠããŸãããããã®æ©èœã«ãã£ãŠãAI ãšãŒãžã§ã³ãã¯åãªãäŒè©±ã€ã³ã¿ãŒãã§ãŒã¹ãããããžã¿ã«ç°å¢å šäœã§è€éãªè€æ°ã¹ãããã®æäœãå®è¡ã§ãã匷åãªèªåŸã·ã¹ãã ãžãšå€ãããŸãã
---## ð¯ ããžã§ã³ïŒå®å šãª AI ãšãŒãžã§ã³ãçšãªãã¬ãŒãã£ã³ã°ã·ã¹ãã
Ultimate MCP Server ã¯ããã®äžæ žã«ãããŠãããžã¿ã«ç°å¢ã§ã® AI ãšãŒãžã§ã³ãã®åäœãæ ¹æ¬ããå€ãããã®ã§ããAI åãã®å æ¬çãªãªãã¬ãŒãã£ã³ã°ã·ã¹ãã ãšããŠãæ¬¡ã®æ©èœãæäŸããŸãã
- ð§ æ°žç¶çãªã¡ã¢ãªãæšè«ãã³ã³ããã¹ãèªèãå¯èœã«ããçµ±äžãããèªç¥ã¢ãŒããã¯ãã£
- âïž ãŠã§ãé²èЧãããã¥ã¡ã³ãåŠçãããŒã¿åæãªã©ãå¹ åºãåéã«ãããæ°åãã®å°çšããŒã«ãžã®ã·ãŒã ã¬ã¹ãªã¢ã¯ã»ã¹
- ð» ãã¡ã€ã«ã·ã¹ãã æäœãããŒã¿ããŒã¹é£æºãã³ãã³ãã©ã€ã³ãŠãŒãã£ãªãã£ã®ããã®ã·ã¹ãã ã¬ãã«æ©èœãžã®çŽæ¥ã¢ã¯ã»ã¹
- ð è€éãªè€æ°ã¹ãããã®ã¿ã¹ã¯ã®ãªãŒã±ã¹ãã¬ãŒã·ã§ã³ãšå®è¡ãå¯èœã«ãããåçãªã¯ãŒã¯ãããŒæ©èœ
- ð ã³ã¹ããå質ãããã©ãŒãã³ã¹ãæé©åãããããŸããŸãª LLM ãããã€ããŒãšã®ã€ã³ããªãžã§ã³ããªçµ±å
- ð AI æ©èœã匷åããé«åºŠãªãã¯ãã«æäœããã¬ããžã°ã©ããæ€çŽ¢æ¡åŒµçæ
ãã®ã¢ãããŒãã¯ãé«åºŠãªãªãã¬ãŒãã£ã³ã°ã·ã¹ãã ãã¢ããªã±ãŒã·ã§ã³ã«ããŒããŠã§ã¢ããµãŒãã¹ããªãœãŒã¹ãžã®ã¢ã¯ã»ã¹ãæäŸããä»çµã¿ã«äŒŒãŠããŸãããã ããAI ãšãŒãžã§ã³ãã®èœåãæ¡åŒµããæ¬æ¥åãã£ãŠããèœåãè¶ ãã匷åãªæ°æ©èœãæäŸããããšãç®çã«èšèšãããŠããŸãã
ð MCP ãã€ãã£ãã¢ãŒããã¯ãã£
ãã®ãµãŒããŒã¯ãModel Context ProtocolïŒMCPïŒ ã®ã¿ãåºç€ãšããŠæ§ç¯ãããŠãããããClaude ã®ãã㪠AI ãšãŒãžã§ã³ããšé£æºããããšãåæã«èšèšãããŠããŸãããã¹ãŠã®æ©èœã¯æšæºåããã MCP ããŒã«ãéããŠå ¬éããããšãŒãžã§ã³ãããçŽæ¥åŒã³åºããŸããããã«ãããAI ãšãŒãžã§ã³ããšãæ©èœããµãŒãã¹ãå€éšã·ã¹ãã ããæãå æ¬çãªãšã³ã·ã¹ãã ãšã®éã«ãã·ãŒã ã¬ã¹ãªçµ±åã¬ã€ã€ãŒãå®çŸããŸãã
𧬠䞻ãªãŠãŒã¹ã±ãŒã¹ïŒAI ãšãŒãžã§ã³ãã®æ©èœæ¡åŒµãšãšã³ã·ã¹ãã
Ultimate MCP Server ã¯ãClaude 3.7 Sonnet ã®ãã㪠AI ãšãŒãžã§ã³ãããããžã¿ã«ç°å¢å šäœã§é«åºŠãªæäœãå®è¡ã§ããèªåŸã·ã¹ãã ãžãšå€é©ããŸãã
interacts with
âââââââââââââââ ââââââââââââââââââââââââ⺠âââââââââââââââââââââ ââââââââââââââââ
â Claude 3.7 â â Ultimate MCP â ââââââââºâ LLM Providersâ
â (Agent) â âââââââââââââââââââââââââ â Server â âââââââââ External â
âââââââââââââââ returns results âââââââââââââââââââââ â Systems â
â ââââââââââââââââ
âŒ
âââââââââââââââââââââââââââââââââââââââââââââââ
â Cognitive Memory Systems â
â Web & Data: Browser, DB, RAG, Vector Search â
â Documents: Excel, OCR, PDF, Filesystem â
â Analysis: Entity Graphs, Classification â
â Integration: APIs, CLI, Audio, Multimedia â
âââââââââââââââââââââââââââââââââââââââââââââââ
ã¯ãŒã¯ãããŒã®äŸïŒ
- AI ãšãŒãžã§ã³ãããæšæºæ©èœãè¶ ããè€æ°ã®èœåãå¿ èŠãšããè€éãªã¿ã¹ã¯ãåãåããŸã
- ãšãŒãžã§ã³ã㯠Ultimate MCP Server ã䜿çšããå¿ èŠã«å¿ããŠå°éçãªããŒã«ããµãŒãã¹ã«ã¢ã¯ã»ã¹ããŸã
- ãšãŒãžã§ã³ãã¯èªç¥ã¡ã¢ãªã·ã¹ãã ãæŽ»çšããŠãæäœäžã®ç¶æ ãšã³ã³ããã¹ããç¶æã§ããŸã
- 調æ»ãããŒã¿åæãããã¥ã¡ã³ãäœæããã«ãã¡ãã£ã¢åŠçãšãã£ãè€éãªã¿ã¹ã¯ãå¯èœã«ãªããŸã
- ãšãŒãžã§ã³ãã¯ãããŸããŸãªããŒã«ãé«åºŠãªæé ã§çµã¿åãããè€æ°ã¹ãããã®ã¯ãŒã¯ãããŒããªãŒã±ã¹ãã¬ãŒã·ã§ã³ã§ããŸã
- çµæã¯æšæºã® MCP 圢åŒã§è¿ãããããããšãŒãžã§ã³ãã¯çµæãçè§£ããŠæ±ãããšãã§ããŸã
- é©åãªã¿ã¹ã¯ãããå¹ççãªã¢ãã«ã«å§ä»»ããããšã§ãã³ã¹ããæé©åã§ããããšãéèŠãªã¡ãªããã§ã
ãã®çµ±åã«ãããAI ãšãŒãžã§ã³ãã¯ãªãœãŒã¹ãã€ã³ããªãžã§ã³ãã«æŽ»çšããªãããè€éãªãããžã§ã¯ããèªåŸçã«å®äºã§ããããã«ãªããŸããé©åãªå Žé¢ã§å°éçãªããŒã«ãè²»çšå¯Ÿå¹æã®é«ãã¢ãã«ã䜿çšããããšã§ãAPI ã³ã¹ãã 70ïœ90ïŒ åæžã§ããå¯èœæ§ããããŸãã
ð¡ Ultimate MCP Server ã䜿çšããçç±
ð§° å æ¬ç㪠AI ãšãŒãžã§ã³ãããŒã«ããã
é«åºŠãª AI ãšãŒãžã§ã³ããå¹ åºãããŒã«ãšã³ã·ã¹ãã ã«ã¢ã¯ã»ã¹ã§ãããçµ±åããã§ãã
- ð (Playwright çµ±åã«ãã) è€éãªãŠã§ãèªååã¿ã¹ã¯ãå®è¡ããŸãã
- ð Excel ã¹ãã¬ããã·ãŒããæ·±ãçµ±åããŠæäœã»åæããŸãã
- ð§ ãšãŒãžã§ã³ãã®ç¶æ ãæ°žç¶çã«ä¿æãããè±å¯ãªèªç¥ã¡ã¢ãªã·ã¹ãã ã«ã¢ã¯ã»ã¹ããŸãã
- ðŸ ãã¡ã€ã«ã·ã¹ãã ãå®å šã«æäœããŸãã
- ðïž SQL æäœãéããŠããŒã¿ããŒã¹ãæäœããŸãã
- ðŒïž OCR æ©èœã§ããã¥ã¡ã³ããåŠçããŸãã
- ð é«åºŠãªãã¯ãã«æ€çŽ¢ãšRAGæäœãå®è¡ããŸãã
- ð·ïž å°éçãªããã¹ãåŠçãšåé¡ãå©çšããŸãã
- âšïž ripgrepãawkãsedãjq ãªã©ã®ã³ãã³ãã©ã€ã³ããŒã«ã掻çšããŸãã
- ð å€éšã®REST APIãåçã«çµ±åããŸãã
- âš èªå·±çºèŠãæé©åãããã¥ã¡ã³ãã®æ¹åã«ã¡ã¿ããŒã«ã䜿çšããŸãã
ðµ ã³ã¹ãã®æé©å
é«åºŠãªã¢ãã«ã® API ã³ã¹ãã¯é«é¡ã«ãªãããšããããŸããUltimate MCP Server ã¯ã以äžã®æ¹æ³ã§ã³ã¹ãåæžãæ¯æŽããŸãã
- ð é©åãªã¿ã¹ã¯ãããå®äŸ¡ãªã¢ãã«ã«æ¯ãåããŸãïŒäŸïŒ1K ããŒã¯ã³ããã $0.01 ãš $0.15ïŒã
- â¡ é«åºŠãªãã£ãã·ã¥ïŒå®å šäžèŽãã»ãã³ãã£ãã¯ãã¿ã¹ã¯èªèåïŒãå®è£ ããAPI ã®éè€åŒã³åºããåé¿ããŸãã
- ð° ãããã€ããŒéã®ã³ã¹ããè¿œè·¡ã»æé©åããŸãã
- ð§ ã³ã¹ããèæ ®ããã¿ã¹ã¯ã®æ¯ãåããå¯èœã«ããŸãã
- ð ïž å®ååŠçããLLM ã䜿çšããªãå°éããŒã«ïŒãã¡ã€ã«ã·ã¹ãã ãCLI ãŠãŒãã£ãªãã£ãªã©ïŒã§åŠçããŸãã
ð ãããã€ããŒã®æœè±¡å
çµ±äžã€ã³ã¿ãŒãã§ãŒã¹ã§ãããã€ããŒãžã®äŸåãåé¿ã§ããŸãã
- ð OpenAIãAnthropicïŒClaudeïŒãGoogleïŒGeminiïŒãxAIïŒGrokïŒãDeepSeekãOpenRouterãããã³ããŒã«ã«ã® OpenAI äºæãµãŒããŒïŒOllamaãllama.cppãmistral.rsãvLLMãLM StudioïŒåãã®æšæº API ãæäŸããŸãã
- ð ç¡æã®ããŒã«ã«æšè«ïŒèšå®å¯èœãªåäžã®
localãããã€ããŒããbase_urlãä»ããŠä»»æã® OpenAI äºæããŒã«ã«ãµãŒããŒãšéä¿¡ããŸããã³ã¹ãã¯**$0**ãšããŠèšäžããããããã³ã¹ããªããã£ãã€ã¶ãŒã¯å§ä»»ããäœæ¥ã«ããŒã«ã«ãµãŒããŒãåªå ããŸãã - âïž ãã©ã¡ãŒã¿ãŒåŠçãšã¬ã¹ãã³ã¹åœ¢åŒãçµ±äžããŸãã
- ð ã¢ããªã±ãŒã·ã§ã³ã³ãŒãã倿Žããã«ãããã€ããŒãåãæ¿ããããŸãã
- ð¡ïž ãã©ãŒã«ããã¯æ©æ§ã«ããããããã€ããŒåºæã®é害ãå¶éããä¿è·ããŸãã
ð å æ¬çãªããã¥ã¡ã³ãããã³ããŒã¿åŠç
ããã¥ã¡ã³ããããŒã¿ãå¹ççã«åŠçã§ããŸãã
- âïž ããã¥ã¡ã³ããæå³çã«ãŸãšãŸãã®ãããã£ã³ã¯ã«åå²ããŸãã
- ð è€æ°ã®ã¢ãã«ã䜿ã£ãŠãã£ã³ã¯ã䞊ååŠçããŸãã
- ð éæ§é åããã¹ãããæ§é åããŒã¿ïŒJSONã衚ãããŒãšå€ïŒãæœåºããŸãã
- âïž å€§éã®ããã¹ãããèŠçŽãã€ã³ãµã€ããçæããŸãã
- ð 圢åŒã倿ããŸãïŒHTML ãã Markdown ãžãããã¥ã¡ã³ãããæ§é åããŒã¿ãžïŒã
- ðïž ç»åã PDF ã« OCR ãé©çšãããªãã·ã§ã³ã§ LLM ã«ããæ¡åŒµåŠçãè¡ããŸãã
ð äž»ãªæ©èœ
ð MCP ãããã³ã«çµ±å
- ãã€ãã£ã MCP ãµãŒããŒïŒModel Context Protocol ãåºç€ãšããŠãããAI ãšãŒãžã§ã³ããšã·ãŒã ã¬ã¹ã«çµ±åã§ããŸãã
- MCP ããŒã«ãã¬ãŒã ã¯ãŒã¯ïŒãã¹ãŠã®æ©èœããæç¢ºãªã¹ããŒããåããæšæºå MCP ããŒã«ãšããŠå ¬éããŸãã
- ããŒã«ã®åæïŒäŸåé¢ä¿ã䜿çšããŠãã¯ãŒã¯ãããŒå ã§ããŒã«ãçµã¿åãããããŸãã
- ããŒã«ã®æ€åºïŒãšãŒãžã§ã³ãåãã«ãåçãªäžèŠ§è¡šç€ºãšæ©èœã®æ€åºããµããŒãããŸãã
ð€ ã€ã³ããªãžã§ã³ããªã¿ã¹ã¯å§ä»»
- ã¿ã¹ã¯ã®ã«ãŒãã£ã³ã°ïŒã¿ã¹ã¯ãåæããé©åãªã¢ãã«ãŸãã¯å°éããŒã«ã«æ¯ãåããŸãã
- ãããã€ããŒã®éžæïŒã¿ã¹ã¯ã®èŠä»¶ãã³ã¹ããå質ãé床ã«é¢ããåªå èšå®ã«åºã¥ããŠããããã€ããŒïŒã¢ãã«ãéžæããŸãã
- ã³ã¹ããšããã©ãŒãã³ã¹ã®ãã©ã³ã¹èª¿æŽïŒå§ä»»æŠç¥ãæé©åããŸãã
- å§ä»»ã®è¿œè·¡ïŒå§ä»»ã®åŸåãã³ã¹ããçµæãç£èŠããŸãïŒAnalytics ã䜿çšïŒã
ð ãããã€ããŒçµ±å
- è€æ°ãããã€ããŒã®ãµããŒãïŒOpenAIãAnthropicãGoogleãDeepSeekãxAIïŒGrokïŒãOpenRouterãããã³åäžã®èšå®å¯èœãª
localãããã€ããŒãä»ããããŒã«ã«ã® OpenAI äºæãµãŒããŒïŒOllamaãllama.cppãmistral.rsãvLLMãLM StudioïŒãã第äžçŽã®ãµããŒã察象ãšããŠããŸããæ¡åŒµå¯èœãªã¢ãŒããã¯ãã£ã§ãã - ç¡æã®ããŒã«ã«æšè«ïŒ
localãããã€ããŒã®ã³ã¹ãã¯**$0**ãšããŠèšäžãããããã察å¿å¯èœãªããŒã«ã«ã¢ãã«ãèšå®ãããŠããã°ãã€ã³ããªãžã§ã³ããªå§ä»»ïŒã³ã¹ãæé©åã¬ã€ã€ãŒããã³ã¹ãéèŠã®ã¿ã¹ã¯ïŒèŠçŽãæœåºãç°¡å㪠Q&AãæžåŒèšå®ïŒãã䜿ãã®ããŒããŠã§ã¢ã«æ¯ãåããŸãã - ã¢ãã«ç®¡çïŒããŸããŸãªã¢ãã«ã®èœåãã³ã³ããã¹ããŠã£ã³ããŠãæéã管çããŸããèªåéžæãšãã©ãŒã«ããã¯ã®ä»çµã¿ãåããŠããŸãã
ðŸ é«åºŠãªãã£ãã·ã¥
- ãã«ãã¬ãã«ãã£ãã·ã¥ïŒå®å šäžèŽãæå³çé¡äŒŒæ§ãã¿ã¹ã¯å¯Ÿå¿ã®åæŠç¥ãåããŠããŸãã
- æ°žç¶ãã£ãã·ã¥ïŒãã£ã¹ã¯ããŒã¹ã®æ°žç¶åïŒäŸïŒDiskCacheïŒãšãé«éãªã¡ã¢ãªå ã¢ã¯ã»ã¹ã¬ã€ã€ãŒãåããŠããŸãã
- ãã£ãã·ã¥åæïŒãã£ãã·ã¥ãããçãšæšå®ã³ã¹ãåæžé¡ã远跡ããŸãã
ð ããã¥ã¡ã³ãããŒã«
- ã¹ããŒããªãã£ã³ã¯åå²ïŒããŒã¯ã³ããŒã¹ãæå³çå¢çã®æ€åºãæ§é åæã®åææ³ã«å¯Ÿå¿ããŠããŸãããªãŒããŒã©ãããèšå®ã§ããŸãã
- ããã¥ã¡ã³ãæäœïŒèŠçŽïŒæ®µèœãç®æ¡æžãïŒããšã³ãã£ãã£æœåºã質åçæããããåŠçã«å¯Ÿå¿ããŠããŸãã
ð ã»ãã¥ã¢ãªãã¡ã€ã«ã·ã¹ãã æäœ
- ãã¹ç®¡çïŒå ç¢ãªæ€èšŒãæ£èŠåãã·ã³ããªãã¯ãªã³ã¯ã®ã»ãã¥ãªãã£ãã§ãã¯ãèš±å¯ãã£ã¬ã¯ããªã®èšå®ã«å¯Ÿå¿ããŠããŸãã
- ãã¡ã€ã«æäœïŒãšã³ã³ãŒãã£ã³ã°åŠçã䌎ãèªã¿åãïŒæžã蟌ã¿ãã¹ããŒããªããã¹ãç·šéïŒçœ®æãã¡ã¿ããŒã¿ã®ååŸã«å¯Ÿå¿ããŠããŸãã
- ãã£ã¬ã¯ããªæäœïŒäœæãäžèŠ§è¡šç€ºãããªãŒè¡šç€ºãå®å šãªç§»åïŒã³ããŒã«å¯Ÿå¿ããŠããŸãã
- æ€çŽ¢æ©èœïŒãã¿ãŒã³ãããã³ã°ãšãã£ã«ã¿ãªã³ã°ã«ããååž°æ€çŽ¢ã«å¯Ÿå¿ããŠããŸãã
- ã»ãã¥ãªãã£éèŠïŒãã£ã¬ã¯ããªãã©ããŒãµã«ã鲿¢ããå¢çã匷å¶ããããã«èšèšãããŠããŸãã
âš èªåŸåããŒã«ããã¥ã¡ã³ãæ¹åæ©èœ
- èªåæ¹åïŒMCP ããŒã«ã®ããã¥ã¡ã³ãïŒdocstringãã¹ããŒããäŸïŒãäœç³»çã«åæããã¹ããæ¹åããŸãã
- ãšãŒãžã§ã³ãã·ãã¥ã¬ãŒã·ã§ã³ïŒLLM ãšãŒãžã§ã³ãã®èŠç¹ããææ§ããç¹å®ããŸãã
- é©å¿åãã¹ãïŒã¹ããŒããèæ ®ãããã¹ãã±ãŒã¹ãçæããå®è¡ããŸãã
- 倱æåæïŒLLM ã¢ã³ãµã³ãã«ã䜿çšããŠãããã¥ã¡ã³ãã®åŒ±ç¹ã蚺æããŸãã
- å埩çãªæ¹åïŒããã¥ã¡ã³ãã®å質ãç¶ç¶çã«åäžãããŸãã
- ïŒè©³ããã¯å°çšã®ã»ã¯ã·ã§ã³ãåç §ããŠãã ããïŒ
ð Playwright ã«ãããã©ãŠã¶ãŒèªåå
- å®å šãªå¶åŸ¡ïŒããŒãžé·ç§»ãã¯ãªãã¯ãå ¥åãããŒã¿ã®ã¹ã¯ã¬ã€ãã³ã°ãã¹ã¯ãªãŒã³ã·ã§ãããPDFããã¡ã€ã«ã®ã¢ããããŒãïŒããŠã³ããŒããJS ã®å®è¡ã«å¯Ÿå¿ããŠããŸãã
- 調æ»ïŒè€æ°ã®æ€çŽ¢ãšã³ãžã³ã§æ€çŽ¢ãèªååããæ§é åããŒã¿ãæœåºããŠããµã€ããç£èŠããŸãã
- æ å ±ã®çµ±åïŒè€æ°ã®ãŠã§ããœãŒã¹ããã®èª¿æ»çµæãã¬ããŒãã«ãŸãšããŸãã
ð§ èªç¥ã»ãšãŒãžã§ã³ãã¡ã¢ãªã·ã¹ãã
- ã¡ã¢ãªéå±€ïŒäœæ¥ããšããœãŒããæå³ãæç¶ãã®åã¬ãã«ãåããŠããŸãã
- ãã¬ããžç®¡çïŒã¡ã¿ããŒã¿ãé¢é£ä»ããéèŠåºŠã®è¿œè·¡æ©èœãšãšãã«ãèšæ¶ãä¿åïŒååŸããŸãã
- ã¯ãŒã¯ãããŒã®è¿œè·¡ïŒãšãŒãžã§ã³ãã®ã¢ã¯ã·ã§ã³ãæšè«ãã§ãŒã³ãææç©ãäŸåé¢ä¿ãèšé²ããŸãã
- ã¹ããŒããªæäœïŒã¡ã¢ãªã®çµ±åãæ¯ãè¿ãã®çæãé¢é£æ§ã«åºã¥ãæé©åãæžè¡°ã«å¯Ÿå¿ããŠããŸãã
ð Excel ã¹ãã¬ããã·ãŒãã®èªåå
- çŽæ¥æäœïŒèªç¶èšèªãŸãã¯æ§é åãããæç€ºã䜿ã£ãŠãExcel ãã¡ã€ã«ã®äœæãç·šéãæžåŒèšå®ãè¡ããŸããæ°åŒãåæããŸãã
- ãã³ãã¬ãŒãåŠç¿ïŒäŸããåŠç¿ãããã³ãã¬ãŒãã«é©å¿ããŠãæžåŒãã¿ãŒã³ãé©çšããŸãã
- VBA ãã¯ãçæïŒè€éãªèªååã®ããã® VBA ã³ãŒããæç€ºã«åºã¥ããŠçæããŸãã
ðïž æ§é åããŒã¿ã®æœåº
- JSON æœåºïŒã¹ããŒãæ€èšŒãè¡ããªãããæ§é åããã JSON ãæœåºããŸãã
- ããŒãã«æœåºïŒããŒãã«ãè€æ°ã®åœ¢åŒïŒJSONãCSVãMarkdownïŒã§æœåºããŸãã
- ããŒãšå€ã®æœåºïŒã·ã³ãã«ãªããŒãšå€ã®ãã¢ãæœåºããŸãã
- ã»ãã³ãã£ãã¯ã¹ããŒãæšè«ïŒããã¹ãããã¹ããŒãã®çæã詊ã¿ãŸãã
âïž ããŒãã¡ã³ãã¢ãŒã
- ã¢ãã«éã®å¯ŸæŠïŒã³ãŒãçæãŸãã¯ããã¹ãçæã¿ã¹ã¯ã§ãã¢ãã«å士ãçŽæ¥æ¯èŒããŸãã
- è€æ°ã¢ãã«ã®è©äŸ¡ïŒç°ãªãã¢ãã«ããããã€ããŒã®åºåãåæã«æ¯èŒããŸãã
- ããã©ãŒãã³ã¹ææšïŒæ£ç¢ºæ§ãå¹çãã¹ã¿ã€ã«ãªã©ãè©äŸ¡ããçµæãä¿åããŸãã
ðïž SQL ããŒã¿ããŒã¹ãšã®é£æº
- ã¯ãšãªå®è¡ïŒããŸããŸãªçš®é¡ã® DBïŒSQLAlchemy çµç±ã® SQLiteãPostgreSQL ãªã©ïŒã«å¯Ÿã㊠SQL ã¯ãšãªãå®è¡ããŸãã
- ã¹ããŒãåæïŒã¹ããŒããåæããæé©åãææ¡ããŸãïŒLLM ã䜿çšïŒã
- ããŒã¿æ¢çŽ¢ïŒããŒãã«ãåç §ããå 容ãå¯èŠåããŸãã
- ã¯ãšãªçæïŒèªç¶èšèªã®èª¬æãã SQL ãçæããŸãã
ð ãšã³ãã£ãã£é¢ä¿ã°ã©ã
- ãšã³ãã£ãã£æœåºïŒãšã³ãã£ãã£ïŒäººç©ãçµç¹ãå Žæãªã©ïŒãç¹å®ããŸãã
- é¢ä¿ã®ãããã³ã°ïŒãšã³ãã£ãã£éã®ã€ãªãããçºèŠããŠãããã³ã°ããŸãã
- ãã¬ããžã°ã©ãã®æ§ç¯ïŒæ°žç¶çãªã°ã©ããæ§ç¯ããŸãïŒäŸïŒNetworkX ã䜿çšïŒã
- ã°ã©ãã¯ãšãªïŒã°ã©ãæ¢çŽ¢ãŸã㯠LLM ããŒã¹ã®ã¯ãšãªã䜿ã£ãŠç¥èŠãæœåºããŸãã
ð é«åºŠãªãã¯ãã«æäœ
- ã»ãã³ãã£ãã¯æ€çŽ¢ïŒãã¯ãã«åã蟌ã¿ã䜿ã£ãŠé¡äŒŒã³ã³ãã³ããæ€çŽ¢ããŸãã
- ãã¯ãã«ã¹ãã¬ãŒãžãšã®é£æºïŒãã¯ãã«ããŒã¿ããŒã¹ãŸãã¯ããŒã«ã«ã¹ãã¬ãŒãžãšé£æºããŸãã
- ãã€ããªããæ€çŽ¢ïŒããŒã¯ãŒãæ€çŽ¢ãšã»ãã³ãã£ãã¯æ€çŽ¢ãçµã¿åãããŸãïŒäŸïŒMarqo ãšã®é£æºïŒã
- ãããåŠçïŒå€§èŠæš¡ãªããŒã¿ã»ããã«å¯ŸããŠããã¯ãã«åã蟌ã¿ã®çæãšæ€çŽ¢ãå¹ççã«è¡ããŸãã
ð æ€çŽ¢æ¡åŒµçæïŒRAGïŒ
- ã³ã³ããã¹ããèæ ®ããçæïŒé¢é£ããååŸæžã¿ã®ããã¥ã¡ã³ãããã£ã³ã¯ãããã³ããã«è¿œå ããŸãã
- 粟床ã®åäžïŒæäŸãããã³ã³ããã¹ãã«åºã¥ããŠåçãçæããããšã§ããã«ã·ããŒã·ã§ã³ãæããŸãã
- ã¯ãŒã¯ãããŒãžã®çµ±åïŒæ€çŽ¢ïŒãã¯ãã«æ€çŽ¢ïŒããŒã¯ãŒãæ€çŽ¢ïŒãšçæãã·ãŒã ã¬ã¹ã«çµã¿åãããŸããæŠç¥ã¯ã«ã¹ã¿ãã€ãºã§ããŸãã
ðïž é³å£°ã®æåèµ·ãã
- é³å£°ããããã¹ããžã®å€æïŒWhisper ãªã©ã®ã¢ãã«ã䜿ã£ãŠãé³å£°ãã¡ã€ã«ïŒWAVãMP3 ãªã©ïŒãããã¹ãã«å€æããŸãã
- 話è ãã€ã¢ã©ã€ãŒãŒã·ã§ã³ïŒã¢ãã«ãã©ã€ãã©ãªã察å¿ããŠããå Žåãç°ãªã話è ãèå¥ããŸãã
- æåèµ·ããçµæã®è£æ£ïŒLLM ã䜿ã£ãŠæåèµ·ããçµæãæŽããæžåŒãèšå®ããŸãã
- å€èšèªå¯Ÿå¿ïŒåºç€ãšãªãæåèµ·ããã¢ãã«ã«å¿ããŠãããŸããŸãªèšèªãåŠçããŸãã
ð·ïž ããã¹ãåé¡
- ã«ã¹ã¿ã åé¡åšïŒããã¹ãåé¡ã¢ãã«ïŒãã¡ã€ã³ãã¥ãŒãã³ã°æžã¿ã¢ãã«ããŒãã·ã§ãã LLM ãªã©ïŒãé©çšããŸãã
- ãã«ãã©ãã«åé¡ïŒè€æ°ã®ã«ããŽãªãå²ãåœãŠãŸãã
- ä¿¡é ŒåºŠã¹ã³ã¢ïŒåé¡çµæã®ç¢ºçãæç€ºããŸãã
- ãããåŠçïŒå€§èŠæš¡ãªããã¥ã¡ã³ã矀ãå¹ççã«åé¡ããŸãã
ðïž OCR ããŒã«
- PDFïŒç»åã®æœåºïŒTesseract ãªã©ã® OCR ãšã³ãžã³ã䜿çšããLLM ã«ããè£æ£ãæžåŒèšå®ã§çµæã匷åããŸãã
- ååŠçïŒç»åã®ãã€ãºé€å»ãäºå€åãåŸãè£æ£ã®ãªãã·ã§ã³ãåããŠããŸãã
- æ§é åæïŒPDF ã®ã¡ã¿ããŒã¿ãšæ§é ãæœåºããŸãã
- ãããåŠçïŒè€æ°ã®ãã¡ã€ã«ãåæã«åŠçããŸãã
- ïŒ
ocrã®è¿œå äŸåé¢ä¿ãå¿ èŠã§ãïŒuv pip install -e ".[ocr]"ïŒ
ð ããã¹ãã®å€æŽå±¥æŽããŒã«
- HTML 倿Žå±¥æŽã®çæïŒããã¹ãïŒHTML éã®å·®åïŒæ¿å ¥ãåé€ãç§»åïŒãèŠèŠåããŸããåç¬ã§è¡šç€ºã§ãã HTML ãåºåããŸãã
- ããã¥ã¡ã³ãæ¯èŒïŒããŸããŸãªåœ¢åŒããçŽæçã«åãããã€ã©ã€ãä»ãã§æ¯èŒããŸãã
ð HTML ãã Markdown ãžã®å€æ
- ã€ã³ããªãžã§ã³ããªå€æïŒã³ã³ãã³ãã®çš®é¡ãæ€åºãã
readability-lxmlãtrafilaturaãmarkdownifyãªã©ã®ã©ã€ãã©ãªã䜿çšããŸãã - ã³ã³ãã³ãã®æœåºïŒå®åçãªéšåãé€å€ããæ§é ïŒè¡šããªã³ã¯ïŒãä¿æããŸãã
- Markdown ã®æé©åïŒåºåãæŽçããæ£èŠåããŸãã
ð ã¯ãŒã¯ãããŒæé©åããŒã«
- ã³ã¹ãã®èŠç©ããïŒæ¯èŒïŒå®è¡åã®ã³ã¹ãèŠç©ããããã¢ãã«éã®ã³ã¹ãæ¯èŒãè¡ããŸãã
- ã¢ãã«éžæã®ã¬ã€ãã³ã¹ïŒã¿ã¹ã¯ãäºç®ãæ§èœèŠä»¶ã«åºã¥ããŠã¢ãã«ãæšå¥šããŸãã
- ã¯ãŒã¯ãããŒå®è¡ãšã³ãžã³ïŒäŸåé¢ä¿ã䞊åå®è¡ã倿°ã®åãæž¡ããå«ãè€æ°æ®µéã®ãã€ãã©ã€ã³ãå®è¡ããŸãã
ð» ããŒã«ã«ããã¹ãåŠçããŒã«ïŒCLI çµ±åïŒ
- ãªãã©ã€ã³ã§ã®åŠçèœåïŒ
ripgrepïŒé«éãªæ£èŠè¡šçŸæ€çŽ¢ïŒãawkïŒããã¹ãåŠçïŒãsedïŒã¹ããªãŒã ãšãã£ã¿ãŒïŒãjqïŒJSON åŠçïŒãªã©ã®ã³ãã³ãã©ã€ã³ããŒã«ãå®å šã«ã©ããããMCP ããŒã«ãšããŠå ¬éããŸããAPI åŒã³åºããªãã§ãããã¹ããããŒã«ã«ã§åŠçã§ããŸãã
â±ïž ã¢ãã«æ§èœã®ãã³ãããŒã¯
- 宿ž¬ïŒãããã€ããŒïŒã¢ãã«éã®å®éã®é床ïŒããŒã¯ã³ïŒç§ïŒãã¬ã€ãã³ã·ã枬å®ããããŒã«ã§ãã
- æ§èœãããã¡ã€ã«ïŒå®ç°å¢ã§ã®æ§èœã«åºã¥ãæ¯èŒã¬ããŒããçæããŸãã
- ããŒã¿ã«åºã¥ãæé©åïŒãã³ãããŒã¯ããŒã¿ãã«ãŒãã£ã³ã°ã®å€æã«æŽ»çšããŸãã
ð¡ è€æ°ã®ãã©ã³ã¹ããŒãã¢ãŒã
- Streamable-HTTPïŒæšå¥šïŒïŒã¹ããªãŒãã³ã°å¯Ÿå¿ã®ãªã¯ãšã¹ãïŒã¬ã¹ãã³ã¹ããã£ãåããææ°ã® HTTP ãã©ã³ã¹ããŒãã§ãHTTP ããŒã¹ã® MCP ã¯ã©ã€ã¢ã³ãã«æé©ã§ãã
- Server-Sent EventsïŒSSEïŒïŒãªã¢ã«ã¿ã€ã ã¹ããªãŒãã³ã°ã«ãµãŒããŒéä¿¡ã€ãã³ãã䜿çšããåŸæ¥ã® HTTP ãã©ã³ã¹ããŒãã§ãã
- æšæºå ¥åºåïŒstdioïŒïŒçµã¿èŸŒã¿çµ±ååãã®çŽæ¥çãªããã»ã¹ééä¿¡ã§ãã
- ãªã¢ã«ã¿ã€ã ã¹ããªãŒãã³ã°ïŒãã¹ãŠã® HTTP ãã©ã³ã¹ããŒãã§ãLLM ã®å¿çãããŒã¯ã³åäœã§æŽæ°ããŸãã
- 鲿ã¢ãã¿ãªã³ã°ïŒé·æéå®è¡ããããžã§ãïŒãã£ã³ã¯åå²ããããåŠçïŒã®é²æã远跡ããŸãã
- ã€ãã³ãããŒã¹ã®ã¢ãŒããã¯ãã£ïŒç¹å®ã®ãµãŒããŒã€ãã³ãã賌èªã§ããŸãã
âš è€æ°ã¢ãã«ã®çµ±å
- æ¯èŒåæïŒè€æ°ã®ã¢ãã«ã®åºåã䞊ã¹ãŠåæããŸãã
- å¿çã®çµ±åïŒæé©ãªèŠçŽ ãçµã¿åãããã¡ã¿å¿çãçæããåæã«åºã¥ãåºåãäœæããŸãã
- å調çãªæšè«ïŒç°ãªãã¢ãã«ãããããç°ãªãã¹ããããæ åœããã¯ãŒã¯ãããŒãå®è£ ããŸãã
ð§© ã¢ãã«å¯Ÿå¿ã®æ¡åŒµ
- Grok çµ±åïŒxAI ã® Grok ããã€ãã£ãã«ãµããŒãããŸãã
- DeepSeek 察å¿ïŒDeepSeek ã¢ãã«ã«æé©åãããåŠçãæäŸããŸãã
- OpenRouter çµ±åïŒOpenRouter API ããŒã䜿çšããŠãå¹ åºãã¢ãã«ã«ã¢ã¯ã»ã¹ã§ããŸãã
- ããŒã«ã«ïŒã»ã«ããã¹ãçµ±åïŒOpenAI äºæã®ä»»æã®ããŒã«ã«ãµãŒããŒïŒOllamaãllama.cpp ã®
llama-serverãmistral.rsãvLLMãLM StudioïŒåãã«ãèšå®å¯èœãªåäžã®localãããã€ããŒãå©çšã§ããŸããbase_urlãæå®ããã°ãç¬èªã®ããŒããŠã§ã¢äžã§ç¡æïŒã³ã¹ã $0ïŒã®æšè«ãå®è¡ã§ããŸãã - Gemini çµ±åïŒGoogle ã® Gemini ã¢ãã«ãå æ¬çã«ãµããŒãããŸãã
- Anthropic çµ±åïŒClaude 3.5 Sonnet ã Haiku ãå«ã Claude ã¢ãã«ãå®å šã«ãµããŒãããŸãã
- OpenAI çµ±åïŒGPT-3.5ãGPT-4.0ãããã³æ°ããã¢ãã«ãå®å šã«ãµããŒãããŸãã
ð§ èªå·±æ¹åãšåççµ±åã®ããã®ã¡ã¿ããŒã«
- ããŒã«ã®æ€åºïŒãšãŒãžã§ã³ãã¯ãå©çšå¯èœãªããŒã«ããã©ã¡ãŒã¿ãŒã説æãç
§äŒã§ããŸãïŒ
list_toolsïŒã - äœ¿çšæ¹æ³ã®æšå¥šïŒã¿ã¹ã¯ã«é©ããããŒã«ã®éžæãçµã¿åããã«ã€ããŠãAI ã«ããã¢ããã€ã¹ãåããããŸãã
- å€éš API çµ±åïŒOpenAPI 仿§ãä»ã㊠REST API ãåçã«ç»é²ãããšã³ããã€ã³ããåŒã³åºãå¯èœãª MCP ããŒã«ãšããŠå©çšã§ããŸãïŒ
register_apiãcall_dynamic_toolïŒã - ããã¥ã¡ã³ãã®çæïŒAutonomous Refiner æ©èœã®äžéšã§ãã
ð åæãšã¬ããŒã
- 䜿çšç¶æ³ã®è¿œè·¡ïŒãããã€ããŒïŒã¢ãã«ïŒããŒã«ããšã«ãããŒã¯ã³æ°ãã³ã¹ãããªã¯ãšã¹ãæ°ãæåçïŒãšã©ãŒçãç£èŠããŸãã
- ãªã¢ã«ã¿ã€ã ã¢ãã¿ãªã³ã°ïŒäœ¿çšç¶æ³ã®çµ±èšãã©ã€ãããã·ã¥ããŒããŸãã¯ã¹ããªãŒã ã§è¡šç€ºããŸãã
- 詳现ãªã¬ããŒãïŒéå»ã®ã³ã¹ãïŒäœ¿çšç¶æ³ã¬ããŒããçæããåŸåãç¹å®ããŠãããŒã¿ããšã¯ã¹ããŒãããŸãã
- æé©åã®åææ å ±ïŒã³ã¹ãã®é«ãåŠçãéå¹çãªãã¿ãŒã³ã®ç¹å®ã«åœ¹ç«ã¡ãŸãã
ð ããã³ãããã³ãã¬ãŒããšç®¡ç
- Jinja2 ãã³ãã¬ãŒãïŒå€æ°ãæ¡ä»¶åå²ãã€ã³ã¯ã«ãŒãã䜿çšããŠãåå©çšå¯èœã§åçãªããã³ãããäœæã§ããŸãã
- ããã³ãããªããžããªïŒããã³ãããä¿åãååŸãåé¡ããããŒãžã§ã³ç®¡çã§ããŸãã
- ã¡ã¿ããŒã¿ïŒãã³ãã¬ãŒãã«èª¬æãäœæè ã䜿çšäŸã远å ã§ããŸãã
- æé©åïŒãã³ãã¬ãŒãã®ããã©ãŒãã³ã¹ãšããŒã¯ã³äœ¿çšéããã¹ãããŠæ¯èŒã§ããŸãã
ð¡ïž ãšã©ãŒåŠçãšå埩æ§
- ã€ã³ããªãžã§ã³ããªå詊è¡ïŒäžæçãªãšã©ãŒïŒã¬ãŒãå¶éããããã¯ãŒã¯ã®åé¡ãªã©ïŒãçºçããå Žåãææ°ããã¯ãªãã§èªåçã«å詊è¡ããŸãã
- ãã©ãŒã«ããã¯æ©æ§ïŒãã©ã€ããªãããã€ããŒã«é害ãçºçããå Žåã®ãã©ãŒã«ããã¯å ãèšå®ã§ããŸãã
- 詳现ãªãšã©ãŒå ±åïŒãããã°ã«åœ¹ç«ã€å æ¬çãªãšã©ãŒã³ã³ããã¹ããèšé²ããŸãã
- å ¥åæ€èšŒïŒããããåé¡ïŒããŒã¯ã³å¶éãå¿ é ãã©ã¡ãŒã¿ãŒãªã©ïŒãäºåã«ãã§ãã¯ããŸãã
âïž ã·ã¹ãã æ©èœ
- å
å®ãããã°æ©èœïŒ
Richã䜿çšããŠãã«ã©ãã«ã§ããããããã³ã³ãœãŒã«ãã°ã衚瀺ããŸãã - ãã«ã¹ã¢ãã¿ãªã³ã°ïŒæºåç¶æ
ã確èªããããã®
/healthzãšã³ããã€ã³ãã - ã³ãã³ãã©ã€ã³ã€ã³ã¿ãŒãã§ãŒã¹ïŒç®¡çãæäœã«äœ¿çšãã
umcpCLIã
ðŠ ã¯ããã«
𧪠ã€ã³ã¹ããŒã«
# Install uv (fast Python package manager) if you don't have it:
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone the repository
git clone https://github.com/Dicklesworthstone/ultimate_mcp_server.git
cd ultimate_mcp_server
# Create a virtual environment and install dependencies using uv:
uv venv --python 3.13
source .venv/bin/activate
uv lock --upgrade
uv sync --all-extras
泚ïŒuv sync --all-extras ã³ãã³ãã¯ããããžã§ã¯ãã§å®çŸ©ãããŠãããã¹ãŠã®ãªãã·ã§ã³ã®è¿œå æ©èœïŒOCRããã©ãŠã¶ãŒèªååãExcel ãªã©ïŒãã€ã³ã¹ããŒã«ããŸããç¹å®ã®è¿œå æ©èœã®ã¿ãå¿
èŠãªå Žåã¯ããããžã§ã¯ãã®äŸåé¢ä¿ã調æŽãã--all-extras ãæå®ããã« uv sync ãå®è¡ããŠãã ããã
âïž .env ã®èšå®
ã¯ããŒã³ãããªããžããªã®ã«ãŒããã£ã¬ã¯ããªã« .env ãšããååã®ãã¡ã€ã«ãäœæããŸããAPI ããŒãšãå¿
èŠã«å¿ããŠèšå®ã®äžæžãã远å ããŠãã ããã
# --- API Keys (at least one provider required) ---
OPENAI_API_KEY=your_openai_sk-...
ANTHROPIC_API_KEY=your_anthropic_sk-...
GEMINI_API_KEY=your_google_ai_studio_key... # For Google AI Studio (Gemini API)
# Or use GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/service-account-key.json for Vertex AI
DEEPSEEK_API_KEY=your_deepseek_key...
OPENROUTER_API_KEY=your_openrouter_key...
GROK_API_KEY=your_grok_key... # For Grok via xAI API
# --- Local / Self-Hosted Providers (OpenAI-compatible, FREE inference) ---
# One generic provider covers Ollama, llama.cpp (llama-server), mistral.rs, vLLM, and LM Studio.
# No API key is required by most local servers; LOCAL_LLM_API_KEY is optional.
# LOCAL_LLM_BASE_URL=http://localhost:11434/v1 # Default (Ollama). Examples:
# llama.cpp / mistral.rs / vLLM : http://localhost:8000/v1
# LM Studio : http://localhost:1234/v1
# LOCAL_LLM_DEFAULT_MODEL=llama3.1:8b # Model name as served by your local backend
# LOCAL_LLM_API_KEY= # Optional; most local servers ignore it
# LOCAL_LLM_REQUEST_TIMEOUT=30 # Optional request timeout in seconds
# LOCAL_LLM_ENABLED=true # Optional; set false to disable the local provider
# --- Server Configuration (Defaults shown) ---
GATEWAY_SERVER_PORT=8013
GATEWAY_SERVER_HOST=127.0.0.1 # Change to 0.0.0.0 to listen on all interfaces (needed for Docker/external access)
# GATEWAY_API_PREFIX=/
# --- Logging Configuration (Defaults shown) ---
LOG_LEVEL=INFO # DEBUG, INFO, WARNING, ERROR, CRITICAL
USE_RICH_LOGGING=true # Set to false for plain text logs
# --- Cache Configuration (Defaults shown) ---
GATEWAY_CACHE_ENABLED=true
GATEWAY_CACHE_TTL=86400 # Default Time-To-Live in seconds (24 hours)
# GATEWAY_CACHE_TYPE=memory # Options might include 'memory', 'redis', 'diskcache' (check implementation)
# GATEWAY_CACHE_MAX_SIZE=1000 # Example: Max number of items for memory cache
# GATEWAY_CACHE_DIR=./.cache # Directory for disk cache storage
# --- Provider Timeouts & Retries (Defaults shown) ---
# GATEWAY_PROVIDER_TIMEOUT=120 # Default timeout in seconds for API calls
# GATEWAY_PROVIDER_MAX_RETRIES=3 # Default max retries on failure
# --- Provider-Specific Configuration ---
# GATEWAY_OPENAI_DEFAULT_MODEL=gpt-4.1-mini # Customize default model
# GATEWAY_ANTHROPIC_DEFAULT_MODEL=claude-3-5-sonnet-20241022 # Customize default model
# GATEWAY_GEMINI_DEFAULT_MODEL=gemini-2.0-pro # Customize default model
# --- Tool Specific Config (Examples) ---
# FILESYSTEM__ALLOWED_DIRECTORIES=["/path/to/safe/dir1","/path/to/safe/dir2"] # For Filesystem tools (JSON array)
# GATEWAY_AGENT_MEMORY_DB_PATH=unified_agent_memory.db # Path for agent memory database
# GATEWAY_PROMPT_TEMPLATES_DIR=./prompt_templates # Directory for prompt templates
â¶ïž å®è¡
ä»®æ³ç°å¢ãæå¹ã«ãªã£ãŠããããšã確èªããŠãã ããïŒsource .venv/bin/activateïŒã
# Start the MCP server with all registered tools found
umcp run
# Start the server including only specific tools
umcp run --include-tools completion chunk_document read_file write_file
# Start the server excluding specific tools
umcp run --exclude-tools browser_init browser_navigate research_and_synthesize_report
# Start with Docker (ensure .env file exists in the project root or pass environment variables)
docker compose up --build # Add --build the first time or after changes
èµ·åãããšãéåžžããµãŒããŒã¯ http://localhost:8013ïŒãŸã㯠.env ãããã¯ã³ãã³ãã©ã€ã³ã§èšå®ãããã¹ãïŒããŒãïŒã§å©çšã§ããŸãããµãŒããŒã®èµ·åãšç»é²æžã¿ããŒã«ã瀺ããã°ã衚瀺ãããŸãã
ð» ã³ãã³ãã©ã€ã³ã€ã³ã¿ãŒãã§ãŒã¹ïŒCLIïŒ
Ultimate MCP Server ã«ã¯ããµãŒããŒã®ç®¡çãLLM ãããã€ããŒãšã®ããåããæ©èœã®ãã¹ãããµã³ãã«ã®ç¢ºèªãè¡ãã匷åãªã³ãã³ãã©ã€ã³ã€ã³ã¿ãŒãã§ãŒã¹ïŒCLIïŒã umcp ã³ãã³ãã§çšæãããŠããŸãããã®ã»ã¯ã·ã§ã³ã§ã¯ãå©çšå¯èœãªãã¹ãŠã®ã³ãã³ããšãªãã·ã§ã³ã«ã€ããŠèª¬æããŸãã
ð ã°ããŒãã«ãªãã·ã§ã³
umcp ã³ãã³ãã§ã¯ã次ã®ã°ããŒãã«ãªãã·ã§ã³ã䜿çšã§ããŸãã
umcp --version # Display version information
ð ãµãŒããŒç®¡ç
ãµãŒããŒã®èµ·å
run ã³ãã³ãã¯ãæå®ãããªãã·ã§ã³ã§ Ultimate MCP Server ãèµ·åããŸãã
# Basic server start with default settings from .env
umcp run
# Run on a specific host (-h) and port (-p)
umcp run -h 0.0.0.0 -p 9000
# Run with multiple worker processes (-w)
umcp run -w 4
# Enable debug logging (-d)
umcp run -d
# Use stdio transport (-t)
umcp run -t stdio
# Use streamable-http transport (recommended for HTTP clients)
umcp run -t shttp
# Run only with specific tools (no shortcut for --include-tools)
umcp run --include-tools completion chunk_document read_file write_file
# Run with all tools except certain ones (no shortcut for --exclude-tools)
umcp run --exclude-tools browser_init browser_navigate
åºåäŸïŒ
ââ Starting Ultimate MCP Server ââââââââââââââââââââ
â Host: 0.0.0.0 â
â Port: 9000 â
â Workers: 4 â
â Transport mode: streamable-http â
ââââââââââââââââââââââââââââââââââââââââââââââââââ
INFO: Started server process [12345]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:9000 (Press CTRL+C to quit)
å©çšå¯èœãªãªãã·ã§ã³ïŒ
-h, --hostïŒãµãŒããŒããã€ã³ããããã¹ãåãŸã㯠IP ã¢ãã¬ã¹ïŒããã©ã«ãïŒ.env ã®å€ïŒ-p, --portïŒãªãã¹ã³ããããŒãïŒããã©ã«ãïŒ.env ã®å€ïŒ-w, --workersïŒèµ·åããã¯ãŒã«ãŒããã»ã¹æ°ïŒããã©ã«ãïŒ.env ã®å€ïŒ-t, --transport-modeïŒãµãŒããŒéä¿¡ã®ãã©ã³ã¹ããŒãã¢ãŒãïŒã¹ããªãŒãã³ã°å¯èœãª HTTP ã¯'shttp'ããŸãã¯'sse'ã'stdio'ãããã©ã«ãïŒshttpïŒ-d, --debugïŒãããã°ãã°ãæå¹ã«ããŸã--include-toolsïŒå«ããããŒã«åã®ãªã¹ãïŒã«ã³ãåºåãïŒ--exclude-toolsïŒé€å€ããããŒã«åã®ãªã¹ãïŒã«ã³ãåºåãïŒ
ð ãããã€ããŒç®¡ç
ãããã€ããŒã®äžèŠ§è¡šç€º
providers ã³ãã³ãã¯ãèšå®æžã¿ã® LLM ãããã€ããŒã«é¢ããæ
å ±ã衚瀺ããŸãã
# List all configured providers
umcp providers
# Check API keys (-c) for all configured providers
umcp providers -c
# List available models (no shortcut for --models)
umcp providers --models
# Check keys and list models
umcp providers -c --models
åºåäŸïŒ
ââ LLM Providers âââââââââââââââââââââââââââââââââââââââââââââââââââ
â Provider Status Default Model API Key â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ€
â openai â gpt-4.1-mini sk-...5vX [VALID] â
â anthropic â claude-3-5-sonnet-20241022 sk-...Hr [VALID] â
â gemini â gemini-2.0-pro [VALID] â
â deepseek â deepseek-chat [NOT CONFIGURED] â
â openrouter â -- [VALID] â
â grok â grok-1 [VALID] â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
--models ãæå®ããå ŽåïŒ
OPENAI MODELS:
- gpt-4.1-mini
- gpt-4o
- gpt-4-0125-preview
- gpt-3.5-turbo
ANTHROPIC MODELS:
- claude-3-5-sonnet-20241022
- claude-3-5-haiku-20241022
- claude-3-opus-20240229
...
å©çšå¯èœãªãªãã·ã§ã³ïŒ
-c, --checkïŒèšå®æžã¿ã®ãã¹ãŠã®ãããã€ããŒã® API ããŒã確èªããŸã--modelsïŒåãããã€ããŒã§å©çšå¯èœãªã¢ãã«ãäžèŠ§è¡šç€ºããŸã
ãããã€ããŒã®ãã¹ã
test ã³ãã³ãã䜿çšããŠãç¹å®ã®ãããã€ããŒããã¹ãã§ããŸãã
# Test the default OpenAI model with a simple prompt
umcp test openai
# Test a specific model (--model) with a custom prompt (--prompt)
umcp test anthropic --model claude-3-5-haiku-20241022 --prompt "Write a short poem about coding."
# Test Gemini with a different prompt
umcp test gemini --prompt "What are three interesting AI research papers from 2024?"
åºåäŸïŒ
Testing provider 'anthropic'...
Provider: anthropic
Model: claude-3-5-haiku-20241022
Prompt: Write a short poem about coding.
⯠Response:
Code flows like water,
Logic cascades through the mindâ
Bugs bloom like flowers.
Tokens: 13 input, 19 output
Cost: $0.00006
Response time: 0.82s
å©çšå¯èœãªãªãã·ã§ã³ïŒ
--modelïŒãã¹ãããã¢ãã« IDïŒããã©ã«ãã§ã¯ãããã€ããŒã®ããã©ã«ãã䜿çšããŸãïŒ--promptïŒéä¿¡ããããã³ããããã¹ãïŒããã©ã«ãïŒãHello, world!ãïŒ
â¡ ããã¹ãã®çŽæ¥çæ
complete ã³ãã³ãã䜿ããšãCLI ããããã¹ããçŽæ¥çæã§ããŸãã
# Generate text with default provider (OpenAI) using a prompt (--prompt)
umcp complete --prompt "Write a concise explanation of quantum computing."
# Specify a provider (--provider) and model (--model)
umcp complete --provider anthropic --model claude-3-5-sonnet-20241022 --prompt "What are the key differences between Rust and Go?"
# Use a system prompt (--system)
umcp complete --provider openai --model gpt-4o --system "You are an expert programmer..." --prompt "Explain dependency injection."
# Stream the response token by token (-s)
umcp complete --provider openai --prompt "Count from 1 to 10." -s
# Adjust temperature (--temperature) and token limit (--max-tokens)
umcp complete --provider gemini --temperature 1.2 --max-tokens 250 --prompt "Generate a creative sci-fi story opening."
# Read prompt from stdin (no --prompt needed)
echo "Tell me about space exploration." | umcp complete
åºåäŸïŒ
Quantum computing uses quantum bits (qubits) that can exist in multiple states simultaneously, unlike classical bits (0 or 1). This quantum superposition, along with entanglement, allows quantum computers to process vast amounts of information in parallel, potentially solving certain complex problems exponentially faster than classical computers. Applications include cryptography, materials science, and optimization problems.
Tokens: 13 input, 72 output
Cost: $0.00006
Response time: 0.37s
å©çšå¯èœãªãªãã·ã§ã³ïŒ
--providerïŒäœ¿çšãããããã€ããŒïŒããã©ã«ãïŒopenaiïŒ--modelïŒã¢ãã« IDïŒããã©ã«ãã¯ãããã€ããŒã®æ¢å®å€ïŒ--promptïŒããã³ããã®ããã¹ãïŒæå®ããªãå Žå㯠stdin ããèªã¿èŸŒã¿ãŸãïŒ--temperatureïŒãµã³ããªã³ã°æž©åºŠïŒ0.0ïœ2.0ãããã©ã«ãïŒ0.7ïŒ--max-tokensïŒçæããæå€§ããŒã¯ã³æ°--systemïŒå¯Ÿå¿ãããããã€ããŒåãã®ã·ã¹ãã ããã³ãã-s, --streamïŒå¿çãããŒã¯ã³ããšã«ã¹ããªãŒãã³ã°ããŸã
ðŸ ãã£ãã·ã¥ç®¡ç
cache ã³ãã³ãã䜿ããšããªã¯ãšã¹ããã£ãã·ã¥ã®è¡šç€ºãæ¶å»ãã§ããŸãã
# Show cache status (default action)
umcp cache
# Explicitly show status (no shortcut for --status)
umcp cache --status
# Clear the cache (no shortcut for --clear, with confirmation prompt)
umcp cache --clear
# Show stats and clear the cache in one command
umcp cache --status --clear
åºåäŸïŒ
Cache Status:
Backend: memory
Enabled: True
Items: 127
Hit rate: 73.2%
Estimated savings: $1.47
å©çšå¯èœãªãªãã·ã§ã³ïŒ
--statusïŒãã£ãã·ã¥ã®ç¶æ ã衚瀺ããŸãïŒã»ãã®ãã©ã°ãæå®ãããŠããªãå Žåã¯ããã©ã«ãïŒ--clearïŒãã£ãã·ã¥ãæ¶å»ããŸãïŒç¢ºèªãæ±ããŸãïŒ
ð ãã³ãããŒã¯
benchmark ã³ãã³ãã䜿ããšããããã€ããŒéã®ããã©ãŒãã³ã¹ãšã³ã¹ããæ¯èŒã§ããŸãã
# Run default benchmark (3 runs per provider)
umcp benchmark
# Benchmark only specific providers
umcp benchmark --providers openai,anthropic
# Benchmark with specific models
umcp benchmark --providers openai,anthropic --models gpt-4o,claude-3.5-sonnet
# Use a custom prompt and more runs (-r)
umcp benchmark --prompt "Explain the process of photosynthesis in detail." -r 5
åºåäŸïŒ
ââ Benchmark Results ââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â Provider Model Avg Time Tokens Cost Tokens/sec â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ€
â openai gpt-4.1-mini 0.47s 76 / 213 $0.00023 454 â
â anthropic claude-3-5-haiku 0.52s 76 / 186 $0.00012 358 â
â gemini gemini-2.0-pro 0.64s 76 / 201 $0.00010 314 â
â deepseek deepseek-chat 0.71s 76 / 195 $0.00006 275 â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
å©çšå¯èœãªãªãã·ã§ã³ïŒ
--providersïŒãã³ãããŒã¯å¯Ÿè±¡ã®ãããã€ããŒäžèЧïŒããã©ã«ãïŒèšå®æžã¿ã®ãã¹ãŠïŒ--modelsïŒãã³ãããŒã¯å¯Ÿè±¡ã®ã¢ãã« IDïŒããã©ã«ãã¯åãããã€ããŒã®æ¢å®ã¢ãã«ïŒ--promptïŒäœ¿çšããããã³ããã®ããã¹ãïŒããã©ã«ãïŒçµã¿èŸŒã¿ã®ãã³ãããŒã¯çšããã³ããïŒ-r, --runsïŒãããã€ããŒïŒã¢ãã«ããšã®å®è¡åæ°ïŒããã©ã«ãïŒ3ïŒ
ð§° ããŒã«ç®¡ç
tools ã³ãã³ãã¯ãå©çšå¯èœãªããŒã«ãäžèŠ§è¡šç€ºããŸããã«ããŽãªã§çµã蟌ãããšãã§ããŸãã
# List all tools
umcp tools
# List tools in a specific category
umcp tools --category document
# Show related example scripts
umcp tools --examples
åºåäŸïŒ
ââ Ultimate MCP Server Tools ââââââââââââââââââââââââââââââââââââââââââ
â Category Tool Example Script â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ€
â completion generate_completion simple_completion_demo.py â
â completion stream_completion simple_completion_demo.py â
â completion chat_completion claude_integration_demo.pyâ
â document summarize_document document_processing.py â
â document chunk_document document_processing.py â
â extraction extract_json advanced_extraction_demo.pyâ
â filesystem read_file filesystem_operations_demo.pyâ
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Tip: Run examples using the command:
umcp examples <example_name>
å©çšå¯èœãªãªãã·ã§ã³ïŒ
--categoryïŒã«ããŽãªã§ããŒã«ãçµã蟌ã¿ãŸã--examplesïŒããŒã«ãšãšãã«ãµã³ãã«ã¹ã¯ãªããã衚瀺ããŸã
ð ãµã³ãã«ç®¡ç
examples ã³ãã³ãã䜿ããšããµã³ãã«ã¹ã¯ãªããã®äžèŠ§è¡šç€ºãå®è¡ãã§ããŸãã
# List all example scripts (default action)
umcp examples
# Explicitly list example scripts (-l)
umcp examples -l
# Run a specific example
umcp examples rag_example.py
# Can also run by just the name without extension
umcp examples rag_example
äžèŠ§è¡šç€ºæã®åºåäŸïŒ
ââ Ultimate MCP Server Example Scripts ââââââââââââââââââââââââââââââââââ
â Category Example Script â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ€
â text-generation simple_completion_demo.py â
â text-generation claude_integration_demo.py â
â document-processing document_processing.py â
â search-and-retrieval rag_example.py â
â browser-automation browser_automation_demo.py â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Run an example:
umcp examples <example_name>
ãµã³ãã«ã®å®è¡æïŒ
Running example: rag_example.py
Creating vector knowledge base 'demo_kb'...
Adding sample documents...
Retrieving context for query: "What are the benefits of clean energy?"
Generated response:
Based on the retrieved context, clean energy offers several benefits:
...
å©çšå¯èœãªãªãã·ã§ã³ïŒ
-l, --listïŒãµã³ãã«ã¹ã¯ãªããã®ã¿ãäžèŠ§è¡šç€ºããŸã--categoryïŒã«ããŽãªã§ãµã³ãã«ãçµã蟌ã¿ãŸã
ð ãã«ãã®è¡šç€º
åã³ãã³ãã«ã¯è©³çްãªãã«ããçšæãããŠããŸãã
# General help
umcp --help
# Help for a specific command
umcp run --help
umcp providers --help
umcp complete --help
åºåäŸïŒ
Usage: umcp [OPTIONS] COMMAND [ARGS]...
Ultimate MCP Server: Multi-provider LLM management server
Unified CLI to run your server, manage providers, and more.
Options:
--version, -v Show the application version and exit.
--help Show this message and exit.
Commands:
run Run the Ultimate MCP Server
providers List Available Providers
test Test a Specific Provider
complete Generate Text Completion
cache Cache Management
benchmark Benchmark Providers
tools List Available Tools
examples Run or List Example Scripts
ã³ãã³ãåºæã®ãã«ãïŒ
Usage: umcp run [OPTIONS]
Run the Ultimate MCP Server
Start the server with optional overrides.
Examples:
umcp run -h 0.0.0.0 -p 8000 -w 4 -t sse
umcp run -d
Options:
-h, --host TEXT Host or IP address to bind the server to.
Defaults from config.
-p, --port INTEGER Port to listen on. Defaults from config.
-w, --workers INTEGER Number of worker processes to spawn.
Defaults from config.
-t, --transport-mode [shttp|sse|stdio]
Transport mode for server communication (-t
shortcut). Options: 'shttp' (streamable-http,
recommended), 'sse', or 'stdio'.
-d, --debug Enable debug logging for detailed output (-d
shortcut).
--include-tools TEXT List of tool names to include when running
the server.
--exclude-tools TEXT List of tool names to exclude when running
the server.
--help Show this message and exit.
𧪠䜿çšäŸ
ãã®ã»ã¯ã·ã§ã³ã§ã¯ãå®è¡äžã® Ultimate MCP Server ã€ã³ã¹ã¿ã³ã¹ãæäŸããããŒã«ããMCP ã¯ã©ã€ã¢ã³ãïŒmcp-client ã䜿ãã¢ããªã±ãŒã·ã§ã³ãªã©ïŒã Claude ã®ãããªãšãŒãžã§ã³ããã©ã®ããã«å©çšãããã瀺ã Python ã®äŸã玹ä»ããŸãã
泚ïŒãããã®äŸã§ã¯ãmcp-client ãã€ã³ã¹ããŒã«æžã¿ïŒpip install mcp-clientïŒã§ãUltimate MCP Server ã http://localhost:8013 ã§å®è¡äžã§ããããšãåæãšããŠããŸãã
(詳现ãªã³ãŒããããã¯ã¯ãå®å šæ§ãä¿ã€ãããå ã®å ¥åã®ãŸãŸä»¥äžã«èšèŒããŠããŸã)
åºæ¬çãªããã¹ãçæ
import asyncio
from mcp.client import Client
async def basic_completion_example():
client = Client("http://localhost:8013")
response = await client.tools.completion(
prompt="Write a short poem about a robot learning to dream.",
provider="openai",
model="gpt-4.1-mini",
max_tokens=100,
temperature=0.7
)
if response["success"]:
print(f"Completion: {response['completion']}")
print(f"Cost: ${response['cost']:.6f}")
else:
print(f"Error: {response['error']}")
await client.close()
# if __name__ == "__main__": asyncio.run(basic_completion_example())
Claude ã«ãã Ultimate MCP Server ã䜿ã£ãããã¥ã¡ã³ãåæïŒå§ä»»ïŒ
import asyncio
from mcp.client import Client
async def document_analysis_example():
# Assume Claude identifies a large document needing processing
client = Client("http://localhost:8013")
document = "... large document content ..." * 100 # Placeholder for large content
print("Delegating document chunking...")
# Step 1: Claude delegates document chunking (often a local, non-LLM task on server)
chunks_response = await client.tools.chunk_document(
document=document,
chunk_size=1000, # Target tokens per chunk
overlap=100, # Token overlap
method="semantic" # Use semantic chunking if available
)
if not chunks_response["success"]:
print(f"Chunking failed: {chunks_response['error']}")
await client.close()
return
print(f"Document divided into {chunks_response['chunk_count']} chunks.")
# Step 2: Claude delegates summarization of each chunk to a cheaper model
summaries = []
total_cost = 0.0
print("Delegating chunk summarization to gemini-2.0-flash-lite...")
for i, chunk in enumerate(chunks_response["chunks"]):
# Use Gemini Flash (much cheaper than Claude or GPT-4o) via the server
summary_response = await client.tools.summarize_document(
document=chunk,
provider="gemini", # Explicitly delegate to Gemini via server
model="gemini-2.0-flash-lite",
format="paragraph",
max_length=150 # Request a concise summary
)
if summary_response["success"]:
summaries.append(summary_response["summary"])
cost = summary_response.get("cost", 0.0)
total_cost += cost
print(f" Processed chunk {i+1}/{chunks_response['chunk_count']} summary. Cost: ${cost:.6f}")
else:
print(f" Chunk {i+1} summarization failed: {summary_response['error']}")
print("\nDelegating entity extraction to gpt-4.1-mini...")
# Step 3: Claude delegates entity extraction for the whole document to another cheap model
entities_response = await client.tools.extract_entities(
document=document, # Process the original document
entity_types=["person", "organization", "location", "date", "product"],
provider="openai", # Delegate to OpenAI's cheaper model
model="gpt-4.1-mini"
)
if entities_response["success"]:
cost = entities_response.get("cost", 0.0)
total_cost += cost
print(f"Extracted entities. Cost: ${cost:.6f}")
extracted_entities = entities_response['entities']
# Claude would now process these summaries and entities using its advanced capabilities
print(f"\nClaude can now use {len(summaries)} summaries and {len(extracted_entities)} entity groups.")
else:
print(f"Entity extraction failed: {entities_response['error']}")
print(f"\nTotal estimated delegation cost for sub-tasks: ${total_cost:.6f}")
# Claude might perform final synthesis using the collected results
final_synthesis_prompt = f"""
Synthesize the key information from the following summaries and entities extracted from a large document.
Focus on the main topics, key people involved, and significant events mentioned.
Summaries:
{' '.join(summaries)}
Entities:
{extracted_entities}
Provide a concise final report.
"""
# This final step would likely use Claude itself (not shown here)
await client.close()
# if __name__ == "__main__": asyncio.run(document_analysis_example())
調æ»ã®ããã®ãã©ãŠã¶ãŒèªåå
import asyncio
from mcp.client import Client
async def browser_research_example():
client = Client("http://localhost:8013")
print("Starting browser-based research task...")
# This tool likely orchestrates multiple browser actions (search, navigate, scrape)
# and uses an LLM (specified or default) for synthesis.
result = await client.tools.research_and_synthesize_report(
topic="Latest advances in AI-powered drug discovery using graph neural networks",
instructions={
"search_query": "graph neural networks drug discovery 2024 research",
"search_engines": ["google", "duckduckgo"], # Use multiple search engines
"urls_to_include": ["nature.com", "sciencemag.org", "arxiv.org", "pubmed.ncbi.nlm.nih.gov"], # Prioritize these domains
"max_urls_to_process": 7, # Limit the number of pages to visit/scrape
"min_content_length": 500, # Ignore pages with very little content
"focus_areas": ["novel molecular structures", "binding affinity prediction", "clinical trial results"], # Guide the synthesis
"report_format": "markdown", # Desired output format
"report_length": "detailed", # comprehensive, detailed, summary
"llm_model": "anthropic/claude-3-5-sonnet-20241022" # Specify LLM for synthesis
}
)
if result["success"]:
print("\nResearch report generated successfully!")
print(f"Processed {len(result.get('extracted_data', []))} sources.")
print(f"Total processing time: {result.get('processing_time', 'N/A'):.2f}s")
print(f"Estimated cost: ${result.get('total_cost', 0.0):.6f}") # Includes LLM synthesis cost
print("\n--- Research Report ---")
print(result['report'])
print("-----------------------")
else:
print(f"\nBrowser research failed: {result.get('error', 'Unknown error')}")
if 'details' in result: print(f"Details: {result['details']}")
await client.close()
# if __name__ == "__main__": asyncio.run(browser_research_example())
èªç¥ã¡ã¢ãªãŒã·ã¹ãã ã®äœ¿çš
import asyncio
from mcp.client import Client
import uuid
async def cognitive_memory_example():
client = Client("http://localhost:8013")
# Generate a unique ID for this session/workflow if not provided
workflow_id = str(uuid.uuid4())
print(f"Using Workflow ID: {workflow_id}")
print("\nCreating a workflow context...")
# Create a workflow context to group related memories and actions
workflow_response = await client.tools.create_workflow(
workflow_id=workflow_id,
title="Quantum Computing Investment Analysis",
description="Analyzing the impact of quantum computing on financial markets.",
goal="Identify potential investment opportunities or risks."
)
if not workflow_response["success"]: print(f"Error creating workflow: {workflow_response['error']}")
print("\nRecording an agent action...")
# Record the start of a research action
action_response = await client.tools.record_action_start(
workflow_id=workflow_id,
action_type="research",
title="Initial literature review on quantum algorithms in finance",
reasoning="Need to understand the current state-of-the-art before assessing impact."
)
action_id = action_response.get("action_id") if action_response["success"] else None
if not action_id: print(f"Error starting action: {action_response['error']}")
print("\nStoring facts in semantic memory...")
# Store some key facts discovered during research
memory1 = await client.tools.store_memory(
workflow_id=workflow_id,
content="Shor's algorithm can break RSA encryption, posing a threat to current financial security.",
memory_type="fact", memory_level="semantic", importance=9.0,
tags=["quantum_algorithm", "cryptography", "risk", "shor"]
)
memory2 = await client.tools.store_memory(
workflow_id=workflow_id,
content="Quantum annealing (e.g., D-Wave) shows promise for portfolio optimization problems.",
memory_type="fact", memory_level="semantic", importance=7.5,
tags=["quantum_computing", "finance", "optimization", "annealing"]
)
if memory1["success"]: print(f"Stored memory ID: {memory1['memory_id']}")
if memory2["success"]: print(f"Stored memory ID: {memory2['memory_id']}")
print("\nStoring an observation (episodic memory)...")
# Store an observation from a specific event/document
obs_memory = await client.tools.store_memory(
workflow_id=workflow_id,
content="Read Nature article (doi:...) suggesting experimental quantum advantage in a specific financial modeling task.",
memory_type="observation", memory_level="episodic", importance=8.0,
source="Nature Article XYZ", timestamp="2024-07-20T10:00:00Z", # Example timestamp
tags=["research_finding", "publication", "finance_modeling"]
)
if obs_memory["success"]: print(f"Stored episodic memory ID: {obs_memory['memory_id']}")
print("\nSearching for relevant memories...")
# Search for memories related to financial risks
search_results = await client.tools.hybrid_search_memories(
workflow_id=workflow_id,
query="What are the financial risks associated with quantum computing?",
top_k=5, memory_type="fact", # Search for facts first
semantic_weight=0.7, keyword_weight=0.3 # Example weighting for hybrid search
)
if search_results["success"]:
print(f"Found {len(search_results['results'])} relevant memories:")
for res in search_results["results"]:
print(f" - Score: {res['score']:.4f}, ID: {res['memory_id']}, Content: {res['content'][:80]}...")
else:
print(f"Memory search failed: {search_results['error']}")
print("\nGenerating a reflection based on stored memories...")
# Generate insights or reflections based on the accumulated knowledge in the workflow
reflection_response = await client.tools.generate_reflection(
workflow_id=workflow_id,
reflection_type="summary_and_next_steps", # e.g., insights, risks, opportunities
context_query="Summarize the key findings about quantum finance impact and suggest next research actions."
)
if reflection_response["success"]:
print("Generated Reflection:")
print(reflection_response["reflection"])
else:
print(f"Reflection generation failed: {reflection_response['error']}")
# Mark the action as completed (assuming research phase is done)
if action_id:
print("\nCompleting the research action...")
await client.tools.record_action_end(
workflow_id=workflow_id, action_id=action_id, status="completed",
outcome="Gathered initial understanding of quantum algorithms in finance and associated risks."
)
await client.close()
# if __name__ == "__main__": asyncio.run(cognitive_memory_example())
Excel ã¹ãã¬ããã·ãŒãã®èªåå
import asyncio
from mcp.client import Client
import os
async def excel_automation_example():
client = Client("http://localhost:8013")
output_dir = "excel_outputs"
os.makedirs(output_dir, exist_ok=True)
output_path = os.path.join(output_dir, "financial_model.xlsx")
print(f"Requesting creation of Excel financial model at {output_path}...")
# Example: Create a financial model using natural language instructions
create_result = await client.tools.excel_execute(
instruction="Create a simple 3-year financial projection.\n"
"Sheet name: 'Projections'.\n"
"Columns: Year 1, Year 2, Year 3.\n"
"Rows: Revenue, COGS, Gross Profit, Operating Expenses, Net Income.\n"
"Data: Start Revenue at $100,000, grows 20% annually.\n"
"COGS is 40% of Revenue.\n"
"Operating Expenses start at $30,000, grow 10% annually.\n"
"Calculate Gross Profit (Revenue - COGS) and Net Income (Gross Profit - OpEx).\n"
"Format currency as $#,##0. Apply bold headers and add a light blue fill to the header row.",
file_path=output_path, # Server needs write access to this path/directory if relative
operation_type="create", # create, modify, analyze, format
# sheet_name="Projections", # Can specify sheet if modifying
# cell_range="A1:D6", # Can specify range
show_excel=False # Run Excel in the background (if applicable on the server)
)
if create_result["success"]:
print(f"Excel creation successful: {create_result['message']}")
print(f"File saved at: {create_result.get('output_file_path', output_path)}") # Confirm output path
# Example: Modify the created file - add a chart
print("\nRequesting modification: Add a Revenue chart...")
modify_result = await client.tools.excel_execute(
instruction="Add a column chart showing Revenue for Year 1, Year 2, Year 3. "
"Place it below the table. Title the chart 'Revenue Projection'.",
file_path=output_path, # Use the previously created file
operation_type="modify",
sheet_name="Projections" # Specify the sheet to modify
)
if modify_result["success"]:
print(f"Excel modification successful: {modify_result['message']}")
print(f"File updated at: {modify_result.get('output_file_path', output_path)}")
else:
print(f"Excel modification failed: {modify_result['error']}")
else:
print(f"Excel creation failed: {create_result['error']}")
if 'details' in create_result: print(f"Details: {create_result['details']}")
# Example: Analyze formulas (if the tool supports it)
# analysis_result = await client.tools.excel_analyze_formulas(...)
await client.close()
# if __name__ == "__main__": asyncio.run(excel_automation_example())
è€æ°ãããã€ããŒã®æ¯èŒ
import asyncio
from mcp.client import Client
async def multi_provider_completion_example():
client = Client("http://localhost:8013")
prompt = "Explain the concept of 'Chain of Thought' prompting for Large Language Models."
print(f"Requesting completions for prompt: '{prompt}' from multiple providers...")
# Request the same prompt from different models/providers
multi_response = await client.tools.multi_completion(
prompt=prompt,
providers=[
{"provider": "openai", "model": "gpt-4.1-mini", "temperature": 0.5},
{"provider": "anthropic", "model": "claude-3-5-sonnet-20241022", "temperature": 0.5},
{"provider": "gemini", "model": "gemini-2.0-pro", "temperature": 0.5},
# {"provider": "deepseek", "model": "deepseek-chat", "temperature": 0.5}, # Add others if configured
],
# Common parameters applied to all if not specified per provider
max_tokens=300
)
if multi_response["success"]:
print("\n--- Multi-completion Results ---")
total_cost = multi_response.get("total_cost", 0.0)
print(f"Total Estimated Cost: ${total_cost:.6f}\n")
for provider_key, result in multi_response["results"].items():
print(f"--- Provider: {provider_key} ---")
if result["success"]:
print(f" Model: {result.get('model', 'N/A')}")
print(f" Cost: ${result.get('cost', 0.0):.6f}")
print(f" Tokens: Input={result.get('input_tokens', 'N/A')}, Output={result.get('output_tokens', 'N/A')}")
print(f" Completion:\n{result['completion']}\n")
else:
print(f" Error: {result['error']}\n")
print("------------------------------")
# An agent could now analyze these responses for consistency, detail, accuracy etc.
else:
print(f"\nMulti-completion request failed: {multi_response['error']}")
await client.close()
# if __name__ == "__main__": asyncio.run(multi_provider_completion_example())
ã³ã¹ããæé©åããã¯ãŒã¯ãããŒã®å®è¡
import asyncio
from mcp.client import Client
async def optimized_workflow_example():
client = Client("http://localhost:8013")
# Example document to process through the workflow
document_content = """
Project Alpha Report - Q3 2024
Lead: Dr. Evelyn Reed ([email protected])
Status: On Track
Budget: $50,000 remaining. Spent $25,000 this quarter.
Key Findings: Successful prototype development (v0.8). User testing feedback positive.
Next Steps: Finalize documentation, prepare for Q4 deployment. Target date: 2024-11-15.
Risks: Potential delay due to supplier issues for component X. Mitigation plan in place.
"""
print("Defining a multi-stage workflow...")
# Define a workflow with stages, dependencies, and provider preferences
# Use ${stage_id.output_key} to pass outputs between stages
workflow_definition = [
{
"stage_id": "summarize_report",
"tool_name": "summarize_document",
"params": {
"document": document_content,
"format": "bullet_points",
"max_length": 100,
# Let the server choose a cost-effective model for summarization
"provider_preference": "cost", # 'cost', 'quality', 'speed', or specific like 'openai/gpt-4.1-mini'
}
# No 'depends_on', runs first
# Default output key is 'summary' for this tool, access via ${summarize_report.summary}
},
{
"stage_id": "extract_key_info",
"tool_name": "extract_json", # Use JSON extraction for structured data
"params": {
"document": document_content,
"json_schema": {
"type": "object",
"properties": {
"project_lead": {"type": "string"},
"lead_email": {"type": "string", "format": "email"},
"status": {"type": "string"},
"budget_remaining": {"type": "string"},
"next_milestone_date": {"type": "string", "format": "date"}
},
"required": ["project_lead", "status", "next_milestone_date"]
},
# Prefer a model known for good structured data extraction, balancing cost
"provider_preference": "quality", # Prioritize quality for extraction
"preferred_models": ["openai/gpt-4o", "anthropic/claude-3-5-sonnet-20241022"] # Suggest specific models
}
},
{
"stage_id": "generate_follow_up_questions",
"tool_name": "generate_qa", # Assuming a tool that generates questions
"depends_on": ["summarize_report"], # Needs the summary first
"params": {
# Use the summary from the first stage as input
"document": "${summarize_report.summary}",
"num_questions": 3,
"provider_preference": "speed" # Use a fast model for question generation
}
# Default output key 'qa_pairs', access via ${generate_follow_up_questions.qa_pairs}
}
]
print("Executing the optimized workflow...")
# Execute the workflow - the server handles dependencies and model selection
results = await client.tools.execute_optimized_workflow(
workflow=workflow_definition
# Can also pass initial documents if workflow steps reference 'original_document'
# documents = {"report.txt": document_content}
)
if results["success"]:
print("\nWorkflow executed successfully!")
print(f" Total processing time: {results.get('processing_time', 'N/A'):.2f}s")
print(f" Total estimated cost: ${results.get('total_cost', 0.0):.6f}\n")
print("--- Stage Outputs ---")
for stage_id, output in results.get("stage_outputs", {}).items():
print(f"Stage: {stage_id}")
if output["success"]:
print(f" Provider/Model Used: {output.get('provider', 'N/A')}/{output.get('model', 'N/A')}")
print(f" Cost: ${output.get('cost', 0.0):.6f}")
print(f" Output: {output.get('result', 'N/A')}") # Access the primary result
# You might access specific keys like output.get('result', {}).get('summary') etc.
else:
print(f" Error: {output.get('error', 'Unknown error')}")
print("-" * 20)
else:
print(f"\nWorkflow execution failed: {results.get('error', 'Unknown error')}")
if 'details' in results: print(f"Details: {results['details']}")
await client.close()
# if __name__ == "__main__": asyncio.run(optimized_workflow_example())
ãšã³ãã£ãã£é¢ä¿ã°ã©ãã®äŸ
import asyncio
from mcp.client import Client
# import networkx as nx # To process the graph data if needed
# import matplotlib.pyplot as plt # To visualize
async def entity_graph_example():
client = Client("http://localhost:8013")
document_text = """
Meta Platforms, Inc., led by CEO Mark Zuckerberg, announced a partnership with IBM
on developing new AI hardware accelerators. The collaboration aims to challenge Nvidia's dominance.
IBM, headquartered in Armonk, New York, brings its deep expertise in semiconductor design.
The project, codenamed 'Synergy', is expected to yield results by late 2025.
"""
print("Extracting entity relationships from text...")
# Request extraction of entities and their relationships
entity_graph_response = await client.tools.extract_entity_relations(
document=document_text,
entity_types=["organization", "person", "location", "date", "project"], # Specify desired entity types
relationship_types=["led_by", "partnership_with", "aims_to_challenge", "headquartered_in", "expected_by"], # Specify relationship types
# Optional parameters:
# provider_preference="quality", # Choose model strategy
# llm_model="anthropic/claude-3-5-sonnet-20241022", # Suggest a specific model
include_visualization=False # Set True to request image data if tool supports it
)
if entity_graph_response["success"]:
print("Entity relationship extraction successful.")
print(f"Estimated Cost: ${entity_graph_response.get('cost', 0.0):.6f}")
# The graph data might be in various formats (e.g., node-link list, adjacency list)
graph_data = entity_graph_response.get("graph_data")
print("\n--- Graph Data (Nodes & Edges) ---")
print(graph_data)
print("------------------------------------")
# Example: Query the extracted graph using another tool or LLM call
# (Assuming a separate query tool or using a general completion tool)
print("\nQuerying the extracted graph (example)...")
query_prompt = f"""
Based on the following graph data representing relationships extracted from a text:
{graph_data}
Answer the question: Who is the CEO of Meta Platforms, Inc.?
"""
query_response = await client.tools.completion(
prompt=query_prompt, provider="openai", model="gpt-4.1-mini", max_tokens=50
)
if query_response["success"]:
print(f"Graph Query Answer: {query_response['completion']}")
else:
print(f"Graph query failed: {query_response['error']}")
else:
print(f"Entity relationship extraction failed: {entity_graph_response.get('error', 'Unknown error')}")
await client.close()
# if __name__ == "__main__": asyncio.run(entity_graph_example())
ããã¥ã¡ã³ãã®ãã£ã³ã¯åå²
import asyncio
from mcp.client import Client
async def document_chunking_example():
client = Client("http://localhost:8013")
large_document = """
This is the first paragraph of a potentially very long document. It discusses various concepts.
The second paragraph continues the discussion, adding more details and nuances. Proper chunking
is crucial for processing large texts with Large Language Models, especially those with limited
context windows. Different strategies exist, such as fixed token size, sentence splitting,
or more advanced semantic chunking that tries to keep related ideas together. Overlap between
chunks helps maintain context across boundaries. This paragraph is intentionally made longer
to demonstrate how chunking might split it. It keeps going and going, describing the benefits
of effective text splitting for downstream tasks like summarization, question answering, and
retrieval-augmented generation (RAG). The goal is to create manageable pieces of text that
still retain coherence. Semantic chunking often uses embedding models to find natural breakpoints
in the text's meaning, potentially leading to better results than simple fixed-size chunks.
The final sentence of this example paragraph.
""" * 5 # Make it a bit longer for demonstration
print("Requesting document chunking...")
# Request chunking using a specific method and size
chunking_response = await client.tools.chunk_document(
document=large_document,
chunk_size=100, # Target size in tokens (approximate)
overlap=20, # Token overlap between consecutive chunks
method="semantic" # Options: "token", "sentence", "semantic", "structural" (if available)
)
if chunking_response["success"]:
print(f"Document successfully divided into {chunking_response['chunk_count']} chunks.")
print(f"Method Used: {chunking_response.get('method_used', 'N/A')}") # Confirm method if returned
print("\n--- Example Chunks ---")
for i, chunk in enumerate(chunking_response['chunks'][:3]): # Show first 3 chunks
print(f"Chunk {i+1} (Length: {len(chunk)} chars):")
print(f"'{chunk}'\n")
if chunking_response['chunk_count'] > 3: print("...")
print("----------------------")
# These chunks can now be passed individually to other tools (e.g., summarize_document)
else:
print(f"Document chunking failed: {chunking_response['error']}")
await client.close()
# if __name__ == "__main__": asyncio.run(document_chunking_example())
è€æ°ãããã€ããŒã«ããããã¹ãçæïŒåã®äŸãšéè€ããŠããŸãããæ§æç¶æã®ããèšèŒïŒ
import asyncio
from mcp.client import Client
async def multi_provider_completion_example():
client = Client("http://localhost:8013")
prompt = "What are the main benefits of using the Model Context Protocol (MCP)?"
print(f"Requesting completions for prompt: '{prompt}' from multiple providers...")
multi_response = await client.tools.multi_completion(
prompt=prompt,
providers=[
{"provider": "openai", "model": "gpt-4.1-mini"},
{"provider": "anthropic", "model": "claude-3-5-haiku-20241022"},
{"provider": "gemini", "model": "gemini-2.0-flash-lite"}
# Add more configured providers as needed
],
temperature=0.5,
max_tokens=250
)
if multi_response["success"]:
print("\n--- Multi-completion Results ---")
total_cost = multi_response.get("total_cost", 0.0)
print(f"Total Estimated Cost: ${total_cost:.6f}\n")
for provider_key, result in multi_response["results"].items():
print(f"--- Provider: {provider_key} ---")
if result["success"]:
print(f" Model: {result.get('model', 'N/A')}")
print(f" Cost: ${result.get('cost', 0.0):.6f}")
print(f" Completion:\n{result['completion']}\n")
else:
print(f" Error: {result['error']}\n")
print("------------------------------")
else:
print(f"\nMulti-completion request failed: {multi_response['error']}")
await client.close()
# if __name__ == "__main__": asyncio.run(multi_provider_completion_example())
æ§é åããŒã¿ã®æœåºïŒJSONïŒ
import asyncio
from mcp.client import Client
import json
async def json_extraction_example():
client = Client("http://localhost:8013")
text_with_data = """
Meeting Minutes - Project Phoenix - 2024-07-21
Attendees: Alice (Lead), Bob (Dev), Charlie (QA)
Date: July 21, 2024
Project ID: PX-001
Discussion Points:
- Reviewed user feedback from v1.1 testing. Mostly positive.
- Identified performance bottleneck in data processing module. Bob to investigate. Assigned High priority.
- QA cycle for v1.2 planned to start next Monday (2024-07-29). Charlie confirmed readiness.
Action Items:
1. Bob: Investigate performance issue. Due: 2024-07-26. Priority: High. Status: Open.
2. Alice: Prepare v1.2 release notes. Due: 2024-07-28. Priority: Medium. Status: Open.
"""
# Define the desired JSON structure (schema)
desired_schema = {
"type": "object",
"properties": {
"project_name": {"type": "string", "description": "Name of the project"},
"meeting_date": {"type": "string", "format": "date", "description": "Date of the meeting"},
"attendees": {"type": "array", "items": {"type": "string"}, "description": "List of attendee names"},
"action_items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"task": {"type": "string"},
"assigned_to": {"type": "string"},
"due_date": {"type": "string", "format": "date"},
"priority": {"type": "string", "enum": ["Low", "Medium", "High"]},
"status": {"type": "string", "enum": ["Open", "In Progress", "Done"]}
},
"required": ["task", "assigned_to", "due_date", "priority", "status"]
}
}
},
"required": ["project_name", "meeting_date", "attendees", "action_items"]
}
print("Requesting JSON extraction based on schema...")
# Request extraction using a model capable of following JSON schema instructions
json_response = await client.tools.extract_json(
document=text_with_data,
json_schema=desired_schema,
provider="openai", # OpenAI models are generally good at this
model="gpt-4o", # Use a capable model like GPT-4o or Claude 3.5 Sonnet
# provider_preference="quality" # Could also use preference
)
if json_response["success"]:
print("JSON extraction successful.")
print(f"Estimated Cost: ${json_response.get('cost', 0.0):.6f}")
# The extracted data should conform to the schema
extracted_json_data = json_response.get('json_data')
print("\n--- Extracted JSON Data ---")
# Pretty print the JSON
print(json.dumps(extracted_json_data, indent=2))
print("---------------------------")
# Optionally, validate the output against the schema client-side (requires jsonschema library)
# try:
# from jsonschema import validate
# validate(instance=extracted_json_data, schema=desired_schema)
# print("\nClient-side validation successful: Output matches schema.")
# except ImportError:
# print("\n(Install jsonschema to perform client-side validation)")
# except Exception as e:
# print(f"\nClient-side validation failed: {e}")
else:
print(f"JSON Extraction Error: {json_response.get('error', 'Unknown error')}")
if 'details' in json_response: print(f"Details: {json_response['details']}")
await client.close()
# if __name__ == "__main__": asyncio.run(json_extraction_example())
æ€çŽ¢æ¡åŒµçæïŒRAGïŒã¯ãšãª
import asyncio
from mcp.client import Client
async def rag_query_example():
# This example assumes the Ultimate MCP Server has been configured with a RAG pipeline,
# including a vector store/index containing relevant documents.
client = Client("http://localhost:8013")
query = "What are the latest treatment options for mitigating Alzheimer's disease according to recent studies?"
print(f"Performing RAG query: '{query}'...")
# Call the RAG tool, which handles retrieval and generation
rag_response = await client.tools.rag_query( # Assuming the tool name is 'rag_query'
query=query,
# Optional parameters to control the RAG process:
index_name="medical_research_papers", # Specify the index/collection to search
top_k=3, # Retrieve top 3 most relevant documents/chunks
# filter={"year": {"$gte": 2023}}, # Example filter (syntax depends on vector store)
# generation_model={"provider": "anthropic", "model": "claude-3-5-sonnet-20241022"}, # Specify generation model
# instruction_prompt="Based on the provided context, answer the user's query concisely." # Customize generation prompt
)
if rag_response["success"]:
print("\nRAG query successful.")
print(f"Estimated Cost: ${rag_response.get('cost', 0.0):.6f}") # Includes retrieval + generation cost
print("\n--- Generated Answer ---")
print(rag_response.get('answer', 'No answer generated.'))
print("------------------------")
# The response might also include details about the retrieved sources
retrieved_sources = rag_response.get('sources', [])
if retrieved_sources:
print("\n--- Retrieved Sources ---")
for i, source in enumerate(retrieved_sources):
print(f"Source {i+1}:")
print(f" ID: {source.get('id', 'N/A')}")
print(f" Score: {source.get('score', 'N/A'):.4f}")
# Depending on RAG setup, might include metadata or text snippet
print(f" Content Snippet: {source.get('text', '')[:150]}...")
print("-" * 15)
print("-----------------------")
else:
print("\nNo sources information provided in the response.")
else:
print(f"\nRAG Query Error: {rag_response.get('error', 'Unknown error')}")
if 'details' in rag_response: print(f"Details: {rag_response['details']}")
await client.close()
# if __name__ == "__main__": asyncio.run(rag_query_example())
èåæ€çŽ¢ïŒããŒã¯ãŒãïŒã»ãã³ãã£ãã¯æ€çŽ¢ïŒ
import asyncio
from mcp.client import Client
async def fused_search_example():
# This example assumes the server is configured with a hybrid search provider like Marqo.
client = Client("http://localhost:8013")
query = "impact of AI on software development productivity and code quality"
print(f"Performing fused search for: '{query}'...")
# Call the fused search tool
fused_search_response = await client.tools.fused_search( # Assuming tool name is 'fused_search'
query=query,
# --- Parameters specific to the hybrid search backend (e.g., Marqo) ---
index_name="tech_articles_index", # Specify the target index
searchable_attributes=["title", "content"], # Fields to search within
limit=5, # Number of results to return
# Tunable weights for keyword vs. semantic relevance (example)
hybrid_factors={"keyword_weight": 0.4, "semantic_weight": 0.6},
# Optional filter string (syntax depends on backend)
filter_string="publication_year >= 2023 AND source_type='journal'"
# --------------------------------------------------------------------
)
if fused_search_response["success"]:
print("\nFused search successful.")
results = fused_search_response.get("results", [])
print(f"Found {len(results)} hits.")
if results:
print("\n--- Search Results ---")
for i, hit in enumerate(results):
print(f"Result {i+1}:")
# Fields depend on Marqo index structure and what's returned
print(f" ID: {hit.get('_id', 'N/A')}")
print(f" Score: {hit.get('_score', 'N/A'):.4f}") # Combined score
print(f" Title: {hit.get('title', 'N/A')}")
print(f" Content Snippet: {hit.get('content', '')[:150]}...")
# Print highlight info if available
highlights = hit.get('_highlights', {})
if highlights: print(f" Highlights: {highlights}")
print("-" * 15)
print("--------------------")
else:
print("No results found matching the criteria.")
else:
print(f"\nFused Search Error: {fused_search_response.get('error', 'Unknown error')}")
if 'details' in fused_search_response: print(f"Details: {fused_search_response['details']}")
await client.close()
# if __name__ == "__main__": asyncio.run(fused_search_example())
ããŒã«ã«ã§ã®ããã¹ãåŠç
import asyncio
from mcp.client import Client
async def local_text_processing_example():
client = Client("http://localhost:8013")
# Example assumes a tool named 'process_local_text' exists on the server
# that bundles various non-LLM text operations.
raw_text = " This text has EXTRA whitespace,\n\nmultiple newlines, \t tabs, and needs Case Normalization. "
print("Requesting local text processing operations...")
local_process_response = await client.tools.process_local_text(
text=raw_text,
operations=[
{"action": "trim_whitespace"}, # Remove leading/trailing whitespace
{"action": "normalize_whitespace"}, # Collapse multiple spaces/tabs to single space
{"action": "remove_blank_lines"}, # Remove empty lines
{"action": "lowercase"} # Convert to lowercase
# Other potential actions: uppercase, remove_punctuation, normalize_newlines, etc.
]
)
if local_process_response["success"]:
print("\nLocal text processing successful.")
print(f"Original Text:\n'{raw_text}'")
print(f"\nProcessed Text:\n'{local_process_response['processed_text']}'")
# Note: This operation should ideally have zero LLM cost.
print(f"Cost: ${local_process_response.get('cost', 0.0):.6f}")
else:
print(f"\nLocal Text Processing Error: {local_process_response['error']}")
await client.close()
# if __name__ == "__main__": asyncio.run(local_text_processing_example())
ãã©ãŠã¶ãŒèªååã®äŸïŒå°å ¥ãšåºæ¬æäœ
import asyncio
from mcp.client import Client
async def browser_basic_interaction_example():
# This example shows fundamental browser actions controlled by an agent
client = Client("http://localhost:8013")
print("--- Browser Automation: Basic Interaction ---")
# 1. Initialize the browser (creates a browser instance on the server)
print("\nInitializing browser (headless)...")
# `headless=True` runs without a visible GUI window (common for automation)
init_response = await client.tools.browser_init(headless=True, browser_type="chromium")
if not init_response["success"]:
print(f"Browser initialization failed: {init_response.get('error', 'Unknown error')}")
await client.close()
return
print("Browser initialized successfully.")
# Might return session ID if needed for subsequent calls, depends on tool design
# 2. Navigate to a page
target_url = "https://example.com/"
print(f"\nNavigating to {target_url}...")
# `wait_until` controls when navigation is considered complete
nav_response = await client.tools.browser_navigate(
url=target_url,
wait_until="domcontentloaded" # Options: load, domcontentloaded, networkidle, commit
)
if nav_response["success"]:
print(f"Navigation successful.")
print(f" Current URL: {nav_response.get('url', 'N/A')}")
print(f" Page Title: {nav_response.get('title', 'N/A')}")
# The 'snapshot' gives the agent context about the page state (accessibility tree)
# print(f" Snapshot: {nav_response.get('snapshot', 'N/A')}")
else:
print(f"Navigation failed: {nav_response.get('error', 'Unknown error')}")
# Attempt to close browser even if navigation failed
await client.tools.browser_close()
await client.close()
return
# 3. Extract text content using a CSS selector
selector = "h1" # CSS selector for the main heading
print(f"\nExtracting text from selector '{selector}'...")
text_response = await client.tools.browser_get_text(selector=selector)
if text_response["success"]:
print(f"Extracted text: '{text_response.get('text', 'N/A')}'")
else:
print(f"Text extraction failed: {text_response.get('error', 'Unknown error')}")
# Optionally check text_response['snapshot'] for page state at time of failure
# 4. Take a screenshot (optional)
print("\nTaking a screenshot...")
screenshot_response = await client.tools.browser_screenshot(
file_path="example_com_screenshot.png", # Path where server saves the file
full_page=False, # Capture only the viewport
image_format="png" # png or jpeg
)
if screenshot_response["success"]:
print(f"Screenshot saved successfully on server at: {screenshot_response.get('saved_path', 'N/A')}")
# Agent might use this path with a filesystem tool to retrieve the image if needed
else:
print(f"Screenshot failed: {screenshot_response.get('error', 'Unknown error')}")
# 5. Close the browser session
print("\nClosing the browser...")
close_response = await client.tools.browser_close()
if close_response["success"]:
print("Browser closed successfully.")
else:
# Log error, but might happen if browser already crashed
print(f"Browser close failed (might be expected if previous steps failed): {close_response.get('error', 'Unknown error')}")
print("--- Browser Automation Example Complete ---")
await client.close()
# if __name__ == "__main__": asyncio.run(browser_basic_interaction_example())
ã¢ãã«ããŒãã¡ã³ãã®å®è¡
import asyncio
from mcp.client import Client
import json
async def model_tournament_example():
client = Client("http://localhost:8013")
# Define the task and prompt for the tournament
task_prompt = "Write a Python function that takes a list of integers and returns a new list containing only the even numbers."
# Optional: Provide ground truth for automated evaluation if the tool supports it
ground_truth_code = """
def get_even_numbers(numbers):
\"\"\"Returns a new list containing only the even numbers from the input list.\"\"\"
return [num for num in numbers if num % 2 == 0]
"""
print("Setting up and running a model tournament for code generation...")
# Call the tournament tool
tournament_response = await client.tools.run_model_tournament(
task_type="code_generation", # Helps select appropriate evaluation metrics
prompt=task_prompt,
# List of models/providers to compete
competitors=[
{"provider": "openai", "model": "gpt-4.1-mini", "temperature": 0.2},
{"provider": "anthropic", "model": "claude-3-5-sonnet-20241022", "temperature": 0.2},
{"provider": "deepseek", "model": "deepseek-coder", "temperature": 0.2}, # Specialized coder model
{"provider": "gemini", "model": "gemini-2.0-pro", "temperature": 0.2},
],
# Criteria for evaluating the generated code
evaluation_criteria=["correctness", "efficiency", "readability", "docstring_quality"],
# Provide ground truth if available for automated correctness checks
ground_truth=ground_truth_code,
# Optional: Specify an LLM to act as the judge for qualitative criteria
evaluation_model={"provider": "anthropic", "model": "claude-3-5-opus-20240229"}, # Use a powerful model for judging
num_rounds=1 # Run multiple rounds for stability if needed
)
if tournament_response["success"]:
print("\n--- Model Tournament Results ---")
print(f"Task Prompt: {task_prompt}")
print(f"Total Estimated Cost: ${tournament_response.get('total_cost', 0.0):.6f}\n")
# Display the ranking
ranking = tournament_response.get("ranking", [])
if ranking:
print("Overall Ranking:")
for i, result in enumerate(ranking):
provider = result.get('provider', 'N/A')
model = result.get('model', 'N/A')
score = result.get('overall_score', 'N/A')
cost = result.get('cost', 0.0)
print(f" {i+1}. {provider}/{model} - Score: {score:.2f}/10 - Cost: ${cost:.6f}")
else:
print("No ranking information available.")
# Display detailed results for each competitor
detailed_results = tournament_response.get("results", {})
if detailed_results:
print("\nDetailed Scores per Competitor:")
for competitor_key, details in detailed_results.items():
print(f" Competitor: {competitor_key}")
print(f" Generated Code:\n```python\n{details.get('output', 'N/A')}\n```")
scores = details.get('scores', {})
if scores:
for criterion, score_value in scores.items():
print(f" - {criterion}: {score_value}")
print("-" * 10)
print("------------------------------")
else:
print(f"\nModel Tournament Failed: {tournament_response.get('error', 'Unknown error')}")
if 'details' in tournament_response: print(f"Details: {tournament_response['details']}")
await client.close()
# if __name__ == "__main__": asyncio.run(model_tournament_example())
ããŒã«æ¢çŽ¢ã®ããã®ã¡ã¿ããŒã«
import asyncio
from mcp.client import Client
import json
async def meta_tools_example():
client = Client("http://localhost:8013")
print("--- Meta Tools Example ---")
# 1. List all available tools
print("\nFetching list of available tools...")
# Assumes a tool named 'list_tools' provides this info
list_tools_response = await client.tools.list_tools(include_schemas=False) # Set True for full schemas
if list_tools_response["success"]:
tools = list_tools_response.get("tools", {})
print(f"Found {len(tools)} available tools:")
for tool_name, tool_info in tools.items():
description = tool_info.get('description', 'No description available.')
print(f" - {tool_name}: {description[:100]}...") # Print truncated description
else:
print(f"Failed to list tools: {list_tools_response.get('error', 'Unknown error')}")
# 2. Get detailed information about a specific tool
tool_to_inspect = "extract_json"
print(f"\nFetching details for tool: '{tool_to_inspect}'...")
# Assumes a tool like 'get_tool_info' or using list_tools with specific name/schema flag
tool_info_response = await client.tools.list_tools(tool_names=[tool_to_inspect], include_schemas=True)
if tool_info_response["success"] and tool_to_inspect in tool_info_response.get("tools", {}):
tool_details = tool_info_response["tools"][tool_to_inspect]
print(f"\nDetails for '{tool_to_inspect}':")
print(f" Description: {tool_details.get('description', 'N/A')}")
# Print the parameter schema if available
schema = tool_details.get('parameters', {}).get('json_schema', {})
if schema:
print(f" Parameter Schema:\n{json.dumps(schema, indent=2)}")
else:
print(" Parameter Schema: Not available.")
else:
print(f"Failed to get info for tool '{tool_to_inspect}': {tool_info_response.get('error', 'Not found or error')}")
# 3. Get tool recommendations for a task (if such a meta tool exists)
task_description = "Read data from a PDF file, extract tables, and save them as CSV."
print(f"\nGetting tool recommendations for task: '{task_description}'...")
# Assumes a tool like 'get_tool_recommendations'
recommendations_response = await client.tools.get_tool_recommendations(
task=task_description,
constraints={"priority": "accuracy", "max_cost_per_doc": 0.10} # Example constraints
)
if recommendations_response["success"]:
print("Recommended Tool Workflow:")
recommendations = recommendations_response.get("recommendations", [])
if recommendations:
for i, step in enumerate(recommendations):
print(f" Step {i+1}: Tool='{step.get('tool', 'N/A')}' - Reason: {step.get('reason', 'N/A')}")
else:
print(" No recommendations provided.")
else:
print(f"Failed to get recommendations: {recommendations_response.get('error', 'Unknown error')}")
print("\n--- Meta Tools Example Complete ---")
await client.close()
# if __name__ == "__main__": asyncio.run(meta_tools_example())
ããŒã«ã«ã®ã³ãã³ãã©ã€ã³ã§ã®ããã¹ãåŠçïŒäŸïŒjqïŒ
import asyncio
from mcp.client import Client
import json
async def local_cli_tool_example():
client = Client("http://localhost:8013")
print("--- Local CLI Tool Example (jq) ---")
# Example JSON data to be processed by jq
json_input_data = json.dumps({
"users": [
{"id": 1, "name": "Alice", "email": "[email protected]", "status": "active"},
{"id": 2, "name": "Bob", "email": "[email protected]", "status": "inactive"},
{"id": 3, "name": "Charlie", "email": "[email protected]", "status": "active"}
],
"metadata": {"timestamp": "2024-07-21T12:00:00Z"}
})
# Define the jq filter to apply
# This filter selects active users and outputs their name and email
jq_filter = '.users[] | select(.status=="active") | {name: .name, email: .email}'
print(f"\nRunning jq with filter: '{jq_filter}' on input JSON...")
# Call the server tool that wraps jq (e.g., 'run_jq')
jq_result = await client.tools.run_jq(
args_str=jq_filter, # Pass the filter as arguments (check tool spec how it expects filters)
input_data=json_input_data, # Provide the JSON string as input
# Additional options might be available depending on the tool wrapper:
# e.g., output_format="json_lines" or "compact_json"
)
if jq_result["success"]:
print("jq execution successful.")
# stdout typically contains the result of the jq filter
print("\n--- jq Output (stdout) ---")
print(jq_result.get("stdout", "No output"))
print("--------------------------")
# stderr might contain warnings or errors from jq itself
stderr_output = jq_result.get("stderr")
if stderr_output:
print("\n--- jq Stderr ---")
print(stderr_output)
print("-----------------")
# This should have minimal or zero cost as it runs locally on the server
print(f"\nCost: ${jq_result.get('cost', 0.0):.6f}")
else:
print(f"\njq Execution Error: {jq_result.get('error', 'Unknown error')}")
print(f"Stderr: {jq_result.get('stderr', 'N/A')}")
print("\n--- Local CLI Tool Example Complete ---")
await client.close()
# if __name__ == "__main__": asyncio.run(local_cli_tool_example())
åç API çµ±å
import asyncio
from mcp.client import Client
import json
async def dynamic_api_example():
# This example assumes the server has tools like 'register_api', 'list_registered_apis',
# 'call_dynamic_tool', and 'unregister_api'.
client = Client("http://localhost:8013")
print("--- Dynamic API Integration Example ---")
# 1. Register an external API using its OpenAPI (Swagger) specification URL
api_name_to_register = "public_cat_facts"
openapi_spec_url = "https://catfact.ninja/docs/api-docs.json" # Example public API spec
print(f"\nRegistering API '{api_name_to_register}' from {openapi_spec_url}...")
register_response = await client.tools.register_api(
api_name=api_name_to_register,
openapi_url=openapi_spec_url,
# Optional: Provide authentication details if needed (e.g., Bearer token, API Key)
# authentication={"type": "bearer", "token": "your_api_token"},
# Optional: Set default headers
# default_headers={"X-Custom-Header": "value"},
# Optional: Cache settings for API responses (if tool supports it)
cache_ttl=300 # Cache responses for 5 minutes
)
if register_response["success"]:
print(f"API '{api_name_to_register}' registered successfully.")
print(f" Registered {register_response.get('tools_count', 0)} new MCP tools derived from the API.")
print(f" Tools Registered: {register_response.get('tools_registered', [])}")
else:
print(f"API registration failed: {register_response.get('error', 'Unknown error')}")
await client.close()
return
# 2. List currently registered dynamic APIs
print("\nListing registered dynamic APIs...")
list_apis_response = await client.tools.list_registered_apis()
if list_apis_response["success"]:
registered_apis = list_apis_response.get("apis", {})
print(f"Currently registered APIs: {list(registered_apis.keys())}")
# print(json.dumps(registered_apis, indent=2)) # Print full details
else:
print(f"Failed to list registered APIs: {list_apis_response.get('error', 'Unknown error')}")
# 3. Call a dynamically created tool corresponding to an API endpoint
# The tool name is typically derived from the API name and endpoint's operationId or path.
# Check the 'tools_registered' list from step 1 or documentation for the exact name.
# Let's assume the tool for GET /fact is 'public_cat_facts_getFact'
dynamic_tool_name = "public_cat_facts_getFact" # Adjust based on actual registered name
print(f"\nCalling dynamic tool '{dynamic_tool_name}'...")
call_response = await client.tools.call_dynamic_tool(
tool_name=dynamic_tool_name,
# Provide inputs matching the API endpoint's parameters
inputs={
# Example query parameter for GET /fact (check API spec)
"max_length": 100
}
)
if call_response["success"]:
print("Dynamic tool call successful.")
# The result usually contains the API's response body and status code
print(f" Status Code: {call_response.get('status_code', 'N/A')}")
print(f" Response Body:\n{json.dumps(call_response.get('response_body', {}), indent=2)}")
else:
print(f"Dynamic tool call failed: {call_response.get('error', 'Unknown error')}")
print(f" Status Code: {call_response.get('status_code', 'N/A')}")
print(f" Response Body: {call_response.get('response_body', 'N/A')}")
# 4. Unregister the API when no longer needed (optional cleanup)
print(f"\nUnregistering API '{api_name_to_register}'...")
unregister_response = await client.tools.unregister_api(api_name=api_name_to_register)
if unregister_response["success"]:
print(f"API unregistered successfully. Removed {unregister_response.get('tools_count', 0)} tools.")
else:
print(f"API unregistration failed: {unregister_response.get('error', 'Unknown error')}")
print("\n--- Dynamic API Integration Example Complete ---")
await client.close()
# if __name__ == "__main__": asyncio.run(dynamic_api_example())
OCR ã®äœ¿çšäŸ
import asyncio
from mcp.client import Client
import os
async def ocr_example():
# Requires 'ocr' extras installed: uv pip install -e ".[ocr]"
# Also requires Tesseract OCR engine installed on the server host system.
client = Client("http://localhost:8013")
print("--- OCR Tool Example ---")
# --- Create dummy files for testing ---
# In a real scenario, these files would exist on a path accessible by the server.
# Ensure the server process has permissions to read these files.
dummy_files_dir = "ocr_test_files"
os.makedirs(dummy_files_dir, exist_ok=True)
dummy_pdf_path = os.path.join(dummy_files_dir, "dummy_document.pdf")
dummy_image_path = os.path.join(dummy_files_dir, "dummy_image.png")
# Create a simple dummy PDF (requires reportlab - pip install reportlab)
try:
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter
c = canvas.Canvas(dummy_pdf_path, pagesize=letter)
c.drawString(100, 750, "This is page 1 of a dummy PDF.")
c.drawString(100, 730, "It contains some text for OCR testing.")
c.showPage()
c.drawString(100, 750, "This is page 2.")
c.save()
print(f"Created dummy PDF: {dummy_pdf_path}")
except ImportError:
print("Could not create dummy PDF: reportlab not installed. Skipping PDF test.")
dummy_pdf_path = None
except Exception as e:
print(f"Error creating dummy PDF: {e}. Skipping PDF test.")
dummy_pdf_path = None
# Create a simple dummy PNG image (requires Pillow - pip install Pillow)
try:
from PIL import Image, ImageDraw, ImageFont
img = Image.new('RGB', (400, 100), color = (255, 255, 255))
d = ImageDraw.Draw(img)
# Use a default font if possible, otherwise basic text
try: font = ImageFont.truetype("arial.ttf", 15)
except IOError: font = ImageFont.load_default()
d.text((10,10), "Dummy Image Text for OCR\nLine 2 of text.", fill=(0,0,0), font=font)
img.save(dummy_image_path)
print(f"Created dummy Image: {dummy_image_path}")
except ImportError:
print("Could not create dummy Image: Pillow not installed. Skipping Image test.")
dummy_image_path = None
except Exception as e:
print(f"Error creating dummy Image: {e}. Skipping Image test.")
dummy_image_path = None
# --- End of dummy file creation ---
# 1. Extract text from the PDF using OCR and LLM correction
if dummy_pdf_path:
print(f"\nExtracting text from PDF: {dummy_pdf_path} (using hybrid method)...")
pdf_text_result = await client.tools.extract_text_from_pdf(
file_path=dummy_pdf_path, # Server needs access to this path
extraction_method="hybrid", # Try direct extraction, fallback to OCR
max_pages=2, # Limit pages to process
reformat_as_markdown=True, # Request markdown formatting
# Optional: Use an LLM to correct/improve the raw OCR text
llm_correction_model={"provider": "openai", "model": "gpt-4.1-mini"}
)
if pdf_text_result["success"]:
print("PDF text extraction successful.")
print(f" Method Used: {pdf_text_result.get('extraction_method_used', 'N/A')}")
print(f" Cost (incl. LLM correction): ${pdf_text_result.get('cost', 0.0):.6f}")
print("\n--- Extracted PDF Text (Markdown) ---")
print(pdf_text_result.get("text", "No text extracted."))
print("-------------------------------------")
else:
print(f"PDF OCR failed: {pdf_text_result.get('error', 'Unknown error')}")
if 'details' in pdf_text_result: print(f"Details: {pdf_text_result['details']}")
else:
print("\nSkipping PDF OCR test as dummy file could not be created.")
# 2. Process the image file with OCR and preprocessing
if dummy_image_path:
print(f"\nProcessing image OCR: {dummy_image_path} with preprocessing...")
image_text_result = await client.tools.process_image_ocr(
image_path=dummy_image_path, # Server needs access to this path
# Optional preprocessing steps (require OpenCV on server)
preprocessing_options={
"grayscale": True,
# "threshold": "otsu", # e.g., otsu, adaptive
# "denoise": True,
# "deskew": True
},
ocr_language="eng" # Specify language(s) for Tesseract e.g., "eng+fra"
# Optional LLM enhancement for image OCR results
# llm_enhancement_model={"provider": "gemini", "model": "gemini-2.0-flash-lite"}
)
if image_text_result["success"]:
print("Image OCR successful.")
print(f" Cost (incl. LLM enhancement): ${image_text_result.get('cost', 0.0):.6f}")
print("\n--- Extracted Image Text ---")
print(image_text_result.get("text", "No text extracted."))
print("----------------------------")
else:
print(f"Image OCR failed: {image_text_result.get('error', 'Unknown error')}")
if 'details' in image_text_result: print(f"Details: {image_text_result['details']}")
else:
print("\nSkipping Image OCR test as dummy file could not be created.")
# --- Clean up dummy files ---
# try:
# if dummy_pdf_path and os.path.exists(dummy_pdf_path): os.remove(dummy_pdf_path)
# if dummy_image_path and os.path.exists(dummy_image_path): os.remove(dummy_image_path)
# if os.path.exists(dummy_files_dir): os.rmdir(dummy_files_dir) # Only if empty
# except Exception as e:
# print(f"\nError cleaning up dummy files: {e}")
# --- End cleanup ---
print("\n--- OCR Tool Example Complete ---")
await client.close()
# if __name__ == "__main__": asyncio.run(ocr_example())
(泚ïŒãã¡ã€ã«ãã¹ã䜿çšããå€ãã®äŸã§ã¯ããµãŒããŒããã»ã¹ããããã®ãã¹ã«ã¢ã¯ã»ã¹ã§ããããšãåæãšããŠããŸããDocker ã§ãããã€ããå Žåãéåžžã¯ããªã¥ãŒã ã®ãããã³ã°ãå¿ èŠã§ãã)
âš èªåŸåããã¥ã¡ã³ããªãã¡ã€ããŒ
Ultimate MCP Server ã«ã¯ãç»é²æžã¿ã® MCP ããŒã«ã®ããã¥ã¡ã³ããèªåŸçã«åæããã¹ããæ¹åãã匷åãªæ©èœãå«ãŸããŠããŸããultimate/tools/docstring_refiner.py ã«å®è£
ããããã®æ©èœã¯ãClaude ã®ãããªå€§èŠæš¡èšèªã¢ãã«ïŒLLMïŒãããŒã«ãåŒã³åºãéã®äœ¿ãããããšä¿¡é Œæ§ã®åäžã«åœ¹ç«ã¡ãŸãã
ä»çµã¿
ããã¥ã¡ã³ããªãã¡ã€ããŒã¯ãäœç³»çãã€å埩çãªã¢ãããŒãã«åŸããŸãã
- ãšãŒãžã§ã³ãã®ã·ãã¥ã¬ãŒã·ã§ã³ïŒLLM ãšãŒãžã§ã³ããçŸåšã®ããã¥ã¡ã³ãïŒdocstringãã¹ããŒãã䜿çšäŸïŒãã©ã®ããã«è§£éããããã·ãã¥ã¬ãŒã·ã§ã³ããæ£ããåŒã³åºãããã«éèŠãªææ§ããäžè¶³æ å ±ãç¹å®ããŸãã
- é©å¿åãã¹ãçæïŒããŒã«ã®å ¥åã¹ããŒãïŒãã©ã¡ãŒã¿ãŒã®åãå¶çŽãå¿ é ãã£ãŒã«ãïŒãã·ãã¥ã¬ãŒã·ã§ã³çµæã以åã®æ¹åãµã€ã¯ã«ã§çºçãã倱æã«åºã¥ãã倿§ãªãã¹ãã±ãŒã¹ãäœæããŸããååãªã«ãã¬ããžãç®æããŸãã
- ã¹ããŒããèæ ®ãããã¹ãïŒçæãããã¹ãå ¥åããå®è¡ããåã«ããŒã«ã®ã¹ããŒããšç §åããŠæ€èšŒããŸããæå¹ãªãã¹ãã¯ããµãŒããŒç°å¢å ã§å®éã®ããŒã«å®è£ ã«å¯ŸããŠå®è¡ããŸãã
- ã¢ã³ãµã³ãã«ã«ãã倱æåæïŒãã¹ãã«å€±æããå ŽåïŒåºåã誀ã£ãŠããããšã©ãŒãçºçãããªã©ïŒãè€æ°ã® LLM ãããã®ãã¹ãå®è¡ã«äœ¿çšãããç¹å®ããŒãžã§ã³ã®ããã¥ã¡ã³ããèžãŸããŠå€±æãåæããããã¥ã¡ã³ãã®åŒ±ç¹ãç¹å®ããŸãã
- æ§é åãããæ¹åæ¡ïŒåæã«åºã¥ããã·ã¹ãã ã¯å
·äœçã§çãçµã£ãæ¹åæ¡ãçæããŸãã
- 説æïŒè¡šçŸã倿Žããããæç¢ºãªèª¬æã远å ãããããŸãã
- ã¹ããŒãïŒJSON Patch æäœã«ãã倿Žãææ¡ããŸãïŒãã©ã¡ãŒã¿ãŒãžã®èª¬æã®è¿œå ãåã®èª¿æŽã䜿çšäŸã®è¿œå ãªã©ïŒã
- 䜿çšäŸïŒæ°ãã䜿çšäŸãçæããããæ¢åã®äœ¿çšäŸãæ¹åããŸãã
- æ€èšŒæžã¿ã®ã¹ããŒããããé©çšïŒææ¡ããã JSON ããããã¹ããŒãã«ã¡ã¢ãªäžã§é©çšããæ¬¡ã®å埩ã«åããŠå€æŽãåãå ¥ããåã«ã倿ŽåŸã®ã¹ããŒãæ§é ãæ€èšŒããŸãã
- å埩çãªæ¹åïŒãã¹ãã«å®å®ããŠåæ Œããããæå€§ååŸ©åæ°ã«éãããŸã§ããã¹ãçæ â å®è¡ â 倱æåæ â æ¹åæ¡ã®æç€º â ã¹ããŒããžã®ãããé©çšããšãããµã€ã¯ã«ãç¹°ãè¿ããŸãã
- ä»»æã®åã蟌ã¿ïŒå埩ã®åŸããã¹ãã§å€æããéèŠãªæ å ±ãç¶æããªãããããã¥ã¡ã³ããç°¡æœã«ãŸãšããŠæŽããæçµç¢ºèªãè¡ããŸãã
ã¡ãªãã
- æäœæ¥ã®åæžïŒLLM ãå©çšããé«å質ãªããŒã«ããã¥ã¡ã³ãã®äœæãšä¿å®ã«äŒŽããç ©éã«ãªããã¡ãªäœæ¥ãèªååããŸãã
- ãšãŒãžã§ã³ãã®æ§èœåäžïŒããæç¢ºã§ç²ŸåºŠã®é«ãããã¥ã¡ã³ããäœæããLLM ãããŒã«ã䜿ãéã®ãšã©ãŒãæžãããŸãã
- ãšããžã±ãŒã¹ã®ç¹å®ïŒãã¹ãããã»ã¹ã«ãã£ãŠã人éã®äœæè ãèŠèœãšãå¯èœæ§ã®ããææ§ãããšããžã±ãŒã¹ãçºèŠã§ããŸãã
- äžè²«æ§ã®åäžïŒãã¹ãŠã®ããŒã«ã®ããã¥ã¡ã³ãã§ãããçµ±äžãããã¹ã¿ã€ã«ãšè©³çŽ°åºŠã確ç«ã§ããŸãã
- ãã£ãŒãããã¯ãžã®é©å¿ïŒã·ãã¥ã¬ãŒã·ã§ã³ãããšãŒãžã§ã³ãã®å€±æããçŽæ¥åŠç¿ããããã¥ã¡ã³ãã®ç¹å®ã®åŒ±ç¹ã«å¯ŸåŠããŸãã
- ã¹ããŒãã®é²åïŒäœ¿çšã·ãã¥ã¬ãŒã·ã§ã³ã«åºã¥ããæ€èšŒãçµãªããããŒã«ã¹ããŒããæ®µéçã«æ¹åã§ããŸãã
- 詳现ãªã¬ããŒãïŒå®è¡ãããã¹ããçºçãã倱æãè¡ã£ã倿Žãªã©ãæ¹åããã»ã¹å šäœã®å æ¬çãªãã°ãšã¬ããŒããæäŸããŸãã
å¶éäºé ãšèæ ®ç¹
- ã³ã¹ããšæéïŒããŒã«ããšãå埩ããšã«ãã·ãã¥ã¬ãŒã·ã§ã³ããã¹ãçæã倱æåæãæ¹åæ¡ã®æç€ºã«è€æ°åã® LLM åŒã³åºããå¿ èŠãšãªããããèšç®ã³ã¹ããé«ããæéããããå ŽåããããŸãã
- ãªãœãŒã¹ã®æ¶è²»ïŒç¹ã«ã倿°ã®ããŒã«ãæ¹åããå Žåããåæã«å€§èŠæš¡ãª LLM ã䜿çšããå Žåã¯ãããªãã® CPUïŒã¡ã¢ãªãå¿ èŠã«ãªãããšããããŸãã
- LLM ãžã®äŸåïŒæ¹åã®å質ã¯ãåæãšçæã®å·¥çšã§äœ¿çšãã LLM ã®èœåã«å€§ããå·Šå³ãããŸãã
- ã¹ããŒãã®è€éãïŒéåžžã«è€éãªã¹ããŒããå ¥ãåæ§é ã®ã¹ããŒãã«å¯ŸããŠãæ£ããæå³ã®ãã JSON Patch ãçæããããšã¯ãLLM ã«ãšã£ãŠé£ããå ŽåããããŸãã
- æ±ºå®æ§ïŒãã®ããã»ã¹ã§ã¯ LLM ã䜿çšãããããå®è¡ããšã«çµæãå®å šã«ã¯åçŸãããªãå¯èœæ§ããããŸãã
- ä¿å®ã®è€éãïŒãªãã¡ã€ããŒèªäœãè€éãªã·ã¹ãã ã§ãããäŸåé¢ä¿ã®ä¿å®ãå¿ èŠã§ãã
䜿çšããã¿ã€ãã³ã°
ãã®æ©èœã¯ãç¹ã«æ¬¡ã®ãããªå Žåã«åœ¹ç«ã¡ãŸãã
- LLM ãšãŒãžã§ã³ãã«å ¬éããŠãã MCP ããŒã«ã®æ°ãå€ãå Žåã
- ãšãŒãžã§ã³ãã«ããããã¥ã¡ã³ãã®èª€è§£ãåå ãšæãããããŒã«ã®äœ¿çšå€±æãé »ç¹ã«çºçããŠããå Žåã
- ããŒã«ãšã³ã·ã¹ãã ãç©æ¥µçã«éçºãŸãã¯æ¡åŒµããŠãããäžè²«æ§ã®ããé«å質ãªããã¥ã¡ã³ãã確ä¿ããå¿ èŠãããå Žåã
- åºç€ãšãªãããŒã«ã®ã³ãŒããå¿ ããã倿Žããã«ããšãŒãžã§ã³ãã®ä¿¡é Œæ§ãšããã©ãŒãã³ã¹ãäºåã«åäžããããå Žåã
- ãã®èªåå質æ¹åããã»ã¹ã«æè³ããäºç®ïŒLLM ã¯ã¬ãžããïŒãšæéãããå Žåã
䜿çšäŸïŒãµãŒããŒåŽããã®åŒã³åºãïŒ
ããã¥ã¡ã³ãæ¹åããŒã«ã¯éåžžããµãŒããŒåŽã®ä¿å®ãŸãã¯ç®¡çã¿ã¹ã¯ãšããŠåŒã³åºãããå€éšãšãŒãžã§ã³ããåŒã³åºã MCP ããŒã«ãšããŠçŽæ¥å ¬éãããããšã¯ãããŸããã
# This code snippet shows how the refiner might be called from within the
# server's environment (e.g., via a CLI command or admin interface).
# Assume necessary imports and context setup:
# from ultimate_mcp_server.tools.docstring_refiner import refine_tool_documentation
# from ultimate_mcp_server.core import mcp_context # Represents the server's context
async def invoke_doc_refiner_task():
# Ensure mcp_context is properly initialized with registered tools, config, etc.
print("Starting Autonomous Documentation Refinement Task...")
# Example: Refine documentation for a specific list of tools
refinement_result = await refine_tool_documentation(
tool_names=["extract_json", "browser_navigate", "chunk_document"], # Tools to refine
max_iterations=3, # Limit refinement cycles per tool
refinement_model_config={ # Specify LLM for refinement tasks
"provider": "anthropic",
"model": "claude-3-5-sonnet-20241022"
},
testing_model_config={ # Optional: Specify LLM for test generation/simulation
"provider": "openai",
"model": "gpt-4o"
},
enable_winnowing=True, # Apply final streamlining pass
stop_on_first_error=False, # Continue refining other tools if one fails
ctx=mcp_context # Pass the server's MCP context
)
# Example: Refine all available tools (potentially very long running)
# refinement_result = await refine_tool_documentation(
# refine_all_available=True,
# max_iterations=2,
# ctx=mcp_context
# )
print("\nDocumentation Refinement Task Complete.")
# Process the results
if refinement_result["success"]:
print(f"Successfully processed {len(refinement_result.get('refined_tools', []))} tools.")
# The actual docstrings/schemas of the tools in mcp_context might be updated in-memory.
# Persisting these changes would require additional logic (e.g., writing back to source files).
print("Detailed report available in the result object.")
# print(refinement_result.get('report')) # Contains detailed logs and changes
else:
print(f"Refinement task encountered errors: {refinement_result.get('error', 'Unknown error')}")
# Check the report for details on which tools failed and why.
# To run this, it would need to be integrated into the server's startup sequence,
# a dedicated CLI command, or an administrative task runner.
# e.g., await invoke_doc_refiner_task()
â ãµã³ãã«ã©ã€ãã©ãªãšãã¹ããã¬ãŒã ã¯ãŒã¯
Ultimate MCP Server ã«ã¯ãexamples/ ãã£ã¬ã¯ããªã« 35 ä»¶ãè¶
ãããšã³ãããŒãšã³ãã®ãµã³ãã«ãçšæãããŠããŸãããããã¯æ¬¡ã® 2 ã€ã®ç®çãæãããŸãã
- çããããã¥ã¡ã³ãïŒã»ãŒãã¹ãŠã®ããŒã«ãšæ©èœã«ã€ããŠãå®çšçã§çŸå®çãªäœ¿çšãã¿ãŒã³ã瀺ããŸãã
- çµ±åãã¹ãã¹ã€ãŒãïŒãã¹ãŠã®ã³ã³ããŒãã³ããæ£ãã飿ºããããšã確èªãããå æ¬çãªãã¹ãã¹ã€ãŒããæ§æããŸãã
ãµã³ãã«ã®æ§æãšæŽç
- æ©èœå¥ïŒãµã³ãã«ã¯æ©èœããšã«åé¡ãããŠããŸãïŒäŸïŒ
model_integrationãtool_specificãworkflowsãadvanced_featuresïŒã - åäœã§å®è¡å¯èœïŒåãµã³ãã«ïŒ
*.pyïŒã¯ãmcp-clientã䜿ã£ãŠå®è¡äžã®ãµãŒããŒã€ã³ã¹ã¿ã³ã¹ãšããåããããå®è¡å¯èœãª Python ã¹ã¯ãªããã§ãã - ããããããåºåïŒ
Richã©ã€ãã©ãªã䜿ãããªã¯ãšã¹ããã¬ã¹ãã³ã¹ãã³ã¹ããæèŠæéãçµæãæç¢ºã«ç€ºããæžåŒèšå®ãšè²åããæœããã³ã³ãœãŒã«åºåãè¡ããŸãã - ãšã©ãŒåŠçïŒå ç¢ãªãã¢ãå®çŸããããããµã³ãã«ã«ã¯åºæ¬çãªãšã©ãŒãã§ãã¯ãå«ãŸããŠããŸãã
èŠãããåºå
次ã®ãããªãæ å ±ãå å®ããã³ã³ãœãŒã«åºåã確èªã§ããŸãã
- ð çµæãšçµ±èšããŸãšããããŒãã«ã
- ðš ã³ãŒããš JSON ã®ã·ã³ã¿ãã¯ã¹ãã€ã©ã€ãã
- â³ é²æã€ã³ãžã±ãŒã¿ãŒãŸãã¯è©³çްãªã¹ããããã°ã
- ðŒïž åºåã»ã¯ã·ã§ã³ãæŽçããããã«ã
åºåäŸïŒ
âââââââââââââââââââââââ Tournament Results ââââââââââââââââââââââââ®
â [1] claude-3-5-haiku-20241022: Score 8.7/10 â
â Cost: $0.00013 â
â ... â
â°âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ¯
ã«ã¹ã¿ãã€ãºãšåŠç¿
- ã«ã¹ã¿ãã€ãºå¯èœïŒ
.envçµç±ã§ API ããŒã䜿çšããããå¥ã®ã¢ãã«ãã«ã¹ã¿ã ããã³ãããå ¥åãã¡ã€ã«ã䜿çšãããããããããµã³ãã«ãç°¡åã«å€æŽã§ããŸãã - ã³ãã³ãã©ã€ã³åŒæ°ïŒå€ãã®ãµã³ãã«ã¯ã«ã¹ã¿ãã€ãºçšã®åŒæ°ãåãä»ããŸãïŒäŸïŒ
--modelã--input-fileã--headlessïŒã - åŠç¿ã«åœ¹ç«ã€å 容ïŒAI ã¢ããªã±ãŒã·ã§ã³ã®æ§æãããŒã«ã®éžæããã©ã¡ãŒã¿ãŒã®èª¿æŽããšã©ãŒåŠçãã³ã¹ãã®æé©åãçµ±åãã¿ãŒã³ã«é¢ãããã¹ããã©ã¯ãã£ã¹ãåŠã¹ãŸãã
å æ¬çãªãã¹ããã¬ãŒã ã¯ãŒã¯
run_all_demo_scripts_and_check_for_errors.py ã¹ã¯ãªããã¯ããã¹ãŠã®ãµã³ãã«ããã¹ãã¹ã€ãŒããšããŠå®è¡ããŸãã
- èªåå®è¡ïŒ
examples/*.pyãæ€åºããé çªã«å®è¡ããŸãã - æ€èšŒïŒçµäºã³ãŒããš
stderrãäºåå®çŸ©ããããã¿ãŒã³ãšç §åããå®éã®ãšã©ãŒãšæ³å®å ã®ã¡ãã»ãŒãžïŒäŸïŒAPI ããŒããªãããšã瀺ãèŠåïŒãåºå¥ããŸãã - ã¬ããŒãïŒæåã倱æãã¹ããããããã¹ãã®æŠèŠãšã詳现ãªãã°ãå«ããµããªãŒã¬ããŒããçæããŸãã
ãã¹ããã¬ãŒã ã¯ãŒã¯ã®èšå®äŸïŒ
"sql_database_interactions_demo.py": {
"expected_exit_code": 0,
"allowed_stderr_patterns": [
r"Could not compute statistics...", # Known non-fatal warning
r"Connection failed...", # Expected if DB not set up
r"Configuration not yet loaded..." # Standard info message
]
}
ãµã³ãã«ã¹ã€ãŒãã®å®è¡
# Ensure the Ultimate MCP Server is running in a separate terminal
# Run the entire test suite
python run_all_demo_scripts_and_check_for_errors.py
# Run a specific example script directly
python examples/browser_automation_demo.py --headless
# Run an example with custom arguments
python examples/text_redline_demo.py --input-file1 path/to/doc1.txt --input-file2 path/to/doc2.txt
ãã®ãµã³ãã«ã©ã€ãã©ãªãšãã¹ããã¬ãŒã ã¯ãŒã¯ã®çµã¿åããã¯ãUltimate MCP Server ã®æ©èœãçè§£ããæŽ»çšããæ€èšŒããããã®éåžžã«è²ŽéãªãªãœãŒã¹ã§ãã
ð» CLI ã³ãã³ã
Ultimate MCP Server ã«ã¯ããµãŒããŒç®¡çãšããŒã«ãšã®ããåãã«äœ¿çšã§ããã³ãã³ãã©ã€ã³ã€ã³ã¿ãŒãã§ã€ã¹ïŒumcpïŒãçšæãããŠããŸãã
# Show available commands and global options
umcp --help
# --- Server Management ---
# Start the server (loads .env, registers tools)
umcp run [--host HOST] [--port PORT] [--include-tools tool1 tool2] [--exclude-tools tool3 tool4]
# --- Information ---
# List configured LLM providers
umcp providers [--check] [--models]
# List available tools
umcp tools [--category CATEGORY] [--examples]
# --- Testing & Interaction ---
# Test connection and basic generation for a specific provider
umcp test <provider_name> [--model MODEL_NAME] [--prompt TEXT]
# Generate a completion directly from the CLI
umcp complete --provider <provider_name> --model <model_name> --prompt "Your prompt here" [--temperature N] [--max-tokens N] [--system TEXT] [--stream]
# --- Cache Management ---
# View or clear the request cache
umcp cache [--status] [--clear]
# --- Benchmark ---
umcp benchmark [--providers P1 P2] [--models M1 M2] [--prompt TEXT] [--runs N]
# --- Examples ---
umcp examples [--list] [<example_name>] [--category CATEGORY]
åã³ãã³ãã«ã¯éåžžã远å ã®ãªãã·ã§ã³ããããŸããç¹å®ã®ã³ãã³ãã®ãªãã·ã§ã³ã確èªããã«ã¯ãumcp COMMAND --help ã䜿çšããŸãïŒäŸïŒumcp complete --helpïŒã
ð ïž é«åºŠãªèšå®
èšå®ã¯äž»ã«ç°å¢å€æ°ã§ç®¡çãããå€ãã®å Žåãèµ·åæã«ãããžã§ã¯ãã«ãŒãã® .env ãã¡ã€ã«ããèªã¿èŸŒãŸããŸãã
ãµãŒããŒèšå®
SERVER_HOSTïŒïŒããã©ã«ãïŒ127.0.0.1ïŒãã€ã³ããããããã¯ãŒã¯ã€ã³ã¿ãŒãã§ãŒã¹ã§ãããã¹ãŠã®ã€ã³ã¿ãŒãã§ãŒã¹ã§åŸ ã¡åããã«ã¯ã0.0.0.0ã䜿çšããŸãïŒDocker ã³ã³ãããå€éšããã®ã¢ã¯ã»ã¹ã«å¿ èŠã§ãïŒãSERVER_PORTïŒïŒããã©ã«ãïŒ8013ïŒãµãŒããŒãåŸ ã¡åããããŒãã§ããAPI_PREFIXïŒïŒããã©ã«ãïŒ/ïŒãã¹ãŠã® API ãšã³ããã€ã³ãã® URL ãã¬ãã£ãã¯ã¹ã§ãïŒäŸïŒ/mcp/v1ã«èšå®ãããšããã®ãã¹é äžã§æäŸãããŸãïŒãWORKERSïŒïŒä»»æãäŸïŒ4ïŒWeb ãµãŒããŒïŒäŸïŒUvicornïŒã®ã¯ãŒã«ãŒããã»ã¹æ°ã§ããCPU ã³ã¢æ°ã«å¿ããŠèª¿æŽããŠãã ããã
ããŒã«ã®ãã£ã«ã¿ãªã³ã°ïŒèµ·åæã®å¶åŸ¡ïŒ
CLI ãã©ã°ã䜿çšããŠããµãŒããŒèµ·åæã«ç»é²ããããŒã«ãå¶åŸ¡ã§ããŸãã
--include-tools tool1,tool2,...ïŒæå®ããããŒã«ã®ã¿ãç»é²ããŸãã--exclude-tools tool3,tool4,...ïŒæå®ããããŒã«ãé€ããã¹ãŠã®ããŒã«ãç»é²ããŸãã
軜éãªã€ã³ã¹ã¿ã³ã¹ã®äœæãäŸåé¢ä¿ã®ç®¡çããšãŒãžã§ã³ãã®æ©èœå¶éã«åœ¹ç«ã¡ãŸãã# äŸïŒãã¡ã€ã«ã·ã¹ãã ãšåºæ¬çãªè£å®ããŒã«ã®ã¿ã§èµ·å umcp run --include-tools read_file,write_file,list_directory,completion # äŸïŒãã©ãŠã¶ãŒæäœä»¥å€ã®ãã¹ãŠã®ããŒã«ã§èµ·å umcp run --exclude-tools browser_init,browser_navigate,browser_click
ãã®ã³ã°èšå®
LOG_LEVELïŒïŒããã©ã«ãïŒINFOïŒãã°ã®è©³çŽ°åºŠïŒDEBUGãINFOãWARNINGãERRORãCRITICALïŒãå¶åŸ¡ããŸããDEBUGã¯éåžžã«è©³çްã§ããUSE_RICH_LOGGINGïŒïŒããã©ã«ãïŒtrueïŒRich ã©ã€ãã©ãªã䜿çšããŠãè²ä»ãã®æ§é åãããã³ã³ãœãŒã«ãã°ãæå¹ã«ããŸãããã¬ãŒã³ããã¹ãã®ãã°ã䜿çšããå ŽåïŒãã¡ã€ã«ãžã®ãªãã€ã¬ã¯ããäžéšã®ãã®ã³ã°ã·ã¹ãã ã§ã®äœ¿çšã«é©ããŠããŸãïŒã¯ãfalseã«èšå®ããŸããLOG_FORMATïŒïŒä»»æïŒã«ã¹ã¿ã ã®ãã°åœ¢åŒãæå®ãã PythonloggingæžåŒæååã§ãïŒUSE_RICH_LOGGING=falseã®å ŽåïŒãLOG_TO_FILEïŒïŒä»»æãäŸïŒ/var/log/ultimate_mcp_server.logïŒã³ã³ãœãŒã«ã«å ããŠãã°ãæžã蟌ããã¡ã€ã«ã®ãã¹ã§ãããµãŒããŒããã»ã¹ã«æžãèŸŒã¿æš©éãããããšã確èªããŠãã ããã
ãã£ãã·ã¥èšå®
CACHE_ENABLEDïŒïŒããã©ã«ãïŒtrueïŒå¿çãã£ãã·ã¥ãã°ããŒãã«ã«æå¹ãŸãã¯ç¡å¹ã«ããŸããCACHE_TTLïŒïŒããã©ã«ãïŒ86400ç§ïŒ24 æéïŒãã£ãã·ã¥é ç®ã®ããã©ã«ãã®æå¹æéã§ããããŒã«ã«ãã£ãŠã¯åå¥ã«äžæžããããå ŽåããããŸããCACHE_TYPEïŒïŒããã©ã«ãïŒmemoryïŒããã¯ãšã³ãã¹ãã¬ãŒãžã§ãã察å¿ããçš®é¡ïŒäŸïŒmemoryãredisãdiskcacheïŒã«ã€ããŠã¯ãå®è£ ã確èªããŠãã ãããdiskcacheã¯æ°žç¶åã«å¯Ÿå¿ããŠããŸããCACHE_DIRïŒïŒããã©ã«ãïŒ./.cacheïŒCACHE_TYPE=diskcacheã®å Žåã«äœ¿çšãããã£ã¬ã¯ããªã§ããæžãèŸŒã¿æš©éãããããšã確èªããŠãã ãããCACHE_MAX_SIZEïŒïŒä»»æãäŸïŒdiskcacheã®é ç®æ°ã®å Žåã¯1000ã512MB ã®å Žåã¯536870912ïŒãã£ãã·ã¥ã®ãµã€ãºå¶éãèšå®ããŸããREDIS_URLïŒïŒCACHE_TYPE=redisã®å Žåã¯å¿ é ïŒRedis ãµãŒããŒãžã®æ¥ç¶ URL ã§ãïŒäŸïŒredis://localhost:6379/0ïŒã
ãããã€ããŒã®ã¿ã€ã ã¢ãŠããšå詊è¡
PROVIDER_TIMEOUTïŒïŒããã©ã«ãïŒ120ïŒLLM ãããã€ã㌠API ããã®å¿çãåŸ ã€éã®ããã©ã«ãã®ã¿ã€ã ã¢ãŠãæéïŒç§ïŒã§ããPROVIDER_MAX_RETRIESïŒïŒããã©ã«ãïŒ3ïŒãããã€ããŒãžã®ãªã¯ãšã¹ãã倱æããå Žåã®ããã©ã«ãã®å詊è¡åæ°ã§ãïŒã¬ãŒãå¶éãäžæçãªãµãŒããŒã®åé¡ãªã©ãå詊è¡å¯èœãªãšã©ãŒã察象ã§ãïŒãææ°ããã¯ãªãã䜿çšããŸãã- å°çšã®å€æ°ïŒäŸïŒ
OPENAI_TIMEOUTãANTHROPIC_MAX_RETRIESïŒã§ããããã€ããŒããšã«åå¥ã®èšå®ãäžæžãã§ããå ŽåããããŸããèšå®ã®èªã¿èŸŒã¿åŠçãŸãã¯ããã¥ã¡ã³ãã確èªããŠãã ããã
ããŒã«åºæã®èšå®
åã ã®ããŒã«ã¯ãç°å¢å€æ°ããç¬èªã®èšå®ãèªã¿èŸŒãå ŽåããããŸããäŸïŒ
ALLOWED_DIRSïŒãã¡ã€ã«ã·ã¹ãã ããŒã«ãã¢ã¯ã»ã¹ãèš±å¯ãããããŒã¹ãã£ã¬ã¯ããªã®ã«ã³ãåºåããªã¹ãã§ããã»ãã¥ãªãã£äžãç¹ã«éèŠã§ããPLAYWRIGHT_BROWSER_TYPEïŒïŒããã©ã«ãïŒchromiumïŒPlaywright ããŒã«ã䜿çšãããã©ãŠã¶ãŒã§ãïŒchromiumãfirefoxãwebkitïŒãPLAYWRIGHT_TIMEOUTïŒPlaywright ã®æäœã«å¯Ÿããããã©ã«ãã®ã¿ã€ã ã¢ãŠãã§ããDATABASE_URLïŒSQL ããŒã¿ããŒã¹é£æºããŒã«çšã®æ¥ç¶æååã§ãïŒSQLAlchemy ã䜿çšïŒãMARQO_URLïŒçµ±åæ€çŽ¢ããŒã«ã䜿çšãã Marqo ã€ã³ã¹ã¿ã³ã¹ã® URL ã§ããTESSERACT_CMDïŒTesseract ã®å®è¡ãã¡ã€ã«ãã·ã¹ãã ã®æšæº PATH ã«ãªãå Žåã®ãã¹ã§ãïŒOCR çšïŒã
ãµãŒããŒãèµ·åããåã«ãç°å¢å€æ°ãæ£ããèšå®ãããŠããããšãå¿ ã確èªããŠãã ããã倿Žãåæ ããã«ã¯ãéåžžãµãŒããŒã®åèµ·åãå¿ èŠã§ãã
âïž ãããã€ã«é¢ããèæ ®äºé
éçºã«ã¯ umcp run ã docker compose up ã§ååã§ãããããå
ç¢ãªãããã€ã§ã¯æ¬¡ã®æ¹æ³ãæ€èšããŠãã ããã
1. ããã¯ã°ã©ãŠã³ããµãŒãã¹ãšããŠå®è¡ãã
ãµãŒããŒãç¶ç¶ããŠçšŒåããèªåçã«åèµ·åããããã«ããŠãã ããã
systemdïŒLinuxïŒïŒ ãµãŒãã¹ãŠããããã¡ã€ã«ïŒ.serviceïŒãäœæããsystemctl start|stop|restart|statusã§ããã»ã¹ã管çããŸããå ç¢ãªå¶åŸ¡æ©èœãšãã°é£æºãæäŸããŸããsupervisorïŒ Python ã§èšè¿°ãããããã»ã¹å¶åŸ¡ã·ã¹ãã ã§ããsupervisordãèšå®ããŠããµãŒããŒããã»ã¹ãç£èŠããã³ç®¡çããŸãã- Docker ã®åèµ·åããªã·ãŒïŒ
docker runã³ãã³ããŸãã¯docker-compose.ymlã§--restart unless-stoppedãŸãã¯--restart alwaysã䜿çšããDocker ãåèµ·åã管çããããã«ããŸãã
2. ãªããŒã¹ãããã·ã䜿çšããïŒNginxãCaddyãApacheãTraefikïŒ
Ultimate MCP Server ã®å段ã«ãªããŒã¹ãããã·ãé 眮ããããšãåŒ·ãæšå¥šããŸãïŒ
- ð HTTPS/SSL çµç«¯ïŒ SSL èšŒææžïŒäŸïŒCaddyïŒCertbot ã䜿çšãã Let's EncryptïŒãåŠçããå€éšãã©ãã£ãã¯ãæå·åããŸãã
- âïž ããŒããã©ã³ã·ã³ã°ïŒ é«å¯çšæ§ãã¹ã±ãŒãªã³ã°ã®ããã«è€æ°ã®ãµãŒããŒã€ã³ã¹ã¿ã³ã¹ãå®è¡ããŠããå Žåããã©ãã£ãã¯ã忣ããŸãã
- ðºïž ãã¹ã«ãŒãã£ã³ã°ïŒ ããããããå€éš URLïŒäŸïŒ
https://api.yourdomain.com/mcp/ïŒãå éšãµãŒããŒïŒhttp://localhost:8013ïŒã«ãããã³ã°ããŸããå¿ èŠã«å¿ããŠAPI_PREFIXãèšå®ããŸãã - ð¡ïž ã»ãã¥ãªãã£ããããŒïŒ
Strict-Transport-SecurityïŒHSTSïŒãContent-Security-PolicyïŒCSPïŒãªã©ã®éèŠãªããããŒã远å ããŸãã - ðŠ ã¢ã¯ã»ã¹å¶åŸ¡ïŒ IP èš±å¯ãªã¹ããåºæ¬èªèšŒãå®è£ ããããOAuth2 ãããã·ãšé£æºããŸãã
- â³ ãããã¡ãªã³ã°ïŒãã£ãã·ã¥ïŒ ãªã¯ãšã¹ãïŒã¬ã¹ãã³ã¹ã®ãããã¡ãªã³ã°ããã£ãã·ã¥å±€ã远å ã§æäŸããå ŽåããããŸãã
- â±ïž ã¿ã€ã ã¢ãŠãïŒ ã¢ããªã±ãŒã·ã§ã³ãµãŒããŒãšã¯ç¬ç«ããŠãæ¥ç¶ã¿ã€ã ã¢ãŠãã管çããŸãã
Nginx ã® location ãããã¯ã®äŸïŒç°¡ç¥çïŒïŒ
location /mcp/ { # Match your desired public path (corresponds to API_PREFIX if set)
proxy_pass http://127.0.0.1:8013/; # Point to the internal server (note trailing /)
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Increase timeouts for potentially long-running AI tasks
proxy_connect_timeout 60s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
# Optional: Add basic authentication
# auth_basic "Restricted Access";
# auth_basic_user_file /etc/nginx/.htpasswd;
}
3. ã³ã³ãããªãŒã±ã¹ãã¬ãŒã·ã§ã³ïŒKubernetesãDocker SwarmïŒ
ã¹ã±ãŒã©ãã«ã§ç®¡çããããããã€ã«ã¯ãæ¬¡ã®æ¹æ³ãæ€èšããŠãã ããïŒ
- â€ïž ãã«ã¹ãã§ãã¯ïŒ ãããã€ã¡ã³ããããã§ã¹ãã§ããµãŒããŒã®
/healthzãšã³ããã€ã³ãïŒãŸãã¯åçã®ãã®ïŒã䜿çšããã©ã€ããã¹ãããŒããšã¬ãã£ãã¹ãããŒããå®è£ ããŠèšå®ããŸãã - ð èšå®ïŒ ç°å¢å€æ°ã API ããŒã¯ãã€ã¡ãŒãžã«çµã¿èŸŒãã ã
.envãã¡ã€ã«ã ãã«äŸåããããããConfigMaps ãš SecretsïŒKubernetesïŒãŸã㯠Docker SecretsïŒConfigs ã䜿çšããŠå®å šã«ç®¡çããŸãã - âïž ãªãœãŒã¹å¶éïŒ å®å®ããããã©ãŒãã³ã¹ã確ä¿ããããŒãäžã®ãªãœãŒã¹äžè¶³ãé¿ãããããã³ã³ããã«é©å㪠CPU ãšã¡ã¢ãªã®ãªã¯ãšã¹ãïŒå¶éãå®çŸ©ããŸãã
- ð ãµãŒãã¹ãã£ã¹ã«ããªãŒïŒ IP ã¢ãã¬ã¹ããã¹ãåãããŒãã³ãŒããã代ããã«ããªãŒã±ã¹ãã¬ãŒã¿ãŒã«çµã¿èŸŒãŸãããµãŒãã¹ãã£ã¹ã«ããªãŒãå©çšããŸãããµãŒãã¹ãå éšåãã«å ¬éãïŒäŸïŒClusterIPïŒãå€éšããã®ã¢ã¯ã»ã¹ã«ã¯ Ingress ã³ã³ãããŒã©ãŒã䜿çšããŸãã
- ðŸ æ°žç¶ã¹ãã¬ãŒãžïŒ æ°žç¶æ§ãå¿
èŠãªæ©èœïŒäŸïŒ
diskcacheãæ°žç¶ã¡ã¢ãªããã¡ã€ã«ã¹ãã¬ãŒãžïŒã䜿çšããå Žåã¯ãæ°žç¶ããªã¥ãŒã ïŒPVs/PVCsïŒãèšå®ããŸãã
4. ãªãœãŒã¹ã®å²ãåœãŠ
- RAMïŒ ç¹ã«å€§èŠæš¡ãªã¢ãã«ã®äœ¿çšãã¡ã¢ãªå ãã£ãã·ã¥ããµã€ãºã®å€§ããããã¥ã¡ã³ãã®åŠçããŸãã¯ã¡ã¢ãªã倧éã«æ¶è²»ããããŒã«ïŒãã©ãŠã¶ãŒèªååãç¹å®ã®ããŒã¿åŠçã¿ã¹ã¯ãªã©ïŒã®å®è¡æã«ã¯ãååãªã¡ã¢ãªã確ä¿ããŠãã ããã䜿çšéãç£èŠããŠãã ããã
- CPUïŒ CPU è² è·ãç£èŠããŠãã ãããLLM ã®æšè«èªäœã¯ CPU ã«è² è·ãéäžããªãå ŽåããããŸãïŒå€ãã®å ŽåãGPUïŒTPU ã䜿çšããŸãïŒããã»ãã®ããŒã«ïŒOCRãããŒã«ã«åŠçããªã¯ãšã¹ããåŠçãããŠã§ããµãŒããŒãªã©ïŒã¯ CPU ã«è² è·ããããããšããããŸããã¯ãŒã«ãŒæ°ïŒ
WORKERSç°å¢å€æ°ïŒãæ€èšããŠãã ããã - ãã£ã¹ã¯ I/OïŒ æ°žç¶ãã£ãã·ã¥ïŒ
diskcacheïŒãå€§èŠæš¡ãªãã¡ã€ã«ã·ã¹ãã æäœãå©çšããå Žåãããã«ããã¯ã«ãªãããšããããŸããå¿ èŠã«å¿ããŠé«éãªã¹ãã¬ãŒãžïŒSSDïŒã䜿çšããŠãã ããã - ãããã¯ãŒã¯ïŒ ç¹ã«ãµã€ãºã®å€§ããããã¥ã¡ã³ããç»åãæ±ãå ŽåããŸãã¯å€§å®¹éã® API å¿çãé »ç¹ã«åŠçããå Žåã¯ãååãªåž¯åå¹ ã確ä¿ããŠãã ããã
ðž å§ä»»ã«ããã³ã¹ãåæž
Ultimate MCP Server ã䜿çšããŠã€ã³ããªãžã§ã³ããªå§ä»»ãè¡ããšããã¹ãŠã®ã¿ã¹ã¯ã« Claude 3.7 Sonnet ã GPT-4o ã®ãããªé«æ§èœã¢ãã«ã ãã䜿çšããå Žåãšæ¯ã¹ãŠãå€§å¹ ãªã³ã¹ãåæžãæåŸ ã§ããŸãã
| ã¿ã¹ã¯ã®ã·ããªãª | 髿§èœã¢ãã«ã®ã¿ïŒæŠç®ïŒ | MCP Server çµç±ã§å§ä»»ïŒæŠç®ïŒ | æšå®åæžç | åè |
|---|---|---|---|---|
| 100 ããŒãžã®ããã¥ã¡ã³ããèŠçŽ | ~$4.50 - $6.00 | ~$0.45 - $0.70 (Gemini Flash) | ~90% | åå²ïŒäœã³ã¹ãã®èŠçŽã䞊åå®è¡ |
| 50 ä»¶ã®ã¬ã³ãŒãããããŒã¿ãæœåº | ~$2.25 - $3.00 | ~$0.35 - $0.50 (GPT-4.1 Mini) | ~84% | ã³ã¹ãå¹çã®é«ãã¢ãã«ã«ãããããåŠç |
| ã³ã³ãã³ãã®ã¢ã€ãã¢ã 20 ä»¶çæ | ~$0.90 - $1.20 | ~$0.12 - $0.20 (DeepSeek/Haiku) | ~87% | äœã³ã¹ãã¢ãã«ã«ããã·ã³ãã«ãªçæã¿ã¹ã¯ |
| 顧客ããã®åãåããã 1,000 ä»¶åŠç | ~$45.00 - $60.00 | ~$7.50 - $12.00 (Mixed Models) | ~83% | åãåããã®è€éãã«å¿ããã«ãŒãã£ã³ã° |
| 10 ä»¶ã®ã¹ãã£ã³ç»åã OCR åŠçããŠæœåº | ~$1.50 - $2.50 (If LLM OCR) | ~$0.20 - $0.40 (OCR + LLM Fix) | ~85% | å°çš OCRïŒäœã³ã¹ã LLM ã«ããä¿®æ£ |
| åºæ¬çãªãŠã§ãã¹ã¯ã¬ã€ãã³ã°ãšèŠçŽ | ~$0.50 - $1.00 | ~$0.10 - $0.20 (Browser + Haiku) | ~80% | ãã©ãŠã¶ãŒããŒã«ïŒäœã³ã¹ã LLM ã«ããèŠçŽ |
(ã³ã¹ãã¯ãããŸã§åèå€ã§ãããäžè¬çãªããŒã¯ã³æ°ãš 2024 å¹Žã®æŠç®äŸ¡æ Œã«åºã¥ããŠããŸããå®éã®ã³ã¹ãã¯ãããã¥ã¡ã³ãã®ãµã€ãºãè€éãã䜿çšããã¢ãã«ãåãããã€ããŒã®çŸåšã®æéã«å€§ããå·Šå³ãããŸãã)
ã³ã¹ãåæžã®æ¹æ³ïŒ
- ã¿ã¹ã¯ã«åã£ãã¢ãã«ã®éžæïŒ æ·±ãæšè«ãåµé æ§ããŸãã¯è€éãªæç€ºãžã®å¯Ÿå¿ãå¿ èŠãªã¿ã¹ã¯ã«éããé«äŸ¡ãªã¢ãã«ã䜿çšããŸãã
- äœã³ã¹ãã¢ãã«ã®æŽ»çšïŒ èŠçŽãæœåºãã·ã³ãã«ãª Q&AãæžåŒèšå®ãªã©ããGemini FlashãClaude HaikuãGPT-4.1 MiniãDeepSeek Chat ã®ãããªå€§å¹ ã«äœã³ã¹ããªã¢ãã«ã«å§ä»»ããŸãã
- å°çšããŒã«ã®å©çšïŒ é©åãªå Žåã¯ãLLM 以å€ã®ããŒã«ïŒãã¡ã€ã«ã·ã¹ãã ãOCRããã©ãŠã¶ãŒãCLI ãŠãŒãã£ãªãã£ãããŒã¿ããŒã¹ïŒã䜿çšãããããã®æäœã§ã¯ LLM API ã®åŒã³åºããå®å šã«é¿ããŸãã
- ãã£ãã·ã¥ïŒ åäžãŸãã¯æå³çã«é¡äŒŒãããªã¯ãšã¹ãã«å¯Ÿããéè€ãã API åŒã³åºããæžãããŸãã
Ultimate MCP Server ã¯ã€ã³ããªãžã§ã³ããªã«ãŒãã£ã³ã°ã¬ã€ã€ãŒãšããŠæ©èœããé«åºŠãªãšãŒãžã§ã³ãã¢ãŒããã¯ãã£å ã§ããããã³ã¹ãæé©åãå®çŸããŸãã
ð§ AI éã®å§ä»»ãéèŠãªçç±
Ultimate MCP Server ã®ãããªã·ã¹ãã ã«ãã£ãŠå®çŸããã AI éã®å§ä»»ã¯ãåçŽãªã³ã¹ãåæžã«ãšã©ãŸããªãæŠç¥çãªéèŠæ§ãæã¡ãŸãã
é«åºŠãª AI æ©èœã®æ°äž»å
- Claude 3.7 ã GPT-4o ã®ãããªæå ç«¯ã®æšè«ã¢ãã«ã«æ¥åžžçãªäœæ¥ãä»»ããããšã§ããã®èœåãããå¹ åºãçšéã§å®éã«å©çšã§ããããã«ããŸãã
- äºç®ã«å¶çŽã®ããçµç¹ã§ããå šäœã®ã³ã¹ãã广çã«ç®¡çããªãããéèŠãªæšè«ã®æ®µéã§æé«æ°Žæºã® AI æ©èœã掻çšã§ããããã«ããŸãã
- æ¥çå šäœã§ AI ãªãœãŒã¹ãããå¹ççãã€åºç¯ã«æŽ»çšã§ããããã«ããŸãã
çµæžçãªãªãœãŒã¹æé©å
- AI ã®å©çšã«ãããåºæ¬çãªçµæžçæé©åãå®çŸããŸããæãé«äŸ¡ãªãªãœãŒã¹ïŒæäžäœã¯ã©ã¹ã® LLM æšè«ïŒã¯ããã®ç¬èªã®äŸ¡å€ãå¿ èŠãªå Žé¢ã«éã£ãŠé©çšããŸãã
- è€éãªæšè«ãåµé æ§ã埮åŠãªãã¥ã¢ã³ã¹ã®çè§£ããªãŒã±ã¹ãã¬ãŒã·ã§ã³ã¯ã髿§èœã¢ãã«ã«ä»»ããŸãã
- å®åçãªããŒã¿åŠçãæœåºããã©ãŒããã倿ãããåçŽãªè³ªçå¿çã¯ãè²»çšå¯Ÿå¹æã®é«ãã¢ãã«ã§åŠçããŸãã
- ç¹ååã®é LLM ã¿ã¹ã¯ïŒãŠã§ãã¹ã¯ã¬ã€ãã³ã°ããã¡ã€ã« I/OãDB ã¯ãšãªïŒã¯ãå°çšããŒã«ã§åŠçããäžèŠãª LLM åŒã³åºããåé¿ããŸãã
- ã·ã¹ãã å šäœãšããŠãæ··åã³ã¹ããå€§å¹ ã«æããªãããæäžäœã¯ã©ã¹ã«è¿ãæ§èœãšèœåã®å®çŸãç®æããŸãã
- ã€ã³ããªãžã§ã³ããªã«ãŒãã£ã³ã°ãšãã£ãã·ã¥ã«ãããäºæž¬ãé£ãã LLM API ã³ã¹ããããã管çããããæ¯åºãžãšå€ããŸãã
æç¶å¯èœãª AI ã¢ãŒããã¯ãã£
- ãã¹ãŠã®ã¿ã¹ã¯ã§æå€§èŠæš¡ã®ã¢ãã«ã䜿ãããšã«äŒŽãèšç®è² è·ã軜æžããããæç¶å¯èœãª AI ã®å©çšãä¿é²ããŸãã
- AI ãªãœãŒã¹ã®å²ãåœãŠã«ãèœåã«å¿ããéå±€åã®ã¢ãããŒããå°å ¥ããŸãã
- å€ãã®å埩ã§å®äŸ¡ãªã¢ãã«ãããŒã«ãå©çšã§ãããããããå€§èŠæš¡ãªå®éšãšéçºãå¯èœã«ãªããŸãã
- ã³ã¹ããå¶åŸ¡äžèœãªã»ã©èšããããšãªããããžãã¹ã®ããŒãºã«åãããŠæ¡åŒµã§ãã AI çµ±åã®ã¢ãããŒããæäŸããŸãã
æè¡çãªé²åã®éç
- åäžã¢ãã«ãžã®ã¢ããªã·ãã¯ãªåŒã³åºãããã忣åã®ãã«ããšãŒãžã§ã³ãããã«ãã¢ãã«ã®ã¯ãŒã¯ãããŒãžãšç§»è¡ãããAI ã¢ããªã±ãŒã·ã§ã³ã¢ãŒããã¯ãã£ã®éèŠãªé²åã瀺ããŸãã
- 倿§ãªããŒã«ãã¢ãã«ãçµã¿åãããè€éãªåŠçãã€ãã©ã€ã³ã®ãé«åºŠã§ AI é§ååã®ãªãŒã±ã¹ãã¬ãŒã·ã§ã³ãå¯èœã«ããŸãã
- AI ã·ã¹ãã ãèªèº«ã®ãªãœãŒã¹äœ¿çšã«ã€ããŠæšè«ããåçã«æé©åã§ããå¯èœæ§ãæã€ãã·ã¹ãã ã®åºç€ãç¯ããŸãã
- ã³ã³ããã¹ããã³ã¹ããæ±ããããå質ã«åºã¥ããŠã€ã³ããªãžã§ã³ããªå§ä»»ã倿ã§ãããããèªåŸçã§èªå·±æé©åãã AI ã·ã¹ãã ã®å®çŸã«ã€ãªããŸãã
AI å¹çåã®æªæ¥
- Ultimate MCP Server ã¯ãAI ã·ã¹ãã ãèªãã®éçšã³ã¹ããšãªãœãŒã¹äœ¿çšãç©æ¥µçã«ç®¡çãæé©åããæªæ¥ã瀺ããŠããŸãã
- 髿§èœã¢ãã«ã¯ãç¹ååããŒã«ãè²»çšå¯Ÿå¹æã®é«ããã¯ãŒã«ãŒãã¢ãã«ã®ãšã³ã·ã¹ãã ãæ¯ãããã€ã³ããªãžã§ã³ããªãªãŒã±ã¹ãã¬ãŒã¿ãŒãã€ãŸãããããŒãžã£ãŒããšããŠæ©èœããŸãã
- AI ã¯ãŒã¯ãããŒã¯ãŸããŸãé«åºŠåããèªå·±çµç¹åãã¬ãžãªãšã³ã¹ãåããå¯èœæ§ããããŸãã
- çµç¹ã¯ãåºæ¬çãªåŠçããé«åºŠãªæšè«ãŸã§ãAI ã®èœåå šäœãã財åçã«å®è¡å¯èœãã€æ¡åŒµæ§ã®ããæ¹æ³ã§æŽ»çšã§ããŸãã
å¹ççã§ãã€ã³ããªãžã§ã³ããªå§ä»»ãè¡ããèªå·±æé©åãã AI ã·ã¹ãã ãšãããã®æ§æ³ã¯ãå®çšç㪠AI å°å ¥ã«ãããæ¬¡ã®ããã³ãã£ã¢ã瀺ããŠããŸããã»ãŒãã¹ãŠã®çšéã§åäžã®åŒ·åïŒãã€é«äŸ¡ïŒãªã¢ãã«ã䜿ãããšãå€ãçŸåšã®ãã©ãã€ã ãè¶ ãããã®ã§ãã
ð§± ã¢ãŒããã¯ãã£
MCP çµ±åã®ä»çµã¿
Ultimate MCP Server ã¯ãModel Context ProtocolïŒMCPïŒããã€ãã£ãã«å®è£ ããŠããŸãã
- MCP ãµãŒããŒã®ã³ã¢ïŒMCP 仿§ã«æºæ ããåä¿¡ HTTP ãªã¯ãšã¹ãïŒéåžžã¯ç¹å®ã®ãšã³ããã€ã³ããžã® POST ãªã¯ãšã¹ãïŒãåŸ ã¡åãã Web ãµãŒããŒïŒFastAPI ãªã©ã䜿çšïŒãå®è£ ããŸãã
- ããŒã«ã®ç»é²ïŒèµ·åæã«ããµãŒããŒã¯å©çšå¯èœãªãã¹ãŠã®ããŒã«å®è£ ãæ€åºããŠç»é²ããŸããåããŒã«ã¯ãååã説æãå ¥åºåã¹ããŒãïŒå€ãã®å ŽåãPydantic ã¢ãã«ã JSON Schema ã«å€æãããã®ïŒãªã©ã®ã¡ã¿ããŒã¿ãæäŸããŸãããã®ã¬ãžã¹ããªã«ããããµãŒããŒïŒããã³å Žåã«ãã£ãŠã¯ãšãŒãžã§ã³ãïŒã¯ãã©ã®ããŒã«ãå©çšã§ãããããŸããã®äœ¿ãæ¹ãææ¡ã§ããŸãã
- ããŒã«ã®åŒã³åºãïŒMCP ã¯ã©ã€ã¢ã³ãïŒClaude ãå¥ã®ã¢ããªã±ãŒã·ã§ã³ãªã©ïŒããããŒã«åãšãã©ã¡ãŒã¿ãŒãæå®ããæå¹ãª MCP ãªã¯ãšã¹ããéä¿¡ãããšããµãŒããŒã®ã³ã¢ããªã¯ãšã¹ããé©åãªç»é²æžã¿ããŒã«ã®å®è¡ããžãã¯ã«æ¯ãåããŸãã
- ã³ã³ããã¹ãã®åãæž¡ããšå®è¡ïŒããŒã«ã¯æ€èšŒæžã¿ã®å ¥åãã©ã¡ãŒã¿ãŒãåãåããŸããããŒã«ã¯ã¢ã¯ã·ã§ã³ïŒLLM ã®åŒã³åºããPlaywright ãšã®é£æºãDB ãžã®ã¯ãšãªããã¡ã€ã«ã®æäœãªã©ïŒãå®è¡ããŸãã
- æ§é åãããã¬ã¹ãã³ã¹ïŒããŒã«ã®å®è¡çµæïŒãŸãã¯ãšã©ãŒïŒã¯ãæšæºç㪠MCP ã¬ã¹ãã³ã¹åœ¢åŒã«ãŸãšããããŸããéåžžããã®åœ¢åŒã«ã¯ã¹ããŒã¿ã¹ïŒæåïŒå€±æïŒãåºåããŒã¿ïŒããŒã«ã®åºåã¹ããŒãã«æºæ ïŒãã³ã¹ãæ å ±ããã®ä»ã®ã¡ã¿ããŒã¿ãå«ãŸããŸãã
- ã¯ã©ã€ã¢ã³ããžã®è¿åŽïŒMCP ãµãŒããŒã®ã³ã¢ã¯ãæ§é åããã MCP ã¬ã¹ãã³ã¹ã HTTP çµç±ã§ãªã¯ãšã¹ãå ã®ã¯ã©ã€ã¢ã³ãã«è¿ããŸãã
MCP æšæºã«æºæ ããããšã§ãMCP 察å¿ã®ãããããšãŒãžã§ã³ããã¯ã©ã€ã¢ã³ãã¢ããªã±ãŒã·ã§ã³ãšãã·ãŒã ã¬ã¹ãã€äºæž¬å¯èœã«çµ±åã§ããŸãã
ã³ã³ããŒãã³ãå³
+---------------------+ MCP Request +------------------------------------+ API Request +-----------------+
| MCP Agent/Client | ----------------------> | Ultimate MCP Server | ----------------------> | LLM Providers |
| (e.g., Claude 3.7) | <---------------------- | (FastAPI + MCP Core + Tool Logic) | <---------------------- | (OpenAI, Anthro.)|
+---------------------+ MCP Response +------------------+-----------------+ API Response +--------+--------+
| |
| Tool Invocation | External API Call
⌠âŒ
+-----------------------------------------------------------+------------------------------------------------------------+
| Internal Services & Tool Implementations |
| +-------------------+ +-------------------+ +-------------------+ +-------------------+ +-------------------+ |
| | Completion/LLM | | Document Proc. | | Data Extraction | | Browser Automation| | Excel Automation | |
| | (Routing/Provider)| | (Chunking, Sum.) | | (JSON, Table) | | (Playwright) | | (OpenPyXL/COM) | |
| +---------+---------+ +-------------------+ +-------------------+ +-------------------+ +-------------------+ |
| | |
| +---------+---------+ +-------------------+ +-------------------+ +-------------------+ +-------------------+ |
| | Cognitive Memory | | Filesystem Ops | | SQL Database | | Entity/Graph | | Vector/RAG | |
| | (Storage/Query) | | (Secure Access) | | (SQLAlchemy) | | (NetworkX) | | (Vector Stores) | |
| +-------------------+ +-------------------+ +-------------------+ +-------------------+ +---------+---------+ |
| | |
| +-------------------+ +-------------------+ +-------------------+ +-------------------+ +---------+---------+ |
| | Audio Transcription| | OCR Tools | | Text Classify | | CLI Tools | | Dynamic API | |
| | (Whisper, etc.) | | (Tesseract+LLM) | | | | (jq, rg, awk) | | (OpenAPI->Tool) | |
| +-------------------+ +-------------------+ +-------------------+ +-------------------+ +-------------------+ |
| |
| +-------------------+ +-------------------+ +-------------------+ +-------------------+ +-------------------+ |
| | Caching Service | | Analytics/Metrics | | Prompt Management | | Config Service | | Meta Tools/Refiner| |
| | (Memory/Disk/Redis| | (Cost/Usage Track)| | (Jinja2/Repo) | | (Loads .env) | | (list_tools etc.) | |
| +-------------------+ +-------------------+ +-------------------+ +-------------------+ +-------------------+ |
+------------------------------------------------------------------------------------------------------------------------+
å§è²ã®ãªã¯ãšã¹ããããŒïŒè©³çްïŒ
- ãšãŒãžã§ã³ãã®å€æïŒMCP ãšãŒãžã§ã³ãã¯ãå§è²ã«é©ããŠããå¯èœæ§ã®ããç¹å®ã®æ©èœïŒå€§ããªããã¹ãã®èŠçŽãJSON ã®æœåºãURL ã®é²èЧãªã©ïŒãå¿ èŠã ãšå€æããŸãã
- MCP ãªã¯ãšã¹ãã®äœæïŒãšãŒãžã§ã³ãã¯ãããŒã«ã®ã¹ããŒãïŒ
list_toolsã䜿ã£ãŠäºåã«ååŸããŠããå ŽåããããŸãïŒã«åŸã£ãŠtool_nameãšå¿ é ã®inputsãæå®ããMCP ããŒã«åŒã³åºããªã¯ãšã¹ããäœæããŸãã - ãµãŒããŒãžã® HTTP POSTïŒãšãŒãžã§ã³ãã¯ããã®ãªã¯ãšã¹ãïŒéåžžã¯æ¬æã« JSON ãšããŠæ ŒçŽïŒã HTTP POST ã§ Ultimate MCP Server ã®æå®ãšã³ããã€ã³ãã«éä¿¡ããŸãã
- ãªã¯ãšã¹ãã®åä¿¡ãšè§£æïŒãµãŒããŒã® Web ãã¬ãŒã ã¯ãŒã¯ïŒFastAPIïŒããªã¯ãšã¹ããåä¿¡ããŸããMCP Core 㯠JSON æ¬æãè§£æããäžè¬ç㪠MCP ãªã¯ãšã¹ãæ§é ã«ç §ãããŠæ€èšŒããŸãã
- ããŒã«ã®æ¯ãåãïŒMCP Core ã¯ãç»é²æžã¿ããŒã«ã®ã¬ãžã¹ããªããããªã¯ãšã¹ãããã
tool_nameãæ€çŽ¢ããŸãã - å
¥åã®æ€èšŒïŒãµãŒããŒã¯ããªã¯ãšã¹ãã§æå®ããã
inputsãã該åœããŒã«åºæã®å ¥åã¹ããŒãïŒPydantic ã¢ãã«ïŒã«ç §ãããŠæ€èšŒããŸããæ€èšŒã«å€±æããå Žåã¯ãçŽã¡ã« MCP ãšã©ãŒã¬ã¹ãã³ã¹ãçæãããŸãã - ããŒã«å®è¡ã³ã³ããã¹ãïŒèšå®ããå ±æãµãŒãã¹ïŒãã®ã³ã°ããã£ãã·ã¥ãåæãªã©ïŒãžã®ã¢ã¯ã»ã¹ãå«ãã³ã³ããã¹ããªããžã§ã¯ããäœæãããããšããããŸãã
- ãã£ãã·ã¥ã®ç¢ºèªïŒãã£ãã·ã¥ãµãŒãã¹ãåç
§ããŸãã
tool_nameãšæ€èšŒæžã¿ã®inputsã«åºã¥ããŠãã£ãã·ã¥ããŒãçæããŸãããã®ããŒã«å¯Ÿå¿ããæå¹æéå ã®ãã£ãã·ã¥ãšã³ããªãŒãååšããå Žåããã£ãã·ã¥ãããã¬ã¹ãã³ã¹ãååŸããŠè¿ããæé 14 ã«é²ã¿ãŸãã - ããŒã«ããžãã¯ã®å®è¡ïŒãã£ãã·ã¥ãããŠããªãå ŽåãããŒã«ã®äž»ãªå®è¡ããžãã¯ãåäœããŸãã
- LLM ã¿ã¹ã¯ïŒããŒã«ã LLM ã®åŒã³åºãã䌎ãå ŽåïŒ
completionãsummarize_documentãextract_jsonãªã©ïŒïŒ- æé©åïŒã«ãŒãã£ã³ã°ããžãã¯ãããã©ã¡ãŒã¿ãŒïŒ
providerãmodelãprovider_preferenceïŒãšãµãŒããŒèšå®ã«åºã¥ããŠãããã€ããŒïŒã¢ãã«ãéžæããŸãã - ããã³ãã管çãµãŒãã¹ãããã³ãã¬ãŒãã䜿ã£ãŠæçµçãªããã³ãããæŽããããšããããŸãã
- ãããã€ããŒæœè±¡åã¬ã€ã€ãŒããéžæãããããã€ããŒåãã® API ãªã¯ãšã¹ããäœæããŸãã
- API ãåŒã³åºãããå¿ èŠã«å¿ããŠå詊è¡ãã¿ã€ã ã¢ãŠããåŠçãããŸãã
- LLM ã®å¿çãåä¿¡ããè§£æããŸãã
- æé©åïŒã«ãŒãã£ã³ã°ããžãã¯ãããã©ã¡ãŒã¿ãŒïŒ
- å°çšããŒã«ã¿ã¹ã¯ïŒLLM ã䜿ããªãããŒã«ïŒ
read_fileãbrowser_navigateãrun_sql_queryãrun_ripgrepãªã©ïŒã®å ŽåïŒ- ããŒã«ã¯ãé¢é£ããã·ã¹ãã ïŒãã¡ã€ã«ã·ã¹ãã ãPlaywright ã®ãã©ãŠã¶ãŒã€ã³ã¹ã¿ã³ã¹ãããŒã¿ããŒã¹æ¥ç¶ããµãããã»ã¹ã®å®è¡ãªã©ïŒãšçŽæ¥ããåãããŸãã
- ã»ãã¥ãªãã£ãã§ãã¯ïŒèš±å¯ããããã£ã¬ã¯ããªãSQL ãµãã¿ã€ãºçšãã¬ãŒã¹ãã«ããŒãªã©ïŒãå®è¡ãããŸãã
- æäœã®çµæãååŸãããŸãã
- LLM ã¿ã¹ã¯ïŒããŒã«ã LLM ã®åŒã³åºãã䌎ãå ŽåïŒ
- ã³ã¹ãã®èšç®ïŒLLM ã¿ã¹ã¯ã§ã¯ãåæãµãŒãã¹ãå ¥åºåããŒã¯ã³æ°ãšãããã€ããŒã®æéã«åºã¥ããŠæšå®ã³ã¹ããèšç®ããŸãããã以å€ã®ã¿ã¹ã¯ã§ã¯ãç¹å®ã®èšé察象ãªãœãŒã¹ãæ¶è²»ããªãéããéåžžã³ã¹ãã¯ãŒãã§ãã
- çµæã®ãã©ãŒãããïŒããŒã«ã¯ãå®çŸ©æžã¿ã®åºåã¹ããŒãã«åŸã£ãŠãçµæïŒããŒã¿ãŸãã¯ãšã©ãŒã¡ãã»ãŒãžïŒããã©ãŒãããããŸãã
- åæããŒã¿ã®èšé²ïŒåæãµãŒãã¹ã¯ããªã¯ãšã¹ããã¬ã¹ãã³ã¹ïŒãŸãã¯ãšã©ãŒïŒãå®è¡æéãã³ã¹ãã䜿çšãããããã€ããŒïŒã¢ãã«ããã£ãã·ã¥ã®ç¶æ ïŒãããïŒãã¹ïŒãªã©ãèšé²ããŸãã
- ãã£ãã·ã¥ã®æŽæ°ïŒæäœãæåãããã®ããŒã«ïŒãªã¯ãšã¹ãã§ãã£ãã·ã¥ãæå¹ã«ãªã£ãŠããå Žåããã£ãã·ã¥ãµãŒãã¹ã¯èšç®ããã TTL ãèšå®ããŠããã©ãŒãããæžã¿ã®ã¬ã¹ãã³ã¹ãä¿åããŸãã
- MCP ã¬ã¹ãã³ã¹ã®äœæïŒMCP Core ã¯ãæçµçµæïŒãã£ãã·ã¥ããååŸãããã®ããŸãã¯å®è¡çµæïŒãæšæºã® MCP ã¬ã¹ãã³ã¹æ§é ã«æ ŒçŽããŸãããã®æ§é ã«ã¯
statusãoutputsãerrorïŒããå ŽåïŒãããã«costãusage_metadataãå«ãŸããããšããããŸãã - ãšãŒãžã§ã³ããžã® HTTP ã¬ã¹ãã³ã¹ïŒãµãŒããŒã¯ãMCP ã¬ã¹ãã³ã¹ã HTTP ã¬ã¹ãã³ã¹ãšããŠãšãŒãžã§ã³ãã«è¿ããŸãïŒéåžžã¯ãããŒã«ã®æäœã倱æããå Žåã§ãã¹ããŒã¿ã¹ã¯ 200 OK ã§ããMCP ãªã¯ãšã¹ãèªäœã¯æåããŠããããã§ãïŒããšãŒãžã§ã³ãã¯ãã®ã¬ã¹ãã³ã¹ãè§£æããããŒã«åŒã³åºãã®çµæã倿ããŸãã
ð å®éã®ãŠãŒã¹ã±ãŒã¹
é«åºŠãª AI ãšãŒãžã§ã³ãæ©èœ
Claude ã®ãããªãšãŒãžã§ã³ããç¬èªã«æ§ç¯ããèªåŸåãšãŒãžã§ã³ãã«ããŒã«ãæäŸããããšã§ãè€éãªãã«ãã¢ãŒãã«ã¿ã¹ã¯ãå®è¡ã§ããããã«ããŸãã
- æ°žç¶ã¡ã¢ãªãšåŠç¿ïŒ Cognitive Memory ã·ã¹ãã ã䜿çšããŠãé·æéã®äŒè©±ãã¿ã¹ã¯ãéããŠã³ã³ããã¹ããç¶æããŸãã
- ãŠã§ãæäœãšèª¿æ»ïŒ ãŠã§ãé²èЧããŠã§ããµã€ãããã®ããŒã¿æœåºããã©ãŒã éä¿¡ãèªååããè€æ°ã®ãªã³ã©ã€ã³ãœãŒã¹ããæ å ±ãçµ±åããŸãã
- ããŒã¿åæãšã¬ããŒãäœæïŒ Excel ã¹ãã¬ããã·ãŒãå ã®ããŒã¿ãäœæãæäœãåæããã°ã©ããã¬ããŒããçæããŸãã
- ããŒã¿ããŒã¹æäœïŒ ãšãŒãžã§ã³ãã®ç®æšã«åºã¥ããŠæ å ±ãååŸãŸãã¯æŽæ°ããããã«ãäŒæ¥ããŒã¿ããŒã¹ã«ã¢ã¯ã»ã¹ããŠã¯ãšãªãå®è¡ããŸãã
- ããã¥ã¡ã³ãçè§£ïŒ PDF ãç»åïŒOCRïŒãåŠçããéèŠãªæ å ±ãæœåºããé·ãã¬ããŒããèŠçŽããããã¥ã¡ã³ãã«åºã¥ã質åã«åçããŸãïŒRAGïŒã
- ãã¬ããžã°ã©ã管çïŒ ç¹å®ã®åéããããžã§ã¯ãããŸãã¯ãšã³ãã£ãã£ã«é¢ãã瀟å ãã¬ããžã°ã©ããæ§ç¯ããã¯ãšãªãå®è¡ããŸãã
- ãã«ãã¡ãã£ã¢åŠçïŒ äŒè°ã®é²é³ãé³å£°ã¡ã¢ãæåèµ·ããããŸãã
- ã³ãŒãå®è¡ãšåæïŒ éçºãããŒã¿ã¿ã¹ã¯ã« CLI ããŒã«ãŸãã¯å°çšã®ã³ãŒãããŒã«ïŒè¿œå ããå ŽåïŒã䜿çšããŸãã
- å€éšãµãŒãã¹é£æºïŒ OpenAPI çµç±ã§åçã«ç»é²ãããä»ç€Ÿã® API ããããªã㯠API ãšããåãããŸãã
ãšã³ã¿ãŒãã©ã€ãºã¯ãŒã¯ãããŒã®èªåå
AI æšè«ãšå°çšããŒã«ã掻çšãããé«åºŠãªèªåããã»ã¹ãæ§ç¯ããŸãã
- ã€ã³ããªãžã§ã³ããªããã¥ã¡ã³ãåŠçãã€ãã©ã€ã³ïŒ ã¹ãã£ã³ææžïŒPDF ãåã蟌㿠-> OCR -> æ§é åããŒã¿ïŒJSONïŒãæœåº -> ããŒã¿ãæ€èšŒ -> ããã¥ã¡ã³ãã®çš®é¡ãåé¡ -> é©åãªã·ã¹ãã ã«æ¯ãåãããã人ã«ãã確èªçšã«èŠçŽããŸãã
- èªå調æ»ã¢ã·ã¹ã¿ã³ãïŒ ãããã¯ãæå® -> åŠè¡ããŒã¿ããŒã¹ãæ€çŽ¢ïŒBrowser/API ããŒã«çµç±ïŒ -> é¢é£ããè«æãããŠã³ããŒãïŒBrowser/FilesystemïŒ -> è«æãåå²ããŠèŠçŽïŒããã¥ã¡ã³ãããŒã«ïŒ -> éèŠãªç¥èŠãæœåºïŒæœåºããŒã«ïŒ -> Cognitive Memory ã«ä¿å -> æ å ±ãçµ±åããã¬ããŒããçæããŸãã
- 財åã¬ããŒãã®èªååïŒ ããŒã¿ããŒã¹ã«æ¥ç¶ïŒSQL ããŒã«ïŒ -> 財åããŒã¿ãæœåº -> Excel ãã³ãã¬ãŒãã«å ¥åïŒExcel ããŒã«ïŒ -> ã°ã©ããšå·®ç°åæãçæ -> ã¬ããŒããã¡ãŒã«ã§éä¿¡ïŒã¡ãŒã«ããŒã«ã远å ããå ŽåïŒã
- ã«ã¹ã¿ããŒãµããŒããã±ããã®æ å ±æ¡å ïŒ ãã±ããã®ããã¹ããåä¿¡ -> åé¡ã®çš®é¡ãåé¡ïŒåé¡ããŒã«ïŒ -> 瀟å ãã¬ããžããŒã¹ãšããã¥ã¡ã³ããæ€çŽ¢ïŒRAG ããŒã«ïŒ -> è¿ä¿¡æ¡ãäœæ -> CRM ãã顧客æ å ±ã远å ïŒDB ãŸã㯠API ããŒã«çµç±ïŒã
- ç«¶åä»ç€Ÿã®ã¢ãã¿ãªã³ã°ïŒ ãã©ãŠã¶ãŒèªååã¿ã¹ã¯ãã¹ã±ãžã¥ãŒã« -> ç«¶åä»ç€Ÿã®ãŠã§ããµã€ãïŒãã¥ãŒã¹ãã£ãŒããé²èЧ -> éèŠãªçºè¡šãäŸ¡æ Œå€æŽãæœåº -> 調æ»çµæãèŠçŽ -> é¢é£ããŒã ã«éç¥ããŸãã
ããŒã¿åŠçãšé£æº
åçŽãª ETL ã«ãšã©ãŸããªãè€éãªããŒã¿ã¿ã¹ã¯ãåŠçããŸãã
- éæ§é åããŒã¿ããæ§é åããŒã¿ãžïŒ ã¡ãŒã«ãã¬ããŒãããã£ãããã°ã補åã¬ãã¥ãŒããç¹å®ã®æ å ±ïŒJSONãããŒãã«ïŒãæœåºããŸãã
- ãã¬ããžã°ã©ãã®äœæïŒ ããã¥ã¡ã³ãã³ãŒãã¹ïŒäŸïŒç€Ÿå Wikiãç ç©¶è«æïŒãåŠçããç¥èŠãæ€çŽ¢ããããã®ãšã³ãã£ãã£é¢ä¿ã°ã©ããæ§ç¯ããŸãã
- ããŒã¿å€æãšã¯ã¬ã³ãžã³ã°ïŒ LLM ã®æç€ºã«åºã¥ãè€éãªããŒã¿æäœã«ãSQL ããŒã«ãExcel ã®èªååããŸãã¯ããŒã«ã«ã®ããã¹ãåŠçïŒawkãsedïŒã䜿çšããŸãã
- ããŒã¿ã®èªååé¡ïŒ ããã¹ãåé¡ããŒã«ãå€§èŠæš¡ãªããŒã¿ã»ããïŒäŸïŒãŠãŒã¶ãŒãã£ãŒãããã¯ã®åé¡ããã¥ãŒã¹èšäºãžã®ã¿ã°ä»ãïŒã«é©çšããŸãã
- ã»ãã³ãã£ãã¯ããŒã¿æ€çŽ¢ïŒ ç€Ÿå ããã¥ã¡ã³ãã«å¯ŸããŠæ€çŽ¢å¯èœãªãã¯ãã«ã€ã³ããã¯ã¹ãæ§ç¯ãããŠãŒã¶ãŒããšãŒãžã§ã³ããããŒã¯ãŒãã ãã§ãªãæå³ã«åºã¥ããŠæ å ±ãæ€çŽ¢ã§ããããã«ããŸãïŒRAGïŒã
ç ç©¶ãšåæïŒç§åŠãããŒã±ãããªã©ïŒ
AI ãæŽ»çšããããŒã«ã§ç ç©¶ããŒã ãæ¯æŽããŸãã
- æç®ã®èªåæ€çŽ¢ãšã¬ãã¥ãŒïŒ ãã©ãŠã¶ãŒïŒAPI ããŒã«ã䜿çšããŠããŒã¿ããŒã¹ïŒPubMedãArXiv ãªã©ïŒãæ€çŽ¢ããè«æãããŠã³ããŒããåå²ãèŠçŽããŠãäž»èŠãªæ¹æ³è«ãçµæãæœåºããŸãã
- æ¯èŒåæïŒ è€æ°ãããã€ããŒã®è£å®ããŒã«ãããŒãã¡ã³ãããŒã«ã䜿çšããŠãç ç©¶ããŒã¿ã«åºã¥ã仮説ã®è§£éãçæã®æ¹æ³ãã¢ãã«éã§æ¯èŒããŸãã
- ç ç©¶ããã®ããŒã¿æœåºïŒ å ¬éè«æãã¬ããŒãããæ§é åããŒã¿ïŒåå è æ°ãp å€ãçµæïŒãèªåçã«æœåºããããŒã¿ããŒã¹ãã¹ãã¬ããã·ãŒãã«åã蟌ã¿ãŸãã
- äºç®ã®è¿œè·¡ïŒ åææ©èœã掻çšããŠãç ç©¶ã¿ã¹ã¯ã«äŒŽã LLM API ã®ã³ã¹ããç£èŠããŸãã
- ç ç©¶ãã°ã®ç¶ç¶çãªèšé²ïŒ Cognitive Memory ã·ã¹ãã ã䜿çšããŠãç ç©¶ãããžã§ã¯ãå šäœãéããŠç¥èŠã仮説ã芳å¯ãæšè«ã®æé ãä¿åããŸãã
ããã¥ã¡ã³ãã€ã³ããªãžã§ã³ã¹
ããã¥ã¡ã³ãã³ã¬ã¯ã·ã§ã³ãçè§£ããããã®å æ¬çãªã·ã¹ãã ãæ§ç¯ããŸãã
- ãšã³ãããŒãšã³ãã®ãã€ãã©ã€ã³ïŒ ã¹ãã£ã³ããããã¥ã¡ã³ãã OCR ã§åŠç -> LLM ã§ããã¹ãã匷å -> å®çŸ©æžã¿ã®ãã£ãŒã«ããæœåºïŒExtraction ããŒã«ïŒ -> ããã¥ã¡ã³ãã®çš®é¡ãåé¡ -> äž»èŠãªãšã³ãã£ãã£ïŒé¢ä¿ãç¹å® -> èŠçŽãçæ -> ããã¹ããšã¡ã¿ããŒã¿ãæ€çŽ¢å¯èœãªã·ã¹ãã ïŒVectorïŒSQL DBïŒã«ã€ã³ããã¯ã¹åããŸãã
財ååæãšã¢ããªã³ã°
é«åºŠãªããŒã«ã財åã®å°éå®¶ã«æäŸããŸãã
- AI ãæŽ»çšããã¢ãã«æ§ç¯ïŒ èªç¶èšèªã§ Excel èªååããŒã«ã«æç€ºããè€éãªè²¡åã¢ãã«ãäºæž¬ãè©äŸ¡åæãäœæããŸãã
- ããŒã¿çµ±åïŒ ãã©ãŠã¶ãŒèªååã API ãä»ããŠåžå ŽããŒã¿ãååŸããããŒã¿ããŒã¹ïŒSQL ããŒã«ïŒããã®ç€Ÿå ããŒã¿ãšçµã¿åãããŸãã
- ã¬ããŒãåæïŒ RAG ãŸãã¯èŠçŽããŒã«ã䜿çšããŠãé·ã財åã¬ããŒããé瀺æžé¡ã®å 容ããã°ããææ¡ããŸãã
- ã·ããªãªãã¹ãïŒ Excel ã¢ãã«ã®å ¥åå€ãããã°ã©ã ã§å€æŽããŠãæåºŠåæãå®è¡ããŸãã
- æææ±ºå®ã®èšé²ïŒ Cognitive Memory ã䜿çšããŠãæè³å€æãåæã®æ ¹æ ãèšé²ããŸãã
ð ã»ãã¥ãªãã£ã«é¢ããèæ ®äºé
Ultimate MCP Server ã®ãããã€ãšéçšã§ã¯ãã»ãã¥ãªãã£ãæåªå äºé ãšããå¿ èŠããããŸãã以äžã®ç¹ãèæ ®ããŠãã ããã
-
ð API ããŒã®ç®¡çïŒ
- ãœãŒã¹ã³ãŒãã« API ããŒãããŒãã³ãŒãããããããŒãžã§ã³ç®¡çã«ã³ããããããããªãã§ãã ããã
- ç°å¢å€æ°ïŒããŒã«ã«éçºã§ã¯
.envãã¡ã€ã«ãã·ã¹ãã ã®ç°å¢å€æ°ãæ¬çªç°å¢ã§ã¯ HashiCorp VaultãAWS Secrets ManagerãGCP Secret Manager ãªã©ã®ã·ãŒã¯ã¬ãã管çããŒã«ãæšå¥šïŒã䜿çšããŠãã ããã .envãã¡ã€ã«ãããŒã«ã«ã§äœ¿çšããå Žåã¯ã峿 Œãªãã¡ã€ã«æš©éïŒäŸïŒchmod 600 .envïŒãèšå®ãããµãŒããŒãå®è¡ãããŠãŒã¶ãŒã ããèªã¿åããããã«ããŠãã ããã- éçºç°å¢ãšæ¬çªç°å¢ã§ã¯ å¥ã ã®ã㌠ã䜿çšããŠãã ããã
- ããŒã®ããŒããŒã·ã§ã³ããªã·ãŒã宿œããæŒããã®çããããããŒã¯çŽã¡ã«ç¡å¹åããŠãã ããã
-
ð ãããã¯ãŒã¯ã®å ¬éãšã¢ã¯ã»ã¹å¶åŸ¡ïŒ
- ããŒã«ã«æ¥ç¶ã®ã¿ãèš±å¯ãããããããã©ã«ãã§ã¯
127.0.0.1ïŒSERVER_HOSTïŒã«ãã€ã³ãããŠãã ãããå ¬éããæå³ãããå Žåã«éã0.0.0.0ã«å€æŽããå¿ ãé©åãªãããã¯ãŒã¯å¶åŸ¡ã®èåŸã«é 眮ããŠãã ããã - ãªããŒã¹ãããã·ã䜿çšããŠãã ããïŒ ãµãŒããŒã®å段㫠NginxãCaddyãTraefik ãªã©ãé 眮ããããšãåŒ·ãæšå¥šããŸããSSL/TLS ã®çµç«¯åŠçãè¡ããã¢ã¯ã»ã¹å¶åŸ¡ïŒIP èš±å¯ãªã¹ããã¯ã©ã€ã¢ã³ãèšŒææžèªèšŒãBasic AuthãOAuth2 ãããã·é£æºïŒãé©çšã§ããã»ããåé¢ã¬ã€ã€ãŒãæäŸããŸãã
- ãã¡ã€ã¢ãŠã©ãŒã«ã«ãŒã«ïŒ ãã¹ãããŒã¹ãŸãã¯ãããã¯ãŒã¯ãã¡ã€ã¢ãŠã©ãŒã«ãèšå®ããä¿¡é Œã§ããéä¿¡å
ïŒãªããŒã¹ãããã·ã® IPãç¹å®ã®ã¢ããªã±ãŒã·ã§ã³ãµãŒããŒã® IPãVPN ã®ç¯å²ãªã©ïŒããã®ã¿
SERVER_PORTã«ã¢ã¯ã»ã¹ã§ããããã«å¶éããŠãã ããã
- ããŒã«ã«æ¥ç¶ã®ã¿ãèš±å¯ãããããããã©ã«ãã§ã¯
-
ð€ èªèšŒãšèªå¯ïŒ
- Ultimate MCP Server èªäœã«ã¯ããŠãŒã¶ãŒïŒãšãŒãžã§ã³ãèªèšŒæ©èœãçµã¿èŸŒãŸããŠããªãå ŽåããããŸããèªèšŒã¯éåžžããµãŒããŒããåæ®µã®ã¬ã€ã€ãŒïŒãªããŒã¹ãããã·ã API ã²ãŒããŠã§ã€ãªã©ïŒã§åŠçããŠãã ããã
- èªå¯ãããã¯ã©ã€ã¢ã³ãïŒä¿¡é Œã§ãã AI ãšãŒãžã§ã³ããç¹å®ã®ããã¯ãšã³ããµãŒãã¹ïŒã®ã¿ãããµãŒããŒãšã³ããã€ã³ãã«ãªã¯ãšã¹ããéä¿¡ã§ããããã«ããŠãã ãããå¿ èŠã«å¿ããŠãçžäº TLSïŒmTLSïŒãããããã·ïŒã²ãŒããŠã§ã€ã§ç®¡çãã API ããŒïŒããŒã¯ã³ã®äœ¿çšãæ€èšããŠãã ããã
- ããŒã«ã«ãã£ãŠã¢ã¯ã»ã¹ã¬ãã«ãç°ãªãå ŽåïŒèªã¿åãå°çšãšèªã¿æžãå¯èœãªãã¡ã€ã«ã·ã¹ãã ãªã©ïŒãèªå¯ããžãã¯ããµãŒããŒå ã§åŠçããå¿ èŠãããããå€éšã§ç®¡çããããæ€èšããŠãã ããã
-
ðŠ ã¬ãŒãå¶éãšäžæ£å©çšã®é²æ¢ïŒ
- ãªããŒã¹ãããã·ãŸã㯠API ã²ãŒããŠã§ã€ã®ã¬ãã«ã§ãéä¿¡å IPãAPI ããŒããã®ä»ã®è奿 å ±ã«åºã¥ãã¬ãŒãå¶éãå®è£ ããŠãã ãããããã«ããããµãŒãã¹æåŠïŒDoSïŒæ»æãé²ããéå°ãª API 䜿çšïŒLLM ããã³ããŒã«ã®äœ¿çšã«ãããè²»çšãå«ãïŒã®ã³ã¹ã管çã«ã圹ç«ã¡ãŸãã
- äžæ£å©çšã®å åããªããã䜿çšãã¿ãŒã³ãç£èŠããŠãã ããã
-
ð¡ïž å ¥åã®æ€èšŒãšãµãã¿ã€ãºïŒ
- MCP ã¯æ§é åããã圢åŒãæäŸããŸããããŠãŒã¶ãŒïŒãšãŒãžã§ã³ãã®å
¥åã«åºã¥ããŠå€éšã·ã¹ãã ãšé£æºããããŒã«ã«ã¯ãç¹ã«æ³šæããŠãã ããã
- ãã¡ã€ã«ã·ã¹ãã ããŒã«ïŒ æãéèŠãªã®ã¯ã
ALLOWED_DIRSãå³å¯ã«èšå®ããããšã§ãããã£ã¬ã¯ããªãã©ããŒãµã«ïŒ../ïŒãé²ãããããã¹ãŠã®ãã¹å ¥åã峿 Œã«æ€èšŒããæ£èŠåããŠãã ããããµãŒããŒããã»ã¹ã¯æå°æš©éã§å®è¡ããŠãã ããã - SQL ããŒã«ïŒ SQL ã€ã³ãžã§ã¯ã·ã§ã³ã®è匱æ§ãé²ãããããã©ã¡ãŒã¿ãŒåã¯ãšãªãŸã㯠ORMïŒSQLAlchemy ãªã©ïŒãé©åã«äœ¿çšããŠãã ããããšãŒãžã§ã³ãã®å ¥åãã SQL æååãçŽæ¥æ§ç¯ããã®ã¯é¿ããŠãã ããã
- ãã©ãŠã¶ãŒããŒã«ïŒ ä»»æã® JavaScriptïŒ
browser_evaluate_scriptïŒãå®è¡ããããŒã«ã«ã¯æ³šæããŠãã ãããå¯èœã§ããã°ãä¿¡é Œã§ããªããšãŒãžã§ã³ãã®å ¥åã«çŽæ¥åºã¥ãã¹ã¯ãªããã®å®è¡ã¯é¿ããŠãã ãããPlaywright ã®ãµã³ãããã¯ã¹æ©èœã¯åœ¹ç«ã¡ãŸãããäžå šã§ã¯ãããŸããã - CLI ããŒã«ïŒ ã³ãã³ãã€ã³ãžã§ã¯ã·ã§ã³ãé²ãããã
run_ripgrepãrun_jqãªã©ã®ããŒã«ã«æž¡ãåŒæ°ããµãã¿ã€ãºããŠãã ãããç¹ã«ãè€éãªã³ãã³ãæååãæ§ç¯ããå Žåã¯æ³šæãå¿ èŠã§ããå ¥åããŒã¿ã®åãæž¡ãã«ã¯ãå®å šãªæ¹æ³ïŒäŸïŒæšæºå ¥åïŒã䜿çšããŠãã ããã
- ãã¡ã€ã«ã·ã¹ãã ããŒã«ïŒ æãéèŠãªã®ã¯ã
- ãã¹ãŠã®ããŒã«å ¥åã«ã€ããŠãPydantic ã¹ããŒãã䜿çšããŠå ¥åããŒã¿ã®åãšå¶çŽãæ€èšŒããŠãã ããã
- MCP ã¯æ§é åããã圢åŒãæäŸããŸããããŠãŒã¶ãŒïŒãšãŒãžã§ã³ãã®å
¥åã«åºã¥ããŠå€éšã·ã¹ãã ãšé£æºããããŒã«ã«ã¯ãç¹ã«æ³šæããŠãã ããã
-
ðŠ äŸåé¢ä¿ã®ã»ãã¥ãªãã£ïŒ
- ãµãŒãããŒãã£ã©ã€ãã©ãªïŒFastAPIãPydanticãPlaywrightãããŒã¿ããŒã¹ãã©ã€ããŒãªã©ïŒã®æ¢ç¥ã®è匱æ§ã«ããããé©çšããããã
uv pip install --upgrade ...ãŸãã¯uv syncã䜿çšããŠãäŸåé¢ä¿ã宿çã«æŽæ°ããŠãã ããã - ã»ãã¥ãªãã£ã¹ãã£ã³ããŒã«ïŒ
pip-auditãGitHub DependabotãSnykïŒã䜿çšããŠãpyproject.tomlãŸãã¯requirements.txtå ã®è匱ãªäŸåé¢ä¿ãèªåçã«ç¹å®ããŠãã ããã
- ãµãŒãããŒãã£ã©ã€ãã©ãªïŒFastAPIãPydanticãPlaywrightãããŒã¿ããŒã¹ãã©ã€ããŒãªã©ïŒã®æ¢ç¥ã®è匱æ§ã«ããããé©çšããããã
-
ð ãã°ã®ã»ãã¥ãªãã£ïŒ
DEBUGã¬ãã«ã®ãã°ã«ã¯ãããã³ããå šæãAPI ã¬ã¹ãã³ã¹ããã¡ã€ã«ã®å 容ãããŒã¿ã«å«ãŸããããŒãªã©ã®æ©å¯æ å ±ãèšé²ãããå ŽåããããŸããæ¬çªç°å¢ã§ã¯ãLOG_LEVELãé©åã«èšå®ããŠãã ããïŒéåžžãINFOãŸãã¯WARNINGã®æ¹ãå®å šã§ãïŒã- ãã°ãã¡ã€ã«ïŒ
LOG_TO_FILEã䜿çšããå ŽåïŒã«é©åãªã¢ã¯ã»ã¹èš±å¯ãèšå®ãããŠããããšã確èªãããã°ããŒããŒã·ã§ã³ãšä¿æããªã·ãŒãæ€èšããŠãã ãããAPI ããŒããã®ãŸãŸãã°ã«èšé²ããã®ã¯é¿ããŠãã ããã
-
âïž ããŒã«åºæã®ã»ãã¥ãªãã£ïŒ
- æå¹ã«ããŠããåããŒã«åºæã®ã»ãã¥ãªãã£äžã®åœ±é¿ã確èªããŠãã ããããã¡ã€ã«ã®æžã蟌ã¿ãã³ãŒãã®å®è¡ãããŒã¿ããŒã¹ãžã®ã¢ã¯ã»ã¹ãå¯èœãªããŒã«ã¯ãããŸããïŒèšå®ïŒ
ALLOWED_DIRSããæš©éãå¶éããããŒã¿ããŒã¹èªèšŒæ å ±ãªã©ïŒãæå°æš©éã®ååã«åŸã£ãŠããããšã確èªããŠãã ãããäžèŠãªããŒã«ããç°å¢ã«åãããŠååã«å®å šã«ã§ããªãããŒã«ã¯ç¡å¹ã«ããŠãã ããã
- æå¹ã«ããŠããåããŒã«åºæã®ã»ãã¥ãªãã£äžã®åœ±é¿ã確èªããŠãã ããããã¡ã€ã«ã®æžã蟌ã¿ãã³ãŒãã®å®è¡ãããŒã¿ããŒã¹ãžã®ã¢ã¯ã»ã¹ãå¯èœãªããŒã«ã¯ãããŸããïŒèšå®ïŒ
ð ã©ã€ã»ã³ã¹
ãã®ãããžã§ã¯ã㯠MIT LicenseïŒOpenAI/Anthropic Rider ãå«ãïŒã®äžã§ã©ã€ã»ã³ã¹ãããŠããŸãã詳现㯠LICENSE ãã¡ã€ã«ãã芧ãã ããã
ð è¬èŸ
ãã®ãããžã§ã¯ãã¯ãæ°å€ãã®çŽ æŽããããªãŒãã³ãœãŒã¹ãããžã§ã¯ãããµãŒãã¹ã®ææãåºç€ãšããŠããŸããç¹ã«ã以äžã®æ¹ã ã«æè¬ããŸãã
- åºç€ãšãªãæŠå¿µãšãããã³ã«ä»æ§ãæäŸããŠãã ãã£ã Model Context Protocol (MCP)ã
- 髿§èœãªãŠã§ããã¬ãŒã ã¯ãŒã¯ãæäŸããŠãã ãã£ã FastAPI ããŒã ã
- å ç¢ãªããŒã¿æ€èšŒãšèšå®ç®¡çãå®çŸããŠãã ãã£ã Pydantic ã®éçºè ã®çæ§ã
- çŸããåãããããã¿ãŒããã«åºåãå®çŸããŠãã ãã£ã Rich ã©ã€ãã©ãªã
- éåžžã«é«é㪠Python ããã±ãŒãžã®ã€ã³ã¹ããŒã«ãšäŸåé¢ä¿ã®è§£æ±ºãæäŸããŠãã ãã£ã Astral ã® uvã
- 匷åãªãã©ãŠã¶ãŒèªååãã¬ãŒã ã¯ãŒã¯ãæäŸããŠãã ãã£ã Microsoft ã® Playwright ããŒã ã
- Excel ãã¡ã€ã«æäœãå¯èœã«ããŠãã ãã£ã OpenPyXL ã®ã¡ã³ãããŒã®çæ§ã
- ããŒã¿ããŒã¹ããŒã«ããããéçºããŠãã ãã£ã SQLAlchemy ã®éçºè ã®çæ§ã
Tesseractãripgrepãjqãawkãsedãªã©ãçµ±åãããããŒã«ã®éçºè ã®çæ§ã- 匷åãªã¢ãã«ã API çµç±ã§å©çšã§ããããã«ããŠãã ãã£ãããã¹ãŠã® LLM ãããã€ããŒïŒOpenAIãAnthropicãGoogleãDeepSeekãxAI ãªã©ïŒã
- Python ããã³ãªãŒãã³ãœãŒã¹ã®ã³ãã¥ããã£å šäœã
ãã® README ã§ã¯ãå šäœåã詳ãã説æããŠããŸããåå¥ã®ããŒã«ã®ãã©ã¡ãŒã¿ãŒãé«åºŠãªèšå®ãªãã·ã§ã³ãå®è£ ã«é¢ãã詳现ãªèª¬æã«ã€ããŠã¯ããããžã§ã¯ãå ã®ãœãŒã¹ã³ãŒããšåããŒã«ã®ããã¥ã¡ã³ããåç §ããŠãã ããã
ãµãŒããŒã®å®è¡
CLI ã䜿çšããŠãµãŒããŒãèµ·åããŸãã
# Start in default stdio mode
umcp run
# Start in streamable-http mode for web interfaces or remote clients (recommended)
umcp run --transport-mode shttp
# Or use the shortcut:
umcp run -t shttp
# Run on a specific host and port (streamable-http mode)
umcp run -t shttp --host 0.0.0.0 --port 8080
ã³ã¡ã³ã
MCP ã¯åããŠã§ããïŒ
ãããã³ã«ã®æŠèŠããæåã®ãµãŒããŒã®å°å ¥ãŸã§ãããããçåã«ãŸãšããŠçããŸãã
AI ã¢ããªã±ãŒã·ã§ã³ãå€éšã®ããŒã«ãããŒã¿ãœãŒã¹ã«çµ±äžçãªæ¹æ³ã§æ¥ç¶ããããã®ãªãŒãã³ãªãããã³ã«ã§ããã¯ã©ã€ã¢ã³ãã¯ã¢ãã«ãšã®å¯Ÿè©±ãæ ããMCP ãµãŒããŒã¯ããŒã«ã»ãªãœãŒã¹ã»ããã³ãããã³ãã¬ãŒããæäŸããŸããæšæºã¡ãã»ãŒãžã§ããåãããããã1 ã€ã®ãµãŒããŒãè€æ°ã®ã¯ã©ã€ã¢ã³ãã§åå©çšã§ããŸãã