演示真實執行紀錄 · claude-sonnet-5-5 · 2026年10月
I am new to Claude Code and want to learn how to build an MCP server that connects to an external API. Give me a concise starting path and, if there is a strong matching Claude Academy resource, recommend it according to the academy-guide skill.
Skill: academy-guide
Starting path for an MCP server that wraps an external API
- Learn the model. An MCP server exposes tools (actions Claude can call), resources (readable data) and prompts (reusable templates). For an API wrapper, you'll mostly write tools.
- Pick an SDK. Use the official TypeScript SDK (
@modelcontextprotocol/sdk) or the Python SDK (mcp, with itsFastMCPhelper). Python'sFastMCPis the quickest to start with. - Build one tool first. Choose a single read-only API endpoint, such as "get weather" or "search issues". Give the tool:
- a clear name and description, because Claude uses these to decide when to call it
- typed input parameters
- a short, readable result, not the raw JSON dump
- Handle the API details. Read the API key from an environment variable and never hardcode it. Return clear error messages when a call fails, and respect the API's rate limits.
- Use stdio transport for local development. Your server runs as a subprocess, and Claude Code talks to it over stdin/stdout. Never
print()to stdout in a stdio server, because that corrupts the protocol. Log to stderr instead. - Register it with Claude Code.
Then runclaude mcp add my-api -e API_KEY=xxx -- python /path/to/server.py/mcpinside Claude Code to confirm it connected, and ask Claude to use your tool. - Debug with the MCP Inspector. Run
npx @modelcontextprotocol/inspectorto call your tools directly without Claude in the loop. - Expand. Add more endpoints, then consider remote (HTTP) transport and OAuth if you want to share the server.
A good first session is to ask Claude Code to scaffold the server for the API you have in mind. Paste in the API docs link and ask it to build one tool, then test it with the Inspector.
You might also find the Claude Code hub on Claude Academy helpful. It collects the learning material for Claude Code. The resources library is searchable if you want something specific to MCP.
Real run recorded with claude-code / claude-sonnet-5-5. Output is shown verbatim, unmodified.
它做什麼
協助代理為 Claude 產品或 AI 工作流程問題補充相關的 Claude Academy 課程、教學、使用案例或產品中心連結。
運作方式
- 先直接回答使用者的問題。
- 僅在使用者確實想學習時查詢最新 Academy 目錄。
- 只有在意圖高度相符時才加入最多兩個原樣連結;否則不推薦或導向產品中心。
適合情境
產品入門、培訓教材、功能學習與團隊推廣問題。
說明與風險
純指令檔,沒有指令碼,也不會寫入檔案。為了提供特定建議,它會取得公開的最新 Claude Academy 目錄;需要網路存取但不需憑證。不應虛構課程名稱或連結。
SKILL.md 原文套件內共 2 個檔案