MCP Tutorials

MCP Tutorials

Okay, here's a translation of "Tutorial for MCP Server" into Chinese, along with some options depending on the specific nuance you want to convey: **Option 1 (Most General):** * **MCP服务器教程 (MCP fúwùqì jiàochéng)** - This is a straightforward and common translation. It means "MCP Server Tutorial." **Option 2 (More Emphasis on "How To"):** * **如何搭建MCP服务器 (Rúhé dājiàn MCP fúwùqì)** - This translates to "How to Set Up an MCP Server." It's good if the tutorial focuses on the practical steps of setting up the server. **Option 3 (More Emphasis on "Guide"):** * **MCP服务器指南 (MCP fúwùqì zhǐnán)** - This translates to "MCP Server Guide." It suggests a more comprehensive and informative resource. **Option 4 (If the tutorial is for modding):** * **MCP服务器模组开发教程 (MCP fúwùqì mózǔ kāifā jiàochéng)** - This translates to "MCP Server Mod Development Tutorial." Use this if the tutorial is specifically about creating mods for an MCP server. **Which option is best depends on the content of the tutorial.** If it's a general guide on setting up and using an MCP server, Option 1 or 3 is suitable. If it's a step-by-step setup guide, Option 2 is better. If it's about modding, use Option 4. Therefore, without knowing the exact content, I recommend using **MCP服务器教程 (MCP fúwùqì jiàochéng)** as the safest and most general translation.

kwonci

开发者工具
访问服务器

README

MCP 教程

参考

https://modelcontextprotocol.io/quickstart/server

  • [v] 通过 cline 使用教程中提供的 mcp 服务器
  1. cline 中出现错误,推测 cline 在输出 debug level 的日志时,将成功的错误也输出到了 stderr,将 loglevel 设置为 error 后解决(链接
  • [] Tools 中 argument 的说明没有正确显示,需要确认是否是问题
  • [v] 重新安装 Python linter 和 formatter (-> 使用 ruff 安装)

并没有不使用 API 请求。(我的请求 + MCP 服务器提供的 tools)由 LLM 观察并判断,然后自动执行,在此过程中发生了 2 次 API 请求。$0.05, $0.03。总之,可以看出它很好地利用了 tools 来获取信息。

  1. 确认示例
  • filesystem: 使用 tools
  • drive: 使用 resources。-> resources 可以实现的所有操作也可以通过 tools 实现,但提供了不同的抽象(可以理解为 REST API 的 GET 和 POST 的区别)

添加示例

理解 Python SDK 中的内容

https://github.com/modelcontextprotocol/python-sdk

  1. Resource 的定义

https://modelcontextprotocol.io/docs/concepts/resources#resource-templates

MCP 服务器希望提供给 MCP 客户端的任何类型的数据。

  • Resource discovery(MCP 客户端如何发现 MCP 服务器上可用的 resource)
    • direct resources: 通过 resources/list 端点以以下格式暴露资源
{
  uri: string;  // 资源的唯一标识符
  name: string; // 资源的人类可读名称
  description?: string; // 可选的描述
  mimeType?: string; // 可选的 mimetype
}
  • resource templates: 通过 uritemplate 暴露资源
{
  uriTemplate: string;   // 遵循 RFC 6570 的 URI 模板
  name: string;          // 此类型的人类可读名称
  description?: string;  // 可选的描述
  mimeType?: string;     // 所有匹配资源的可选 MIME 类型
}
  • 如果 MCP 客户端通过 resource discovery 从 mcp 服务器加载了可用的 resources,那么如何调用它们?
    • 定义 resource read handler 的方法有两种
      • 通过 @mcp.resource() 装饰器定义,接收 uri 作为输入
      • 或者通过 @mcp.resource(uri_template) 定义

总结一下,mcpserver 通过直接或通过模板暴露资源的 URI,从而实现 resource discovery。mcpclients 在发现可用的 resource 后,可以通过 URI 请求该资源。

  1. Prompts 定义

提供符合目的的 prompts:向服务器提供可重用的 prompts 模板,从而为 LLM 交互提供标准化的方法(用户控制,并且用户可以显式选择 prompts 是其意图)

需要实现的 API

  • prompts discovery

    • returns: (name, description, arguments)
  • prompts usage

    • args: (name, arguments declared in prompts)
    • returns: prompts(dynamic(基于 resource 的 prompts), 也可以是 multiple)
  1. 返回图像

存在图像返回功能

推荐服务器

Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
MCP Package Docs Server

MCP Package Docs Server

促进大型语言模型高效访问和获取 Go、Python 和 NPM 包的结构化文档,通过多语言支持和性能优化来增强软件开发。

精选
本地
TypeScript
Claude Code MCP

Claude Code MCP

一个实现了 Claude Code 作为模型上下文协议(Model Context Protocol, MCP)服务器的方案,它可以通过标准化的 MCP 接口来使用 Claude 的软件工程能力(代码生成、编辑、审查和文件操作)。

精选
本地
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

用于任务管理的模型上下文协议服务器。它允许 Claude Desktop(或任何 MCP 客户端)在基于队列的系统中管理和执行任务。

精选
本地
JavaScript
mermaid-mcp-server

mermaid-mcp-server

一个模型上下文协议 (MCP) 服务器,用于将 Mermaid 图表转换为 PNG 图像。

精选
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP 服务器向 AI 编码助手(如 Cursor)提供 Jira 工单信息。

精选
TypeScript
Linear MCP Server

Linear MCP Server

一个模型上下文协议(Model Context Protocol)服务器,它与 Linear 的问题跟踪系统集成,允许大型语言模型(LLM)通过自然语言交互来创建、更新、搜索和评论 Linear 问题。

精选
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

这个服务器通过将复杂问题分解为顺序步骤来促进结构化的问题解决,支持修订,并通过完整的 MCP 集成来实现多条解决方案路径。

精选
Python
Curri MCP Server

Curri MCP Server

通过管理文本笔记、提供笔记创建工具以及使用结构化提示生成摘要,从而实现与 Curri API 的交互。

官方
本地
JavaScript