Building Mcp Servers logo

Building Mcp Servers

Community
andreaswasita
building-mcp-servers

Authors an MCP server with the official SDK and gates.

Overview

Publisherandreaswasita
Repositorycopilot-agents-dojo
Skill namebuilding-mcp-servers
Stars
54
Forks
15
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by andreaswasita on GitHub. Read the source before you install it.

Installation

Install the Building Mcp Servers AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/andreaswasita/copilot-agents-dojo/tree/main/optional-skills/building-mcp-servers
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

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
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Building Mcp Servers in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Building Mcp Servers on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Building Mcp Servers is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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.

Frequently asked questions

What does the Building Mcp Servers AI skill do?

Authors an MCP server with the official SDK and gates.

Why use Building Mcp Servers on TypingMind?

Because you install it once and use it with any model. Building Mcp Servers is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Building Mcp Servers in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/andreaswasita/copilot-agents-dojo/tree/main/optional-skills/building-mcp-servers. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Building Mcp Servers?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Building Mcp Servers?

As many as you like. As long as a model supports skills, you can use Building Mcp Servers with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Building Mcp Servers AI skill free?

Yes. It is published on GitHub by andreaswasita under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇