Communitygithub.com

David-Li0406/meta-skill-evloving

建立高品質 MCP(模型上下文協定)伺服器的指南,讓大型語言模型能透過設計良好的工具與外部服務互動。當您要建置整合外部 API 或服務的 MCP 伺服器時使用,無論是 Python (FastMCP) 或 Node/TypeScript (MCP SDK)。

meta-skill-evloving 是什麼?

此技能提供了一套完整且結構化的 MCP 伺服器開發指南,包含從規劃、實作到測試與評估的完整生命週期。它適合希望為 AI 代理(如 Claude Code、Cursor)建立自訂工具,以擴展其與外部系統互動能力的開發者。指南建議使用 TypeScript 作為主要語言,因其 SDK 支援完善、相容性高,且靜態型別有助於 AI 產生高品質程式碼。同時,它也提供了 Python 的實作選項。此指南不只涵蓋工具註冊與輸入/輸出結構描述,還深入探討了高品質 MCP 伺服器的關鍵設計原則,例如:如何平衡 API 覆蓋率與工作流程工具、如何設計具備可發現性的工具命名、如何管理上下文與錯誤訊息,以及如何建立評估機制來驗證伺服器的實用性。它支援透過 streamable HTTP(遠端)或 stdio(本地)進行傳輸,並可整合至 Cursor、Claude Code、GitHub Copilot 等平台。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/David-Li0406/meta-skill-evloving/tree/HEAD/AgentSkillOS/data/skill_seeds/mcp-builder

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

MCP 伺服器開發指南

概述

建立 MCP(模型上下文協定)伺服器,讓大型語言模型能透過設計良好的工具與外部服務互動。MCP 伺服器的品質,取決於它能多好地協助大型語言模型完成真實世界的任務。


流程

🚀 高階工作流程

建立高品質的 MCP 伺服器包含四個主要階段:

階段 1:深入研究與規劃

1.1 了解現代 MCP 設計

API 覆蓋率 vs. 工作流程工具: 在全面的 API 端點覆蓋率與專門的工作流程工具之間取得平衡。工作流程工具在特定任務上可能更方便,而全面的 API 覆蓋率則賦予代理組合操作的靈活性。效能因客戶端而異——某些客戶端受益於能結合基本工具的程式碼執行,而其他客戶端則更適合使用更高層次的工作流程。若不確定,請優先採用全面的 API 覆蓋率。

工具命名與可發現性: 清晰、具描述性的工具名稱有助於代理快速找到正確的工具。使用一致的詞首(例如 github_create_issue, github_list_repos)以及以動作為導向的命名方式。

上下文管理: 代理受益於簡潔的工具描述,以及篩選/分頁結果的能力。設計能回傳聚焦且相關資料的工具。某些客戶端支援程式碼執行,這有助於代理有效地篩選和處理資料。

可操作的錯誤訊息: 錯誤訊息應引導代理找到解決方案,並提供具體建議和後續步驟。

1.2 研讀 MCP 協定文件

瀏覽 MCP 規範:

從網站地圖開始,尋找相關頁面:https://modelcontextprotocol.io/sitemap.xml

然後使用 .md 後綴取得特定頁面(markdown 格式),例如:https://modelcontextprotocol.io/specification/draft.md。

需要檢閱的關鍵頁面:

  • 規範概述與架構
  • 傳輸機制(streamable HTTP, stdio)
  • 工具、資源和提示詞定義

1.3 研讀框架文件

建議技術棧:

  • 語言:TypeScript(高品質 SDK 支援,且在許多執行環境如 MCPB 中具有良好的相容性。此外,AI 模型擅長生成 TypeScript 程式碼,受益於其廣泛使用、靜態型別和良好的 lint 工具)
  • 傳輸方式:對遠端伺服器使用 streamable HTTP,採用無狀態 JSON(比有狀態會話和串流回應更易於擴展和維護)。對本地伺服器使用 stdio。

載入框架文件:

對於 TypeScript(建議):

  • TypeScript SDK:使用 WebFetch 載入 https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/README.md
  • ⚡ TypeScript 指南 - TypeScript 模式與範例

對於 Python:

  • Python SDK:使用 WebFetch 載入 https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/main/README.md
  • 🐍 Python 指南 - Python 模式與範例

1.4 規劃你的實作

了解 API: 檢閱服務的 API 文件,以識別關鍵端點、驗證需求和資料模型。必要時使用網路搜尋和 WebFetch。

工具選擇: 優先考慮全面的 API 覆蓋率。列出要實作的端點,從最常見的操作開始。


階段 2:實作

2.1 設定專案結構

請參閱語言專用指南以設定專案:

2.2 實作核心基礎設施

建立共用工具:

  • 含驗證功能的 API 客戶端
  • 錯誤處理輔助函式
  • 回應格式化(JSON/Markdown)
  • 分頁支援

2.3 實作工具

針對每個工具:

輸入結構描述:

  • 使用 Zod(TypeScript)或 Pydantic(Python)
  • 包含約束條件和清晰描述
  • 在欄位描述中加入範例

輸出結構描述:

  • 盡可能定義 outputSchema 以取得結構化資料
  • 在工具回應中使用 structuredContent(TypeScript SDK 功能)
  • 幫助客戶端理解並處理工具輸出

工具描述:

  • 功能簡潔摘要
  • 參數描述
  • 回傳型別結構描述

實作:

  • 對 I/O 操作使用 async/await
  • 使用可操作的訊息進行適當的錯誤處理
  • 在適用時支援分頁
  • 使用現代 SDK 時,同時回傳文字內容和結構化資料

註解:

  • readOnlyHint:true/false
  • destructiveHint:true/false
  • idempotentHint:true/false
  • openWorldHint:true/false

階段 3:審查與測試

3.1 程式碼品質

檢查項目:

  • 沒有重複的程式碼(DRY 原則)
  • 一致的錯誤處理
  • 完整的型別覆蓋
  • 清晰的工具描述

3.2 建置與測試

TypeScript:

  • 執行 npm run build 驗證編譯
  • 使用 MCP Inspector 測試:npx @modelcontextprotocol/inspector

Python:

  • 驗證語法:python -m py_compile your_server.py
  • 使用 MCP Inspector 測試

詳細的測試方法和品質檢查清單,請參閱語言專用指南。


階段 4:建立評估

實作 MCP 伺服器後,建立全面的評估來測試其有效性。

載入 ✅ 評估指南 以取得完整的評估指引。

4.1 了解評估目的

使用評估來測試大型語言模型是否能有效地使用你的 MCP 伺服器來回答現實、複雜的問題。

4.2 建立 10 個評估問題

為建立有效的評估,請遵循評估指南中概述的流程:

  1. 工具檢查:列出可用工具並了解其能力
  2. 內容探索:使用唯讀操作來探索可用資料
  3. 問題生成:建立 10 個複雜、現實的問題
  4. 答案驗證:親自解決每個問題以驗證答案

4.3 評估要求

確保每個問題:

  • 獨立:不依賴其他問題
  • 唯讀:只需要非破壞性操作
  • 複雜:需要多次工具呼叫和深入探索
  • 現實:基於人類會關心的實際用例
  • 可驗證:單一、清晰的答案,可透過字串比對驗證
  • 穩定:答案不會隨時間改變

4.4 輸出格式

建立一個具有以下結構的 XML 檔案:

<evaluation>
  <qa_pair>
    <question>尋找關於具有動物代號的 AI 模型發佈的討論。有一個模型需要一個使用 ASL-X 格式的特定安全標示。對於以有斑點野生貓科動物命名的模型,正在確定的 X 數字是多少?</question>
    <answer>3</answer>
  </qa_pair>
<!-- 更多 qa_pairs... -->
</evaluation>

參考檔案

📚 文件庫

在開發過程中根據需要載入這些資源:

核心 MCP 文件(優先載入)

  • MCP 協定:從網站地圖開始 https://modelcontextprotocol.io/sitemap.xml,然後使用 .md 後綴取得特定頁面
  • 📋 MCP 最佳實踐 - 通用 MCP 指引,包含:
    • 伺服器與工具命名慣例
    • 回應格式指引(JSON vs Markdown)
    • 分頁最佳實踐
    • 傳輸選擇(streamable HTTP vs stdio)
    • 安全與錯誤處理標準

SDK 文件(在階段 1/2 期間載入)

  • Python SDK:從 https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/main/README.md 取得
  • TypeScript SDK:從 https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/README.md 取得

語言專用實作指南(在階段 2 期間載入)

  • 🐍 Python 實作指南 - 完整的 Python/FastMCP 指南,包含:

    • 伺服器初始化模式
    • Pydantic 模型範例
    • 使用 @mcp.tool 註冊工具
    • 完整的可運作範例
    • 品質檢查清單
  • ⚡ TypeScript 實作指南 - 完整的 TypeScript 指南,包含:

    • 專案結構
    • Zod 結構描述模式
    • 使用 server.registerTool 註冊工具
    • 完整的可運作範例
    • 品質檢查清單

評估指南(在階段 4 期間載入)

  • ✅ 評估指南 - 完整的評估建立指南,包含:
    • 問題建立指引
    • 答案驗證策略
    • XML 格式規範
    • 範例問題與答案
    • 使用提供的腳本執行評估

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

David-Li0406/meta-skill-evloving

Browser automation with persistent page state. Use when users ask to navigate websites, fill forms, take screenshots, extract web data, test web apps, or automate browser workflows. Trigger phrases include "go to [url]", "click on", "fill out the form", "take a screenshot", "scrape", "automate", "test the website", "log into", or any browser interaction request.

David-Li0406/meta-skill-evloving

Create technical diagrams using Mermaid syntax for architecture, sequences, ERDs, flowcharts, and state machines. Use for visualizing system design, data flows, and processes. Triggers: diagram, mermaid, architecture diagram, sequence diagram, flowchart, ERD, entity relationship, state diagram, C4 model, component diagram, visualize, draw.

David-Li0406/meta-skill-evloving

Comprehensive document creation, editing, and analysis with support for tracked changes, comments, formatting preservation, and text extraction. When Claude needs to work with professional documents (.docx files) for: (1) Creating new documents, (2) Modifying or editing content, (3) Working with tracked changes, (4) Adding comments, or any other document tasks

David-Li0406/meta-skill-evloving

Complete color manipulation and green screen effects system. PROACTIVELY activate for: (1) Green screen/chromakey removal, (2) Color grading with LUTs, (3) Color correction (levels, curves, white balance), (4) Colorkey/color removal effects, (5) Hue/saturation manipulation, (6) Color space conversions (BT.709, BT.2020, HDR), (7) Color isolation effects, (8) Teal and orange look, (9) Vintage/film looks, (10) Color keying for transparency. Provides: chromakey and colorkey filters, LUT application (lut3d), curves and levels adjustment, color balance, selective color manipulation, color space handling, HDR tone mapping, professional color grading chains.

David-Li0406/meta-skill-evloving

Convert files and office documents to Markdown. Supports PDF, DOCX, PPTX, XLSX, images (with OCR), audio (with transcription), HTML, CSV, JSON, XML, ZIP, YouTube URLs, EPubs and more.

David-Li0406/meta-skill-evloving

Build with OpenAI's stateless APIs - Chat Completions (GPT-5, GPT-4o), Embeddings, Images (DALL-E 3), Audio (Whisper + TTS), and Moderation. Includes Node.js SDK and fetch-based approaches for Cloudflare Workers. Use when: implementing chat completions with GPT-5/GPT-4o, streaming responses with SSE, using function calling/tools, creating structured outputs with JSON schemas, generating embeddings for RAG (text-embedding-3-small/large), generating images with DALL-E 3, editing images with GPT-Image-1, transcribing audio with Whisper, synthesizing speech with TTS (11 voices), moderating content (11 safety categories), or troubleshooting rate limits (429), invalid API keys (401), function calling failures, streaming parse errors, embeddings dimension mismatches, or token limit exceeded.

David-Li0406/meta-skill-evloving

Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.

David-Li0406/meta-skill-evloving

Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks

David-Li0406/meta-skill-evloving

Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas

David-Li0406/meta-skill-evloving

Download YouTube videos with customizable quality and format options. Use this skill when the user asks to download, save, or grab YouTube videos. Supports various quality settings (best, 1080p, 720p, 480p, 360p), multiple formats (mp4, webm, mkv), and audio-only downloads as MP3.

David-Li0406/meta-skill-evloving

Best practices for Remotion - Video creation in React

David-Li0406/meta-skill-evloving

Provides bidirectional translation (Chinese/English), grammar checking, and sentence polishing. Supports specific tense constraints, context-aware tone adjustment, and natural expression optimization. Outputs direct text without formatting.

David-Li0406/meta-skill-evloving

指导如何通过自定义注解(如@Unicom)标识Dubbo接口,利用BeanDefinitionRegistryPostProcessor在启动时扫描并动态注册ReferenceBean,实现RPC调用的封装。

David-Li0406/meta-skill-evloving

生成Python脚本,利用FFmpeg将图片序列按3x3布局合并,或将合并图拆分。要求使用subprocess模块执行命令,并支持用户交互式输入路径。

David-Li0406/meta-skill-evloving

SOP for extracting and analyzing promotional activity details, handling time formatting, location mapping, payment logic, and step-by-step process validation.

David-Li0406/meta-skill-evloving

Specializes in creating TikTok short video scripts using an anthropomorphic 'Chef' perspective to explain wildlife food chains and survival environments, utilizing real field footage.

David-Li0406/meta-skill-evloving

针对TikTok平台,以拟人化视角(如动物作为厨师)创作系列短视频脚本。重点介绍野生动物、食物链及生态环境,要求使用野外实拍素材,风格幽默且具有教育意义。

David-Li0406/meta-skill-evloving

Generates KWL (Know, Want to know, Learned) charts for educational videos, specifically BrainPOP, using simple 7th-grade language and short, concise bullet points.

David-Li0406/meta-skill-evloving

Develops DAX measures to calculate promo and regular volumes and generates a calculated table of dates excluding continuous promo date ranges, handling multiple periods and nulls.

David-Li0406/meta-skill-evloving

Tracks complex, multi-session work using the Beads issue tracker and dependency graphs, and provides persistent memory that survives conversation compaction. Use when work spans multiple sessions, has complex dependencies, or needs persistent context across compaction cycles. Trigger with phrases like "create task for", "what's ready to work on", "show task", "track this work", "what's blocking", or "update status".

相關技能