Agent skill

MCP Server Patterns

by affaan-m in affaan-m/ECC

使用Node/TypeScript SDK构建MCP服务器——工具、资源、提示、Zod验证、stdio与可流式HTTP对比。使用Context7或官方MCP文档获取最新API信息。

MITAuto-check passedAgent Workflows

Install MCP Server Patterns

skills CLI
$ npx skills add affaan-m/ECC --skill mcp-server-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install affaan-m/ECC mcp-server-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/affaan-m/ECC.git skills-src && mkdir -p .claude/skills && cp -r skills-src/docs/zh-CN/skills/mcp-server-patterns .claude/skills/mcp-server-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
mcp-server-patterns
GitHub stars
276k
Used in
1 other repo
Token cost
~551 tokens
SKILL.md length
165 words
Files
1
Skills in repo
673
Repo updated
First seen
Licence
MIT

At a glance

使用Node/TypeScript SDK构建MCP服务器——工具、资源、提示、Zod验证、stdio与可流式HTTP对比。使用Context7或官方MCP文档获取最新API信息。

  • Tasks that involve MCP servers
  • SKILL.md covers 何时使用, 工作原理, 示例 and 最佳实践, plus 1 more section
  • Calls npm
  • Tasks that involve Forms and validation

What it does

MCP Server Patterns is an agent skill from affaan-m/ECC. 使用Node/TypeScript SDK构建MCP服务器——工具、资源、提示、Zod验证、stdio与可流式HTTP对比。使用Context7或官方MCP文档获取最新API信息。

Its SKILL.md is about 550 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Agent Workflows, covering MCP servers and Forms and validation. It works with Model Context Protocol, TypeScript and Zod. The repository describes itself as: The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond. The licence is MIT.

When your agent uses it

  • Tasks that involve MCP servers
  • Tasks that involve Forms and validation

Example prompts

  • “/mcp-server-patterns”

Requirements

  • Node.js

What it can do on your machine

Read from SKILL.md and the folder at commit ef648e0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • modelcontextprotocol.io

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

MCP Server Patterns loads about 551 tokens when it runs. Until then it costs about 28 tokens; SKILL.md has 165 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~28
When it runs · the whole SKILL.md, loaded when a task matches
~551

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from affaan-m/ECC at commit ef648e0, republished under its MIT licence (© affaan-m). 165 words, ~551 tokens.

Download SKILL.mdSave it as .claude/skills/mcp-server-patterns/SKILL.md (or your agent's skills folder).
name
mcp-server-patterns
description
使用Node/TypeScript SDK构建MCP服务器——工具、资源、提示、Zod验证、stdio与可流式HTTP对比。使用Context7或官方MCP文档获取最新API信息。
origin
ECC

MCP 服务器模式

模型上下文协议(MCP)允许 AI 助手调用工具、读取资源和使用来自服务器的提示。在构建或维护 MCP 服务器时使用此技能。SDK API 会演进;请查阅 Context7(查询文档 "MCP")或官方 MCP 文档以获取当前的方法名称和签名。

何时使用

在以下情况时使用:实现新的 MCP 服务器、添加工具或资源、选择 stdio 与 HTTP、升级 SDK,或调试 MCP 注册和传输问题。

工作原理

核心概念
  • 工具:模型可以调用的操作(例如搜索、运行命令)。根据 SDK 版本,使用 registerTool() 或 tool() 注册。
  • 资源:模型可以获取的只读数据(例如文件内容、API 响应)。根据 SDK 版本,使用 registerResource() 或 resource() 注册。处理程序通常接收一个 uri 参数。
  • 提示:客户端可以呈现的可重用参数化提示模板(例如在 Claude Desktop 中)。使用 registerPrompt() 或等效方法注册。
  • 传输:stdio 用于本地客户端(例如 Claude Desktop);可流式 HTTP 是远程(Cursor、云端)的首选。传统 HTTP/SSE 用于向后兼容。

Node/TypeScript SDK 可能暴露 tool() / resource() 或 registerTool() / registerResource();官方 SDK 已随时间变化。请始终根据当前 MCP 文档 或 Context7 进行验证。

使用 stdio 连接

对于本地客户端,创建一个 stdio 传输并将其传递给服务器的连接方法。确切的 API 因 SDK 版本而异(例如构造函数与工厂函数)。请参阅官方 MCP 文档或查询 Context7 中的 "MCP stdio server" 以获取当前模式。

保持服务器逻辑(工具 + 资源)独立于传输,以便您可以在入口点中插入 stdio 或 HTTP。

远程(可流式 HTTP)

对于 Cursor、云端或其他远程客户端,使用可流式 HTTP(根据当前规范,每个 MCP HTTP 端点)。仅在需要向后兼容性时支持传统 HTTP/SSE。

示例

安装和服务器设置
bash
npm install @modelcontextprotocol/sdk zod
typescript
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { z } from "zod";

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

使用您的 SDK 版本提供的 API 注册工具和资源:某些版本使用 server.tool(name, description, schema, handler)(位置参数),其他版本使用 server.tool({ name, description, inputSchema }, handler) 或 registerTool()。资源同理——当 API 提供时,在处理程序中包含一个 uri。请查阅官方 MCP 文档或 Context7 以获取当前的 @modelcontextprotocol/sdk 签名,避免复制粘贴错误。

使用 Zod(或 SDK 首选的模式格式)进行输入验证。

最佳实践

  • 模式优先:为每个工具定义输入模式;记录参数和返回形状。
  • 错误处理:返回结构化错误或模型可以解释的消息;避免原始堆栈跟踪。
  • 幂等性:尽可能使用幂等工具,以便重试是安全的。
  • 速率和成本:对于调用外部 API 的工具,请考虑速率限制和成本;在工具描述中加以说明。
  • 版本控制:在 package.json 中固定 SDK 版本;升级时查看发行说明。

官方 SDK 和文档

  • JavaScript/TypeScript:@modelcontextprotocol/sdk (npm)。使用库名 "MCP" 的 Context7 以获取当前的注册和传输模式。
  • Go:GitHub 上的官方 Go SDK (modelcontextprotocol/go-sdk)。
  • C#:适用于 .NET 的官方 C# SDK。

© affaan-m, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in docs/zh-CN/skills/mcp-server-patterns of affaan-m/ECC.

Open the folder on GitHubat commit ef648e0

Used in 1 other repository

We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in affaan-m/ECC, which our catalogue first saw on October 7, 2026.

Compare with similar skills

MCP Server Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

MCP Server Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
MCP Server Patterns this skillaffaan-m/ECC276k1 repos~551Automated safety check: PassMIT
MCP SDK Auditawdr74100/figwright995—~4.1kAutomated safety check: PassMIT
Vscode MCP Tool Developmenttjx666/vscode-mcp105—~1.5kAutomated safety check: PassCustom licence
MCP DeveloperJeffallan/claude-skills12k—~1.5kAutomated safety check: PassMIT
Typescript MCP Server Generatorgithub/awesome-copilot40k—~1.7kAutomated safety check: PassMIT
Typescript Styletjx666/vscode-mcp105—~961Automated safety check: PassCustom licence

Similar skills

  • MCP SDK Audit

    awdr74100/figwright

    Upgrade @modelcontextprotocol/server (the MCP TypeScript SDK v2) and prove the wire contract survived.

    995 GitHub stars~4.1k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • End-to-end workflow for adding, modifying, or debugging VSCode MCP tools in this repo — IPC zod schema and EventMap, bridge service registration, core ToolDefinition and tool constants, MCP/CLI…

    105 GitHub stars~1.5k tokensUpdated 2 mo ago
    Agent WorkflowsAuto-check passed
  • MCP Developer

    Jeffallan/claude-skills

    Builds and debugs MCP servers and clients in TypeScript or Python, from tool and resource definitions to transport setup and inspector-based protocol checks.

    12k GitHub stars~1.5k tokensUpdated 6 days ago
    Agent WorkflowsAuto-check passed
  • Typescript MCP Server Generator

    github/awesome-copilot

    Official

    Generate a complete MCP server project in TypeScript using the MCP TypeScript SDK v2 (@modelcontextprotocol/server) with tools, resources, and proper configuration

    40k GitHub stars~1.7k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Typescript Style

    tjx666/vscode-mcp

    TypeScript code style and repo conventions for VSCode MCP — inference vs explicit types, ESM import suffixes, zod schema contracts, async VSCode/Node APIs, JSON-safe IPC results, JSDoc for public…

    105 GitHub stars~961 tokensUpdated 2 mo ago
    DevelopmentAuto-check passed
  • OpenAPI to MCP Server

    mcp-use/mcp-use

    Turns an OpenAPI or Swagger spec into an MCP server with the mcp-use TypeScript SDK, mapping each operation to a tool, wiring auth, testing and deploying.

    11k GitHub stars~5.2k tokensUpdated today
    Backend & APIsAuto-check passed

More from affaan-m/ECC

All 673 skills in this repo
  • Skill Stocktake

    affaan-m/ECC

    Audits your installed Claude skills and commands for quality, with a quick mode for recently changed skills and a full mode that evaluates all of them through subagents.

    276k GitHub starsUsed in 5 repos~1.9k tokens
    Auto-check passed
  • Ingests, indexes, searches, edits and monitors video, audio and live streams through the VideoDB Python SDK, returning stream links, clips and timestamps.

    276k GitHub starsUsed in 3 repos~3.5k tokens
    Auto-check: notes
  • Rules Distillation

    affaan-m/ECC

    Scans installed skills for principles that recur across them and proposes rule-file changes: append, revise, add a section, create a file or leave as covered.

    276k GitHub starsUsed in 2 repos~2.3k tokens
    Auto-check passed
  • Builds DRAFT counterparty agreements from one markdown template and a small JSON spec per party, with clauses picked by the party's role.

    276k GitHub stars~2.9k tokensUpdated 4 days ago
    Auto-check passed
  • Measures whether agents actually follow a skill, rule or agent definition by generating scenarios at three strictness levels and scoring tool-call traces.

    276k GitHub starsUsed in 1 repo~623 tokens
    Auto-check passed
  • Instinct-based learning system that observes sessions via hooks, creates atomic instincts with confidence scoring, and evolves them into skills/commands/agents.

    276k GitHub stars~3.5k tokensUpdated 4 days ago
    Auto-check passed

Categories

Questions about MCP Server Patterns

What does MCP Server Patterns do?

使用Node/TypeScript SDK构建MCP服务器——工具、资源、提示、Zod验证、stdio与可流式HTTP对比。使用Context7或官方MCP文档获取最新API信息。. MCP Server Patterns is an agent skill from affaan-m/ECC.

When should I use MCP Server Patterns?

MCP Server Patterns fits situations like: tasks that involve MCP servers; tasks that involve Forms and validation.

How do I install MCP Server Patterns in Claude Code?

Run `npx skills add affaan-m/ECC --skill mcp-server-patterns -a claude-code`. Or copy the skill folder (docs/zh-CN/skills/mcp-server-patterns in affaan-m/ECC) into .claude/skills/mcp-server-patterns in your project. Claude Code loads it when a task matches its description.

How do I install MCP Server Patterns in Codex?

Run `npx skills add affaan-m/ECC --skill mcp-server-patterns -a codex`. Or copy the skill folder (docs/zh-CN/skills/mcp-server-patterns in affaan-m/ECC) into .agents/skills/mcp-server-patterns in your project. Codex loads it when a task matches its description.

Can I use MCP Server Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add affaan-m/ECC --skill mcp-server-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/mcp-server-patterns, .gemini/skills/mcp-server-patterns, .github/skills/mcp-server-patterns and .opencode/skills/mcp-server-patterns in your project.

What does MCP Server Patterns need to run?

Going by SKILL.md and its folder, MCP Server Patterns needs the command-line tools its instructions call (npm). Our summary lists: Node.js.

Does MCP Server Patterns access the network?

SKILL.md names 1 domain. As links in the text: modelcontextprotocol.io. This is read from the text; nothing was executed.

Is MCP Server Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does MCP Server Patterns use?

MCP Server Patterns is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does MCP Server Patterns use?

About 551 tokens (SKILL.md is roughly 2.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to MCP Server Patterns?

Skills that share tags, products or a category with MCP Server Patterns: MCP SDK Audit (awdr74100/figwright, 995 stars), Vscode MCP Tool Development (tjx666/vscode-mcp, 105 stars), MCP Developer (Jeffallan/claude-skills, 12k stars) and Typescript MCP Server Generator (github/awesome-copilot, 40k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains MCP Server Patterns?

affaan-m (a GitHub user) maintains it in affaan-m/ECC, which has 275,546 GitHub stars. The repository holds 673 skills in this directory. The repository was last updated on October 5, 2026.

Source: affaan-m/ECC on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.