Token导航 LogoToken导航

Agent Skill · 开发

build-mcp-server-sdk-v1(构建 MCP server SDK V1)

build-mcp-server-sdk-v1 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

build-mcp-server-sdk-v1 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描有提醒项,按安装量在开发类的 21,746 个 Skill 里排第 19,422。

总安装 272周安装 11GitHub Stars 5下载 85核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:build-mcp-server-sdk-v1(构建 MCP server SDK V1)
来源仓库:https://github.com/yigitkonur/skills-by-yigitkonur
仓库路径:skills/build-mcp-server-sdk-v1
安装命令:
npx skills add https://github.com/yigitkonur/skills-by-yigitkonur --skill build-mcp-server-sdk-v1
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/yigitkonur/skills-by-yigitkonur --skill build-mcp-server-sdk-v1

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

基于 @modelcontextprotocol/sdk v1.x 构建单包式 MCP 服务器。使用 McpServer 类注册工具、资源与提示词处理器。协议版本锁定 2025-11-25,Zod 校验 schema 定义。若检测到 split-package 结构则切换至 v2 技能分支。

build-mcp-server-sdk-v1 属于开发类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/build-mcp-server-sdk-v1

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/yigitkonur/skills-by-yigitkonur --skill build-…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

build-mcp-server-sdk-v1 怎么安装?

在终端执行 npx skills add https://github.com/yigitkonur/skills-by-yigitkonur --skill build-mcp-server…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

build-mcp-server-sdk-v1 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

build-mcp-server-sdk-v1 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

build-mcp-server-sdk-v1 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

build-mcp-server-sdk-v1 用的人多吗?

公开数据是累计安装 272 次,近一周安装 11 次,下载 85 次,GitHub 5 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

build-mcp-server-sdk-v1 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
build-mcp-server-sdk-v1

构建 MCP server SDK V1 · 本页

2725接触敏感数据未明确有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Build MCP Server (SDK v1)

Build and maintain MCP servers using @modelcontextprotocol/sdk v1.x (single package, Zod-based, protocol version 2025-11-25). Covers McpServer, registerTool, registerResource, registerPrompt, transports, OAuth 2.1, sessions, and deployment.

When to use a different skill instead:

  • Imports from @modelcontextprotocol/server (split packages) → use build-mcp-server-sdk-v2
  • Handlers use ctx.mcpReq instead of flat extra → use build-mcp-server-sdk-v2
  • Uses the mcp-use wrapper library → use build-mcp-use-server
  • Auditing/optimizing an existing server → use optimize-agentic-mcp

How to detect v1: @modelcontextprotocol/sdk (single package) in package.json. Handlers use (args, extra) with extra.sendNotification, extra.authInfo, extra.signal at the top level.

Core rules:

  • Always use McpServer — the Server class is deprecated for direct use
  • Always use registerTool / registerResource / registerPrompt — positional tool() / resource() / prompt() overloads are deprecated
  • Always use zod for input/output schemas — the SDK converts them to JSON Schema 2020-12 automatically
  • Always use StreamableHTTPServerTransport for HTTP — SSEServerTransport is deprecated
  • Access server.server only for sampling, elicitation, resource subscriptions, or custom protocol extensions
  • Tool names SHOULD be 1-128 chars using letters, digits, underscore, hyphen, dot
  • Input validation errors SHOULD be returned as tool execution errors (isError: true) not protocol errors — enables LLM self-correction

Workflow

1 — Detect what exists

Run tree -L 3 and ls package.json tsconfig.json in the project directory. Look for:

  • @modelcontextprotocol/sdk in package.json dependencies → existing MCP server
  • mcp-use in dependencies → wrong skill, redirect to build-mcp-use-server
  • .mcp.json or mcp key in package.json → MCP client config, not server code
  • src/ with tool/resource handler files → existing implementation to extend

Summarize: existing server (go to Step 2A) or new server (go to Step 2B).

2A — Audit an existing SDK server

When an MCP server already exists, do not rebuild. Read the implementation and assess:

  • Which API style is used? If deprecated tool() / resource(), migrate to registerTool / registerResource
  • Are Zod schemas defined for all tool inputs? If raw JSON Schema objects, convert to Zod
  • Is the transport current? If SSEServerTransport, migrate to StreamableHTTPServerTransport
  • Are tool annotations set? Add readOnlyHint, destructiveHint, idempotentHint, openWorldHint where missing
  • Does the server validate Origin header for HTTP transport? Add createMcpExpressApp() or hostHeaderValidation
  • Does the server declare capabilities correctly during initialization? Check tools, resources, prompts, logging

Then proceed to the user's requested changes (add tools, fix bugs, add auth, etc.).

2B — Scope a new server

Ask or infer from context:

  1. What does the server wrap? (API, database, file system, CLI tool, etc.)
  2. Transport? stdio for local CLI integration, Streamable HTTP for remote/multi-client
  3. Auth needed? Bearer token, OAuth 2.1, or none (local stdio)
  4. Tools, resources, or prompts? Most servers need tools; resources for data access; prompts for reusable templates
  5. Client features needed? Sampling (LLM completions), elicitation (user input), roots (filesystem access)

3 — Choose the implementation branch

ScenarioAction
New stdio serverScaffold from quick-start template → references/guides/quick-start.md
New HTTP server (stateful)Scaffold with session management → references/guides/transports.md
New HTTP server (stateless)Scaffold without sessions → references/guides/transports.md
Add tools to existing serverRead references/guides/tools-and-schemas.md, register new tools
Add resourcesRead references/guides/resources-and-prompts.md
Add authenticationRead references/guides/authentication.md
Add sampling or elicitationRead references/guides/sessions-and-lifecycle.md
Deploy to productionRead references/patterns/deployment.md
Understand the MCP protocolRead references/guides/protocol-spec.md

4 — Preflight setup

Before writing server code, confirm:

  • Node.js 18+ installed (required for globalThis.crypto)
  • npm install @modelcontextprotocol/sdk zod — both are required
  • TypeScript 5+ with "moduleResolution": "node16" or "nodenext" in tsconfig
  • If HTTP transport: npm install express (Express 5 recommended)

5 — Build or extend the server

Default implementation sequence:

  1. Create McpServer instance with name, version, and optional description/icons
  2. Define Zod schemas for each tool's input (and output if structuredContent is needed)
  3. Register tools with server.registerTool() — input schema, annotations, async handler
  4. Register resources with server.registerResource() if the server exposes data
  5. Register prompts with server.registerPrompt() if the server provides templates
  6. Create transport and connect: await server.connect(transport)
  7. Handle graceful shutdown with process.on('SIGINT',...)

Refer to references/examples/server-recipes.md for complete working examples.

6 — Validate

  • stdio: Test with npx @anthropic-ai/mcp-inspector or pipe JSON-RPC messages directly
  • HTTP: Start the server, then test with curl or the MCP Inspector
  • Tool schemas: Verify Zod validation catches bad input (pass invalid args, confirm error response)
  • Annotations: Check that readOnlyHint / destructiveHint are accurate for each tool
  • Capabilities: Verify the server declares the correct capabilities during initialization

Quick start — minimal stdio server

import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";

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

server.registerTool("greet", {
  description: "Greet a user by name",
  inputSchema: { name: z.string().describe("The user's name") },
  annotations: { readOnlyHint: true, destructiveHint: false },
}, async ({ name }) => ({
  content: [{ type: "text", text: `Hello, ${name}!` }],
}));

const transport = new StdioServerTransport();
await server.connect(transport);

Core API summary

McpServer

new McpServer(
  { name: string, version: string, description?: string, icons?: Icon[] },
  { capabilities?: ServerCapabilities, instructions?: string }
)

server.connect(transport: Transport): Promise<void>
server.close(): Promise<void>
server.registerTool(name, config, handler): RegisteredTool
server.registerResource(name, uri | template, config, handler): RegisteredResource
server.registerPrompt(name, config, handler): RegisteredPrompt
server.sendToolListChanged(): void
server.sendResourceListChanged(): void
server.sendPromptListChanged(): void
server.sendLoggingMessage(params): Promise<void>

registerTool config

{
  title?: string,              // Human-readable display name
  description?: string,        // LLM reads this to decide when to call the tool
  inputSchema?: ZodRawShape | ZodSchema,
  outputSchema?: ZodRawShape | ZodSchema,   // Enables structuredContent validation
  annotations?: {
    readOnlyHint?: boolean,    // Does not modify state
    destructiveHint?: boolean, // May delete/modify data
    idempotentHint?: boolean,  // Repeated calls safe
    openWorldHint?: boolean,   // Interacts with external services
  },
  icons?: Icon[],              // Visual identifier (2025-11-25)
}

CallToolResult

{
  content: Array<
    | { type: "text", text: string }
    | { type: "image", data: string, mimeType: string }
    | { type: "audio", data: string, mimeType: string }
    | { type: "resource", resource: { uri: string, text?: string, blob?: string } }
    | { type: "resource_link", uri: string, name?: string, description?: string }
  >,
  structuredContent?: Record<string, unknown>,
  isError?: boolean,
}

RequestHandlerExtra (v1.x)

Every handler receives extra as the last argument:

{
  signal: AbortSignal,         // For cooperative cancellation
  authInfo?: AuthInfo,         // From OAuth middleware
  sessionId?: string,          // Current session ID
  requestId: RequestId,        // JSON-RPC request ID
  requestInfo?: RequestInfo,   // Original HTTP request metadata
  _meta?: RequestMeta,         // Protocol-level metadata
  sendNotification: (notification) => Promise<void>,
  sendRequest: (request, schema, options?) => Promise<Result>,
}

Note: In v2 alpha, this becomes ServerContext with a restructured API. See references/guides/v2-migration.md.

Error handling

import { McpError, ErrorCode } from "@modelcontextprotocol/sdk/types.js";

// Hard protocol errors (tool not found, bad params):
throw new McpError(ErrorCode.InvalidParams, "Missing required field: query");

// Soft tool errors (API failures the LLM can handle):
return { content: [{ type: "text", text: "Error: rate limit exceeded" }], isError: true };

Per spec: input validation errors SHOULD use isError: true (tool execution errors) rather than protocol errors — this enables model self-correction.

Decision rules

  • Prefer ZodRawShape ({name: z.string()}) for simple inputs — use full z.object() only for transforms, refinements, or discriminated unions
  • Prefer isError: true soft errors over thrown McpError for recoverable failures — LLMs handle soft errors better
  • Prefer stdio for local-only servers — zero infrastructure, single client
  • Prefer Streamable HTTP for remote or multi-client servers
  • Prefer stateful HTTP (with sessionIdGenerator) when the server needs progress notifications, resumability, or multi-turn context
  • Prefer stateless HTTP (sessionIdGenerator: undefined) for simple request-response tools
  • Set annotations on every tool — LLMs use them to decide execution safety; treat annotations as untrusted unless from a trusted server
  • Use server.server (the underlying Server) only when McpServer lacks the method you need
  • Use outputSchema when the tool must return validated structured data alongside text content
  • Tool names: use service_action_resource format (e.g. github_search_repos), 1-128 characters

Guardrails

  • Never use the deprecated tool(), resource(), or prompt() positional-argument methods
  • Never use the deprecated SSEServerTransport in new servers
  • Never use the deprecated Server class directly — always go through McpServer
  • Never expose internal error details to clients — return user-friendly error messages
  • Never skip zod schemas for tool inputs — unvalidated input is a security risk
  • Never hardcode secrets — use environment variables for API keys and tokens
  • Never omit graceful shutdown handling for HTTP servers
  • Never run HTTP servers on localhost without DNS rebinding protection (createMcpExpressApp() or hostHeaderValidation middleware)
  • Never use inputSchema: null — for parameterless tools, omit inputSchema entirely
  • Servers MUST validate Origin header on HTTP transport to prevent DNS rebinding; respond with 403 for invalid origins

Reference routing

Use the smallest relevant set for the branch of work.

Start here

ReferenceWhen to read
references/guides/quick-start.mdScaffolding a new server from scratch
references/guides/tools-and-schemas.mdRegistering tools, defining Zod schemas, handling tool results
references/guides/transports.mdChoosing and configuring stdio, Streamable HTTP, or SSE (legacy)

Server capabilities

ReferenceWhen to read
references/guides/resources-and-prompts.mdAdding resources (static/template URI) or prompts
references/guides/authentication.mdAdding OAuth 2.1, bearer tokens, or custom auth
references/guides/client-api.mdBuilding MCP clients — connecting, calling tools, reading resources, auth, sampling
references/guides/sessions-and-lifecycle.mdManaging sessions, sampling, elicitation, resumability, graceful shutdown
references/guides/experimental-tasks.mdDurable long-running tool operations — registerToolTask, InMemoryTaskStore, callToolStream
references/guides/protocol-spec.mdUnderstanding protocol lifecycle, capabilities, message format, security requirements
references/guides/v2-migration.mdPlanning for v2 alpha migration — package split, Standard Schema, ServerContext, framework adapters

Build and ship

ReferenceWhen to read
references/examples/server-recipes.mdCopy-paste working server examples for common patterns
references/patterns/deployment.mdDeploying to production (Docker, serverless, cloud)
references/patterns/production-patterns.mdLogging, error handling, rate limiting, monitoring
references/patterns/anti-patterns.mdCommon mistakes and how to fix them

Specification Enhancement Proposals (SEPs)

ReferenceWhen to read
references/seps/overview.mdUnderstanding what SEPs exist and their developer impact
references/seps/auth-security.mdImplementing OAuth flows, enterprise auth, URL elicitation, client security
references/seps/tools-metadata.mdTool naming rules, icons, validation errors, sampling with tools, tasks, tracing
references/seps/protocol-transport.mdJSON Schema dialect, SSE polling, extensions framework, elicitation improvements, MCP Apps
references/seps/upcoming.mdAccepted SEPs not yet Final — upcoming breaking changes to prepare for

Why migrate to v2?

v2 (@modelcontextprotocol/server + @modelcontextprotocol/client) shipped in early 2026. Key benefits over v1:

  • Structured handler context — ctx.mcpReq.log(), ctx.mcpReq.elicitInput(), ctx.mcpReq.requestSampling() replace manual extra.sendRequest() calls
  • Framework adapters — createMcpExpressApp() and createMcpHonoApp() from dedicated packages instead of manual wiring
  • Standard Schema support — use Zod v4, Valibot, or ArkType for tool schemas (not locked to Zod)
  • JSON Schema 2020-12 by default — v1 defaults to Draft-7 via zod-to-json-schema; v2 uses native z.toJSONSchema()
  • Better auth — client middleware system (withOAuth, withLogging, applyMiddlewares), grant-agnostic prepareTokenRequest(), discovery caching
  • Smaller bundles — split packages mean you only install what you use
  • ESM-only — cleaner module resolution, no CJS baggage

Community adoption is still early (Q1 2026 release). Most production servers remain on v1.x. See references/guides/v2-migration.md for the full source-verified migration guide, or use build-mcp-server-sdk-v2 for new v2 projects.

Compatibility note

This skill targets @modelcontextprotocol/sdk v1.x (stable, v1.x branch). Source-verified against the TypeScript SDK repository.

Key 2025-11-25 spec additions: icons for tools/resources/prompts, tool name guidance (SEP-986), URL-mode elicitation (SEP-1036), tool calling in sampling (SEP-1577), experimental tasks (SEP-1686), JSON Schema 2020-12 as default dialect (SEP-1613), extensions framework (SEP-2133).

平台分布

Codex

32.5%
按下载量换算28

Claude

29.4%
按下载量换算25

Cursor

19.53%
按下载量换算17

Gemini CLI

9.82%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills