LoginJoin GenScrap

#anthropic

関連タグ

#anthropic が付いた公開スクラップ 2 件

Best mcp server development sdk?
manual

If by “MCP server” you mean a server implementing the Model Context Protocol (MCP) to allow LLMs / AI agents to interact with external tools/data sources, here are some of the best SDKs & frameworks — trade-offs, strengths & caveats — to help you choose one. If you meant something else by “MCP server,” happy to adjust. --- ## What is MCP The Model Context Protocol (MCP) is an open protocol by Anthropic to standardize how large language models (LLMs) can integrate with external tools, data sources, file systems, prompts, etc. ([ウィキペディア][1]) There are official SDKs in many languages, reference server implementations, and a growing ecosystem of tools. ([Model Context Protocol][2]) --- ## What to Look for in a Good MCP Server SDK Before picking one, consider: | Criterion | Why it matters | | ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | **Language ecosystem / community** | You’ll want one in a language you and your team are comfortable with; also availability of examples, integrations, debugging, etc. | | **Feature completeness** | Tools, prompt and resource exposure, transports (stdio, HTTP, SSE, etc.), good docs. | | **Security / sandboxing / permission control** | MCP servers often give access to file systems, external APIs, etc. You need to control what an agent can do. | | **Performance & latency** | Some tasks (web automation, file ops) need low latency; transport overheads matter. | | **Ease of deployment** | How easy is it to host, package, maintain (Docker, cloud, etc.)? | | **Interoperability** | Ability to connect to existing tools, integrate with LLM agents / clients, interface cleanly with other services. | --- ## Official SDKs & Languages Anthropic maintains official SDKs that support server and client building. Languages include: * **TypeScript** ([Model Context Protocol][2]) * **Python** ([Model Context Protocol][2]) * **Go** ([Model Context Protocol][2]) * **Kotlin / Swift / Java / C# / Ruby / Rust / PHP** ([Model Context Protocol][2]) These SDKs implement the core MCP protocol features such as: * Exposing “tools, resources, prompts” via MCP servers. ([Model Context Protocol][2]) * Building MCP clients to connect to servers. ([Model Context Protocol][2]) * Supporting different transports (local, remote) and ensuring protocol compliance. ([Model Context Protocol][2]) So using one of these “official” SDKs is usually the safest bet for compatibility & future support. --- ## Popular / Recommended Implementations & Servers Depending on what your MCP server needs to do, some reference / community servers are more mature or better suited. Some examples: | Use-Case | Good MCP Server / Implementation | | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **Filesystem operations (read/write, project file context, etc.)** | Filesystem MCP servers (often official reference ones) are widely used. ([GitHub][3]) | | **Git / GitHub integration** | Git / GitHub MCP server tools are well supported. Useful for code review, CI, repo introspection. ([Digma][4]) | | **Browser / Web automation (UI testing / scraping)** | Puppeteer MCP, Playwright MCP are good choices. ([Digma][4]) | | **Memory / context preservation across sessions** | Memory Bank MCP, Knowledge Graph Memory MCP. ([Digma][4]) | | **Domain-specific / API / data integrations** | If you need database access (SQL, NoSQL), file storage, cloud services etc., look for MCP servers that already support those tools, or build using SDKs. ([LogRocket Blog][5]) | --- ## Pros & Cons **Pros:** * Easy extensibility: you can expose new “tools” or “resources” as MCP endpoints. * Standardization: once clients & servers follow MCP, tools become interoperable. * Rapid prototyping: you can spin up servers for local file access, APIs, etc. fairly quickly. **Cons / risks:** * **Security risks** — giving AI agents access to powerful tools (filesystem, OS commands, network) can be dangerous if permissions are too open. Must sandbox / control carefully. * **Complexity** as the number of tools/tools-APIs grows: tool discovery, versioning, schema drift, etc. * **Latency / overhead** in some scenarios (esp remote transport). * **Maintenance burden**, especially if you build custom servers. --- ## My Take: Best SDKs If I were to pick “best” SDKs / approach, here are what I’d recommend depending on scale / team size / urgency: * For a small team/prototype: **Python SDK** — very mature, many libraries/tools, quick to experiment. * For integration into existing large codebases or production, or if you need high performance/type safety: **TypeScript** / **Go**. Especially if you have a Node.js or cloud-native stack. * If your target is mobile / iOS / Android, using Kotlin or Swift SDKs may make sense. --- If you tell me your constraints (language(s), deployment environment, what tools you need, security/privacy concerns), I can recommend the *best specific MCP SDK + server implementation* for *your use-case*. Do you want me to do that? [1]: https://en.wikipedia.org/wiki/Model_Context_Protocol?utm_source=chatgpt.com "Model Context Protocol" [2]: https://modelcontextprotocol.io/docs/sdk?utm_source=chatgpt.com "SDKs" [3]: https://github.com/wong2/awesome-mcp-servers?utm_source=chatgpt.com "wong2/awesome-mcp-servers" [4]: https://digma.ai/15-best-mcp-servers/?utm_source=chatgpt.com "15 Best MCP servers for developers in May 2025" [5]: https://blog.logrocket.com/top-15-mcp-servers-ai-projects/?utm_source=chatgpt.com "The top 15 MCP servers for your AI projects"

2025/9/13表示
MCP Server入門
chatgpt

## MCPサーバーとは?かんたん説明 **MCP(Model Context Protocol)サーバー**は、AI(とくに大きな言葉を扱うモデル:LLM)が、人間の代わりに外部の情報やツールとやりとりできる「通り道」をつくる仕組みです。たとえるなら「AI用のUSB-Cケーブル」です。 これはAnthropic(アンソロピック)という会社が2024年11月に公開した、誰でも使える(オープンな)仕組みです。([saketnkzw.com][1]) --- ## MCPの仕組み:関係者の役割 MCPは、以下3つの役割で成り立っています: 1. **ホスト (Host)** → AIアシスタントそのもの(例:Claude Desktop、IDEのAI機能) → ユーザーの命令を受けて、どの情報が必要か判断します。([Qiita][2]) 2. **クライアント (Client)** → ホストとサーバーをつなぐ“橋渡し役”。 → ホスト側にあって、適切な指示をMCPサーバーに送ります。([Qiita][2], [ウィキペディア][3]) 3. **サーバー (Server)** → 実際の情報やツールを持っていて、それをクライアント経由でAIに提供する“情報の倉庫”。 → 必要なデータや機能(たとえば天気情報やファイル読み込み)を返します。([Qiita][4], [ウィキペディア][5], [ウィキペディア][3]) つまり、ホスト → クライアント → サーバー → クライアント → ホストという流れで、データのやりとりをする構成です。 --- ## なぜ注目されているの?メリットまとめ * **共通ルールでつながる** → どのAIとも、どのデータとも同じ形式でやりとりできるようになり、作る側も使う側もラクになります。([ウィキペディア][5], [luenci.com][6], [ubsecure.jp][7]) * **拡張性が高い** → 新しいツールや機能を追加するのが簡単。道具を増やす感覚で、AIの能力を伸ばせます。([ubsecure.jp][7], [クラスメソッド発「やってみた」系技術メディア | DevelopersIO][8], [ウィキペディア][5]) * \*\*大手サービスでも採用中 \*\* → OpenAIやGoogle DeepMind、Microsoftなどの先進企業も採用しており、信頼性や注目度が高いです。([ウィキペディア][5]) --- ##  イメージで視覚化 > まるで「AI用のUSB‑Cケーブル」のような仕組み。 > USB‑Cで機器とつなげば、何でもデータがやりとりできるように、 > MCPを使えばAIが遠くのツールや情報にアクセスできるようになります。([GitHub][9]) --- ## 簡単な使い方の流れ(例:天気情報を取得するMCPサーバー構築) たとえばこんな使い方があります: 1. 天気を知らせるための「get\_forecast」や「get\_alerts」などの機能を持つMCPサーバーを用意する。([Model Context Protocol][10]) 2. クライアント(例:Claude Desktopなど)にそのサーバーを登録。 3. ユーザーが「今日の天気は?」と聞くと、AIがMCPを通じて情報を取得して答えてくれる。 --- ## 入門ポイントまとめ | 用語 | 説明(一言) | | ------ | ------------------ | | MCP | AIと情報をつなぐ共通ルール | | Host | ユーザーの命令を扱うAI本体 | | Client | HostとServerをつなぐ橋渡し | | Server | 情報や機能を持つ倉庫 | --- いいね!じゃあ「手を動かせる・非エンジニア向け」の超やさしい実例つきガイドいきます。コードは“貼って動かす”最短ルートにして、必要なところだけ軽く説明します。 --- # MCPサーバーを作って動かす:いちばんカンタンな道筋 ## 0) MCPって何をする? * AI(Claudeなど)から**安全に外部ツールやデータに触るための共通ルール**。 * 仕組みの全体像と「Claude Desktopにサーバーをつなぐ手順」は公式クイックスタートが非常に分かりやすいです。 ([Model Context Protocol][1]) --- ## 1) どのやり方を選ぶ? 初心者にやさしい順に3パターンあります。 1. **既製サーバーを入れる(最短)** 例:ファイル閲覧用の「Filesystemサーバー」をClaude Desktopに追加。数分で“体験”できます。 ([Model Context Protocol][2]) 2. **テンプレから自作(かんたん)** TypeScript(Node.js)やPythonの**雛形リポジトリ**を使うと、コピペ中心で自作できます。 ([GitHub][3]) 3. **クラウドに公開(応用)** 作ったサーバーを**Vercel**に配置すれば、URLでつないでどこからでも使えます。認証・スケールも面倒見てくれます。 ([Vercel][4]) > まずは①→②→③と段階を踏むのがおすすめです。 --- ## 2) まずは体験:既製サーバーをClaudeに入れてみる(数分) Claude Desktop を開き、\*\*Settings →(Developer または Extensions)**からMCPサーバーを追加します。公式の「ローカルMCPサーバー接続ガイド」が画面つきで丁寧です。最近は**ワンクリックの“Desktop Extension(.dxt)”\*\*にも対応してきています。 ([Model Context Protocol][2], [Anthropic Help Center][5], [Reddit][6]) --- ## 3) 実例①:超最小の“お天気”サーバー(Node.js/TypeScript) > 公式チュートリアルの流れを、初心者向けに**最短コード**に絞ったものです。 ([Model Context Protocol][1]) ### 準備 ```bash # 任意の空フォルダで npm init -y npm i @modelcontextprotocol/sdk fastmcp typescript ts-node npx tsc --init ``` ### サーバーコード(`server.ts`) ```ts import { Server } from "fastmcp"; // 1) サーバー作成(stdioで動かす) const app = new Server({ name: "weather-demo", version: "1.0.0" }); // 2) "get_weather" という道具(ツール)を1個だけ用意 app.tool("get_weather", { description: "都市名を入れるとダミーの天気を返すよ", inputSchema: { type: "object", properties: { city: { type: "string" } }, required: ["city"] }, execute: async ({ city }) => { // 本当はAPIを呼ぶが、まずは固定値で体験する return { summary: `${city} は 25℃ / 晴れ(デモ値)` }; }, }); // 3) 起動(stdio) app.startStdio(); ``` ### 実行 ```bash npx ts-node server.ts ``` --- ## 4) Claude Desktop とつなぐ(ローカル接続) Claude Desktop の設定で\*\*「カスタム(ローカル)MCPサーバー」**として今のプロセス(stdio)を登録します。手順は公式の「ローカルMCPをつなぐ」ドキュメントが確実です。登録後にClaudeを再起動すると、チャット画面のツール一覧に**get\_weather\*\*が出ます。 ([Model Context Protocol][2]) > もしURL経由の**リモート接続**をしたい場合は、**Custom Connector**からURLを追加する方式が用意されています。 ([Model Context Protocol][7]) --- ## 5) 実例②:同じことをPythonで(お好みで) Alex Mercedさんの**Pythonによる基本MCPサーバー**解説が読みやすいです。以下は「最低限の一個ツール」パターン。 ([Medium][8]) ### 準備 ```bash pip install fastmcp ``` ### サーバーコード(`server.py`) ```python from fastmcp import Server app = Server(name="weather-demo", version="1.0.0") @app.tool() def get_weather(city: str) -> dict: """都市名を受け取り、ダミーの天気を返す""" return {"summary": f"{city} は 25℃ / 晴れ(デモ値)"} if __name__ == "__main__": app.start_stdio() ``` ### 実行 ```bash python server.py ``` > あとは**手順4**と同様にClaude Desktopへ登録して使えます。 ([Model Context Protocol][2]) --- ## 6) 便利なテンプレ&参考集 * **テンプレ(TypeScript / FastMCP入り)**: `mcpdotdirect/template-mcp-server` — stdio/HTTP両対応、ツールやリソース、プロンプトの雛形まで入っています。最短で“自分用サーバー”に化けます。 ([GitHub][3]) * **公式の参照実装とサーバーギャラリー**: いろんな用途のサーバーがまとまっており、「こう作るのか」のカタログとして便利。 ([GitHub][9]) --- ## 7) クラウド公開(応用):Vercelにデプロイ → URLで接続 ローカルで動かせたら、次は**Vercel**に置いてURL接続してみましょう。**Functions**でスケールし、**OAuth/認可**もガイドあり。Claude側は\*\*Settings→Integrations(またはDeveloper)\*\*からURLを登録するだけ。 ([Vercel][4], [weavely.ai][10]) --- ## 8) 困ったときのヒント * **Claude Desktop の再起動**で拾われることが多い(ツールが見えない時)。 ([MESA][11]) * Windowsでの再起動や設定場所のコツをまとめたコミュニティTipsも参考に。 ([YouTube][12], [Reddit][13]) --- ## 9) 何ができるようになる? MCPは\*\*「AIに手足を生やす」\*\*ようなもの。ファイル操作、社内API、データベース、SaaSなど、**一度“サーバー”として生やせば、Claudeなど複数のクライアントから共通ルールで使い回せる**のが最大の効用です。背景や事例の概観はこちらが読みやすいです。 ([The Verge][14]) --- # まとめ(今日やるアクション) 1. まずは**既製サーバー**をClaudeに入れて体験(1日目) ([Model Context Protocol][2]) 2. 次に**最小サーバー**を自作(TypeScriptかPythonのどちらかでOK) ([Model Context Protocol][1], [Medium][8]) 3. 気に入ったら**テンプレ**で整理し、**Vercel**に公開してURL接続(2〜3日目) ([GitHub][3], [Vercel][4]) --- 必要なら、あなたのユースケース(社内データ参照、RAG呼び出し、業務システム連携、など)に合わせて**具体的なツール設計**まで一気に作ります。やりたいことを教えてくれれば、上の最小サンプルをそのまま“本番の骨格”に育てます。 [1]: https://modelcontextprotocol.io/quickstart/server?utm_source=chatgpt.com "Build an MCP Server - Model Context Protocol" [2]: https://modelcontextprotocol.io/quickstart/user?utm_source=chatgpt.com "Connect to Local MCP Servers - Model Context Protocol" [3]: https://github.com/mcpdotdirect/template-mcp-server?utm_source=chatgpt.com "mcpdotdirect/template-mcp-server" [4]: https://vercel.com/docs/mcp/deploy-mcp-servers-to-vercel?utm_source=chatgpt.com "Deploy MCP servers to Vercel" [5]: https://support.anthropic.com/en/articles/10949351-getting-started-with-local-mcp-servers-on-claude-desktop?utm_source=chatgpt.com "Getting started with Local MCP Servers on Claude Desktop" [6]: https://www.reddit.com/r/ClaudeAI/comments/1ll88ay/local_mcp_servers_can_now_be_installed_with_one/?utm_source=chatgpt.com "Local MCP servers can now be installed with one click on Claude ..." [7]: https://modelcontextprotocol.io/docs/tutorials/use-remote-mcp-server?utm_source=chatgpt.com "Connect to Remote MCP Servers - Model Context Protocol" [8]: https://medium.com/data-engineering-with-dremio/building-a-basic-mcp-server-with-python-4c34c41031ed?utm_source=chatgpt.com "Building a Basic MCP Server with Python | by Alex Merced" [9]: https://github.com/modelcontextprotocol/servers?utm_source=chatgpt.com "modelcontextprotocol/servers: Model Context Protocol ..." [10]: https://www.weavely.ai/blog/claude-mcp?utm_source=chatgpt.com "How to add MCP servers to Claude (free and paid) - Weavely" [11]: https://www.getmesa.com/blog/how-to-connect-mcp-server-claude/?utm_source=chatgpt.com "Connect Claude to MCP Servers for Better AI Capabilities" [12]: https://www.youtube.com/watch?v=A151Nk_nN_U&utm_source=chatgpt.com "Easy connect Claude AI desktop to MCP servers (For Windows)" [13]: https://www.reddit.com/r/ClaudeAI/comments/1jf4hnt/setting_up_mcp_servers_in_claude_code_a_tech/?utm_source=chatgpt.com "Setting Up MCP Servers in Claude Code: A Tech Ritual for ... - Reddit" [14]: https://www.theverge.com/2024/11/25/24305774/anthropic-model-context-protocol-data-sources?utm_source=chatgpt.com "Anthropic launches tool to connect AI systems directly to datasets" [1]: https://saketnkzw.com/posts/mcp-get-started?utm_source=chatgpt.com "clineと無料で作るMCPサーバー入門 | tnkzw.sake's blog" [2]: https://qiita.com/sigma_devsecops/items/7c40266160262ecd5ed1?utm_source=chatgpt.com "【MCP入門】LLMとツールをつなぐ仕組みを理解する" [3]: https://zh.wikipedia.org/wiki/%E6%A8%A1%E5%9E%8B%E4%B8%8A%E4%B8%8B%E6%96%87%E5%8D%8F%E8%AE%AE?utm_source=chatgpt.com "模型上下文协议" [4]: https://qiita.com/takashiuesaka/items/49559b830366255d1216?utm_source=chatgpt.com "[MCP再入門]「MCPはAIアプリにとってのUSB-C」がしっくりこ ..." [5]: https://en.wikipedia.org/wiki/Model_Context_Protocol?utm_source=chatgpt.com "Model Context Protocol" [6]: https://luenci.com/en/posts/mcp%E5%85%A5%E9%97%A8%E6%A6%82%E5%BF%B5%E7%AF%87/?utm_source=chatgpt.com "MCP 入门(概念篇) - Luenci" [7]: https://www.ubsecure.jp/blog/20250612?utm_source=chatgpt.com "MCPでLLMがネットサーフィン!?~DifyとFetch Serverで作る ..." [8]: https://dev.classmethod.jp/articles/mcp-server-on-vercel/?utm_source=chatgpt.com "Vercelで始めるMCPサーバー構築入門 - DevelopersIO" [9]: https://github.com/liaokongVFX/MCP-Chinese-Getting-Started-Guide?utm_source=chatgpt.com "Model Context Protocol(MCP) 编程极速入门" [10]: https://modelcontextprotocol.io/quickstart/server?utm_source=chatgpt.com "Build an MCP Server"

2025/8/26表示

自分のタグ付きコンテンツを作成しませんか?

始める