Logo: Building Mcp Servers

Building Mcp Servers

Communautéit
andreaswasita
building-mcp-servers

Authors an MCP server with the official SDK and gates.

Iwwersiicht

Editeurandreaswasita
Repositorycopilot-agents-dojo
Skill-Nummbuilding-mcp-servers
Stären
54
Forks
15
Matgeliwwert Dateien
Nëmmen Instruktiounen
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    andreaswasita huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Building Mcp Servers an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/andreaswasita/copilot-agents-dojo/tree/main/optional-skills/building-mcp-servers
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

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
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Building Mcp Servers an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Building Mcp Servers automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Building Mcp Servers net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

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.

Heefeg gestallte Froen

Wat mécht de KI-Skill Building Mcp Servers?

Authors an MCP server with the official SDK and gates.

Firwat Building Mcp Servers op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Building Mcp Servers besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Building Mcp Servers an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/andreaswasita/copilot-agents-dojo/tree/main/optional-skills/building-mcp-servers an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Building Mcp Servers benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Building Mcp Servers benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Building Mcp Servers domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Building Mcp Servers gratis?

Jo. andreaswasita huet de Skill ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇