Building Mcp Serversのロゴ

Building Mcp Servers

コミュニティ
andreaswasita
building-mcp-servers

Authors an MCP server with the official SDK and gates.

概要

公開者andreaswasita
リポジトリcopilot-agents-dojo
スキル名building-mcp-servers
スター
54
フォーク
15
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    andreaswasitaがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Building Mcp Servers」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/andreaswasita/copilot-agents-dojo/tree/main/optional-skills/building-mcp-servers
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/andreaswasita/copilot-agents-dojo.git /tmp/copilot-agents-dojo
mkdir -p .claude/skills
cp -r /tmp/copilot-agents-dojo/optional-skills/building-mcp-servers .claude/skills/building-mcp-servers
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでBuilding Mcp Serversを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にBuilding Mcp Serversを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Building Mcp Serversは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Building MCP Servers Skill

Authors a Model Context Protocol server in TypeScript or Python using the official SDKs (@modelcontextprotocol/sdk, mcp), with deliberate tool/resource/prompt design, both stdio and Streamable HTTP transports, OAuth 2.1 auth, and a test fixture. Does NOT roll its own JSON-RPC framing and does NOT ship without registry + config snippet.

When to Use

  • A required system is not in mcp/registry.yaml.
  • An existing MCP server is too broad; you need a domain-specific facade.
  • User says "build", "write", "author", "create" + "MCP server".
  • Wrapping internal APIs so an agent can call them without bespoke skills.

Prerequisites

  • Node 20+ (TypeScript) or Python 3.11+.
  • The official SDK installed (@modelcontextprotocol/sdk or mcp).
  • An auth strategy decided upfront (CLI inheritance for local, OAuth 2.1 + PKCE for hosted).
  • mcp/registry.yaml and mcp/configs/ writable.
  • @modelcontextprotocol/inspector for handshake debugging.

How to Run

text
1. Pick primitives: tools / resources / prompts. Default to tools.
2. Design tool names (verb_object) and JSON Schema inputs.
3. Scaffold the server with the official SDK + stdio transport.
4. Add Streamable HTTP transport if the server is hosted.
5. Implement auth — CLI inheritance (local) or OAuth 2.1 + PKCE (hosted).
6. Add tests: in-memory transport unit tests + a real stdio smoke test.
7. Register in `mcp/registry.yaml` and add a `mcp/configs/` snippet.

Quick Reference

PrimitiveUse forMental model
toolsSide-effectful or arg'd queriesRPC the agent decides to invoke
resourcesRead-only documents addressable by URIThings the agent or user attaches
promptsPre-baked agent instructionsSlash commands the user invokes
ConcernRule
Tool namingverb_object snake_case (get_my_deals)
Input schemaJSON Schema, required fields marked, description on every property
OutputText content first; structured JSON in a second content block
Loggingstderr only — stdout is reserved for JSON-RPC framing
AuthCLI inheritance (local) or OAuth 2.1 + PKCE (hosted), never tokens in tool args
PaginationEvery list tool has limit (default ≤50) and cursor
IdempotencyMutations accept a client-provided idempotency key
VersioningBump serverInfo.version on schema changes

Procedure

Step 1: Choose Primitives

Default to tools. Use resources only when the data is naturally addressable by URI. Use prompts only when the user invokes them explicitly (slash commands).

Step 2: Design Tool Surface

For each tool:

  • Name: verb_object snake_case.
  • Description: answer "when do I call this?", not "what does it do internally". Lead with the trigger context.
  • Input: JSON Schema with required, every property has a human-readable description.
  • Output: text summary first; machine-readable JSON in a second content block if the agent will chain calls.

Step 3: Stdio Scaffold (TypeScript)

ts
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";

const server = new Server(
  { name: "my-server", version: "1.0.0" },
  { capabilities: { tools: {} } }
);

server.setRequestHandler(/* tools/list */, async () => ({ tools: [...] }));
server.setRequestHandler(/* tools/call */, async (req) => { /* ... */ });

await server.connect(new StdioServerTransport());

Step 4: Streamable HTTP (Hosted)

  • Use StreamableHTTPServerTransport.
  • Mount behind a real auth provider (Entra ID, Auth0, custom OAuth 2.1).
  • Implement /mcp POST + GET (SSE streaming). Do not invent endpoints.
  • Add protected resource metadata so clients can discover the auth server.

Step 5: Stdout Discipline

The single most common failure: a console.log or stray print before the JSON-RPC handshake corrupts the stream. The client silently dies.

  • TypeScript: route logs to console.error.
  • Python: configure logging to sys.stderr, never print.

Step 6: Auth Without Inline Secrets

  • Local dev: inherit from az, gh, kubectl, gcloud.
  • Hosted: OAuth 2.1 + PKCE. Map Authorization: Bearer … to your resource server.
  • Never accept tokens via tool arguments — that places them in the agent's context window and chat history.

Step 7: Tests

  • Unit-test handlers with the SDK's in-memory transport.
  • Smoke test: spawn the server, call tools/list then one representative tools/call.
  • Ship an auth_status tool for diagnostics.
  • Provide a --inspect mode wired to @modelcontextprotocol/inspector.

Step 8: Register and Document

After the server works:

  1. Add an entry to mcp/registry.yaml (transport, scopes, auth model).
  2. Add a config snippet under mcp/configs/.
  3. Cross-link from the relevant consumer skill.

Pitfalls

  • DO NOT log to stdout in a stdio server.
  • DO NOT build a mega-tool with a mode enum that switches behavior. One job per tool.
  • DO NOT write tool descriptions that explain implementation. Lead with the trigger context.
  • DO NOT return unbounded result sets. Every list tool has limit and cursor.
  • DO NOT accept credentials as tool arguments. They will end up in chat history.
  • DO NOT re-implement JSON-RPC framing. Use the SDK.
  • DO NOT ship a server without an auth_status / health tool.

Verification

  • Built with @modelcontextprotocol/sdk (TS) or mcp (Python) — no custom framing.
  • All tools have JSON Schema input with required set and per-property description.
  • Stdout is reserved for JSON-RPC; all logs go to stderr.
  • Auth uses CLI inheritance (local) or OAuth 2.1 + PKCE (hosted).
  • auth_status tool exists.
  • Smoke test covers tools/list and one tools/call over real stdio.
  • Registry entry and mcp/configs/ snippet exist.
  • serverInfo.version set and bumped on every schema change.

よくある質問

AIスキル「Building Mcp Servers」では何ができますか?

Authors an MCP server with the official SDK and gates.

TypingMindでBuilding Mcp Serversを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Building Mcp Serversはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにBuilding Mcp Serversをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/andreaswasita/copilot-agents-dojo/tree/main/optional-skills/building-mcp-serversを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Building Mcp Serversを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Building Mcp Serversで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもBuilding Mcp Serversを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Building Mcp Servers」は無料ですか?

はい。andreaswasitaがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇