Communitygithub.com

agencelutie/LP-lutie

构建高质量 MCP(模型上下文协议)服务器的指南,用于使 LLM 能够通过精心设计的工具与外部服务进行交互。在构建集成外部 API 或服务的 MCP 服务器时使用,支持 Python(FastMCP)或 Node/TypeScript(MCP SDK)。

LP-lutie 是什么?

该技能是一份全面的 MCP 服务器开发指南,旨在帮助开发者创建高质量、生产级的 MCP 服务器,使 LLM 能够无缝地与外部服务交互。它详细描述了从深度调研、实现、测试到创建评估的四个核心阶段。指南强调了现代 MCP 设计原则,如平衡 API 覆盖率与工作流工具、清晰的工具命名、上下文管理和可操作错误消息。推荐使用适用于远程服务器的 Streamable HTTP 传输和本地服务器的 stdio 传输。支持 TypeScript(MCP SDK)和 Python(FastMCP)两种栈。其中包含大量关于实现基础设施(API 客户端、错误处理、分页)、使用 Zod/Pydantic 定义严格输入输出模式、添加工具注解以及使用 MCP Inspector 进行本地测试的实践指导。最终,该指南提供了创建10个复杂评估问答对的标准,用于验证 MCP 服务器在实际场景中的有效性。该技能完全基于其详细的 SKILL.md 文档,并为 Cursor 和 Claude Code 等 AI 代理开发者提供了一个从零到一的完整参考。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/agencelutie/LP-lutie/tree/main/skills-export/examples/mcp-builder

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

MCP 服务器开发指南

概述

创建 MCP(模型上下文协议)服务器,使 LLM 能够通过精心设计的工具与外部服务交互。MCP 服务器的质量取决于它如何很好地使 LLM 完成实际任务。


流程

🚀 高级工作流

创建高质量的 MCP 服务器涉及四个主要阶段:

第一阶段:深度调研与规划

1.1 理解现代 MCP 设计

API 覆盖率 vs. 工作流工具: 平衡全面的 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)。

要查看的关键页面:

  • 规范概述与架构
  • 传输机制(可流式 HTTP、stdio)
  • 工具、资源和提示定义

1.3 学习框架文档

推荐技术栈:

  • 语言:TypeScript(高质量的 SDK 支持,且在多种执行环境(如 MCPB)中具有良好兼容性。此外,AI 模型擅长生成 TypeScript 代码,得益于其广泛使用、静态类型和良好的代码检查工具)
  • 传输:远程服务器使用可流式 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.1 设置项目结构

查看特定语言的指南以了解项目设置:

2.2 实现核心基础设施

创建共享工具:

  • 带有身份验证的 API 客户端
  • 错误处理辅助函数
  • 响应格式化(JSON/Markdown)
  • 分页支持

2.3 实现工具

对于每个工具:

输入模式:

  • 使用 Zod(TypeScript)或 Pydantic(Python)
  • 包含约束和清晰的描述
  • 在字段描述中添加示例

输出模式:

  • 尽可能定义 outputSchema 以处理结构化数据
  • 在工具响应中使用 structuredContent(TypeScript SDK 特性)
  • 帮助客户端理解和处理工具输出

工具描述:

  • 功能简洁概述
  • 参数描述
  • 返回类型模式

实现:

  • 使用 async/await 处理 I/O 操作
  • 正确的错误处理,带有可操作的消息
  • 在适用时支持分页
  • 使用现代 SDK 时,返回文本内容和结构化数据

注解:

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

第三阶段:审查与测试

3.1 代码质量

检查以下方面:

  • 无重复代码(DRY 原则)
  • 一致的错误处理
  • 完整的类型覆盖
  • 清晰的工具描述

3.2 构建与测试

TypeScript:

  • 运行 npm run build 以验证编译
  • 使用 MCP Inspector 测试:npx @modelcontextprotocol/inspector

Python:

  • 验证语法:python -m py_compile your_server.py
  • 使用 MCP Inspector 测试

查看特定语言的指南以了解详细的测试方法和质量检查清单。


第四阶段:创建评估

在实现 MCP 服务器后,创建全面的评估以测试其有效性。

加载 ✅ 评估指南 以获取完整的评估指南。

4.1 理解评估目的

使用评估来测试 LLM 是否能够有效地使用你的 MCP 服务器来回答现实、复杂的问题。

4.2 创建 10 个评估问题

要创建有效的评估,请遵循评估指南中概述的流程:

  1. 工具检查:列出可用工具并理解其能力
  2. 内容探索:使用只读操作来探索可用数据
  3. 问题生成:创建 10 个复杂、现实的问题
  4. 答案验证:自己解决每个问题以验证答案

4.3 评估要求

确保每个问题:

  • 独立:不依赖于其他问题
  • 只读:仅需要非破坏性操作
  • 复杂:需要多次工具调用和深度探索
  • 现实:基于人类会关心的真实用例
  • 可验证:单个、清晰的答案,可通过字符串比较验证
  • 稳定:答案不会随时间改变

4.4 输出格式

创建具有以下结构的 XML 文件:

<evaluation>
  <qa_pair>
    <question>Find discussions about AI model launches with animal codenames. One model needed a specific safety designation that uses the format ASL-X. What number X was being determined for the model named after a spotted wild cat?</question>
    <answer>3</answer>
  </qa_pair>
<!-- 更多 qa_pairs... -->
</evaluation>

参考文件

📚 文档库

在开发过程中根据需要加载这些资源:

核心 MCP 文档(首先加载)

  • MCP 协议:从 https://modelcontextprotocol.io/sitemap.xml 的站点地图开始,然后使用 .md 后缀获取特定页面
  • 📋 MCP 最佳实践 - 通用 MCP 指南,包括:
    • 服务器和工具的命名约定
    • 响应格式指南(JSON vs Markdown)
    • 分页最佳实践
    • 传输选择(可流式 HTTP vs stdio)
    • 安全与错误处理标准

SDK 文档(在第一/第二阶段加载)

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

特定语言实现指南(在第二阶段加载)

  • 🐍 Python 实现指南 - 完整的 Python/FastMCP 指南,包括:

    • 服务器初始化模式
    • Pydantic 模型示例
    • 使用 @mcp.tool 注册工具
    • 完整的可运行示例
    • 质量检查清单
  • ⚡ TypeScript 实现指南 - 完整的 TypeScript 指南,包括:

    • 项目结构
    • Zod 模式模式
    • 使用 server.registerTool 注册工具
    • 完整的可运行示例
    • 质量检查清单

评估指南(在第四阶段加载)

  • ✅ 评估指南 - 完整的评估创建指南,包括:
    • 问题创建指南
    • 答案验证策略
    • XML 格式规范
    • 示例问题和答案
    • 使用提供的脚本运行评估

Individual skills in this repo

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

agencelutie/LP-lutie

Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.

agencelutie/LP-lutie

Submit expense reimbursements through Benepass (app.getbenepass.com). For users whose employer uses Benepass as their benefits platform. Handles login, benefit selection, form filling, receipt upload, and submission. Requires browser/computer-use capabilities.

agencelutie/LP-lutie

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

agencelutie/LP-lutie

Make a phone call to book an appointment or reservation. Checks calendar first, gets explicit consent before dialing, discloses AI identity on the call, and adds the booking to calendar when done.

agencelutie/LP-lutie

Cancel a subscription or unsubscribe from a service. Works from a description, a pasted charge line, a URL, or a photo/screenshot. Can also audit a full statement for recurring charges and cancel several at once. Finds the right contact method and handles the cancellation — including phone calls.

agencelutie/LP-lutie

Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.

agencelutie/LP-lutie

Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.

agencelutie/LP-lutie

Help plan an event — from a birthday dinner to a wedding. Scales to the size of the occasion. Handles venue research, guest lists, timelines, vendors, and budgets.

agencelutie/LP-lutie

Help submit an expense or reimbursement on any platform. Detects the right tool (Benepass, Brex, Concur, Expensify, etc.), finds receipts, checks for duplicates, and walks through submission.

agencelutie/LP-lutie

Handle small bureaucratic tasks — jury duty responses, parking tickets, passport renewals, DMV forms, permit applications, and other government or administrative paperwork.

agencelutie/LP-lutie

Run financial calculations and scenario comparisons — tax estimates, loan comparisons, retirement projections, rent vs. buy, investment scenarios, and more. Pure math, no accounts or logins needed.

agencelutie/LP-lutie

Help order groceries for delivery. Concierge-style flow — store selection, occasion-based list building, budget tracking, and cart assembly.

agencelutie/LP-lutie

Help find and book a service provider for a task — cleaning, handyman, moving, assembly, yard work, errands, etc. Searches TaskRabbit, Handy, Thumbtack, and similar platforms.

agencelutie/LP-lutie

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).

agencelutie/LP-lutie

Help order food timed to arrive at a specific time. Works backward from target arrival, suggests restaurants, builds cart, and monitors delivery.

agencelutie/LP-lutie

Refill a prescription at a pharmacy. Works from a medication name, an Rx number, a photo of the bottle, or just "I'm running low." Confirms exactly what's being requested, gathers everything the pharmacy will ask for up front, and handles the refill online or by phone — whichever is fastest.

agencelutie/LP-lutie

Help return an item or request a refund from any retailer. Identifies the item, finds the return policy, navigates the process, and handles shipping labels or phone calls.

agencelutie/LP-lutie

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.

agencelutie/LP-lutie

Landing page quality assessment for paid advertising campaigns. Evaluates message match, page speed, mobile experience, trust signals, form optimization, and conversion rate potential. Use when user says "landing page", "post-click experience", "landing page audit", "conversion rate", or "landing page optimization".

agencelutie/LP-lutie

Generate structured landing page copy with hero, body, proof, and CTA sections. Framework-agnostic - adapts approach based on awareness level and offer type.

相关技能