Back to MCP directory
publicPublicdnsLocal runtime

MyMcpServer

一个基于TypeScript的MCP服务器,实现了简单的笔记系统,提供资源管理、创建笔记和生成摘要等功能。

article

README

🚀 MyMcpServer MCP 服务器

MyMcpServer 是一个基于 TypeScript 的 MCP 服务器,实现了一个简单的笔记系统。它以直观的方式演示了核心的 MCP 概念,帮助用户更好地理解和运用 MCP 技术。

🚀 快速开始

MyMcpServer 是一个基于 TypeScript 的 MCP 服务器,实现了一个简单的笔记系统。它通过资源表示、工具操作和提示生成等方式,演示了核心的 MCP 概念。

✨ 主要特性

资源

  • 可列出和访问带有 note:// URI 的笔记,方便对笔记进行管理和检索。
  • 每个笔记都包含标题、内容和元数据,为笔记提供了丰富的描述信息。
  • 使用简单的纯文本 MIME 类型进行内容访问,确保数据的简洁性和通用性。

工具

  • create_note:用于创建新的文本笔记。
    • 接受标题和内容作为必填参数,确保笔记信息的完整性。
    • 将笔记存储在服务器状态中,便于后续的管理和使用。

提示

  • summarize_notes:生成所有存储笔记的摘要。
    • 包括所有笔记内容作为嵌入式资源,为总结提供全面的数据支持。
    • 返回结构化的提示以供 LLM 进行总结,提高总结的效率和准确性。

📦 安装指南

开发环境安装

安装依赖:

npm install

构建服务器:

npm run build

使用自动重建进行开发:

npm run watch

与 Claude Desktop 一起使用的安装

要与 Claude Desktop 一起使用,请添加服务器配置:

在 MacOS 上:~/Library/Application Support/Claude/claude_desktop_config.json 在 Windows 上:%APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "MyMcpServer": {
      "command": "/path/to/MyMcpServer/build/index.js"
    }
  }
}

调试

由于 MCP 服务器通过 stdio 进行通信,调试可能会具有挑战性。我们推荐使用 MCP Inspector,它作为包脚本可用:

npm run inspector

Inspector 将提供一个访问浏览器中的调试工具的 URL。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client