Back to MCP directory
publicPublicdnsLocal runtime

weather-server-mcp-server

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

article

README

🚀 天气服务器 MCP 服务器

这是一个基于 TypeScript 的 MCP 服务器,实现了简单的笔记系统。该项目通过特定方式展示了核心的 MCP 概念,能通过 note:// URI 列出和访问带有元数据的文本笔记,提供创建新笔记的工具,还能生成所有存储笔记的摘要提示。

🚀 快速开始

开发步骤

  1. 安装依赖
npm install
  1. 构建服务器
npm run build
  1. 使用自动重建进行开发
npm run watch

安装配置

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

  • 在 MacOS 上:~/Library/Application Support/Claude/claude_desktop_config.json
  • 在 Windows 上:%APPDATA%/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "weather-server": {
      "command": "/path/to/weather-server/build/index.js"
    }
  }
}

调试建议

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

npm run inspector

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

✨ 主要特性

资源管理

  • 通过 note:// URI 列出和访问笔记。
  • 每个笔记都有标题、内容和元数据。
  • 使用简单的纯文本 MIME 类型进行内容访问。

工具功能

  • create_note - 创建新的文本笔记:
    • 接受标题和内容作为必填参数。
    • 将笔记存储在服务器状态中。

提示生成

  • summarize_notes - 生成所有存储笔记的摘要:
    • 包括所有笔记内容作为嵌入式资源。
    • 返回结构化的提示以供 LLM 进行摘要。

📦 安装指南

要与 Claude Desktop 配合使用,需在相应系统的配置文件中添加服务器配置。

  • MacOS:在 ~/Library/Application Support/Claude/claude_desktop_config.json 中添加配置。
  • Windows:在 %APPDATA%/Claude/claude_desktop_config.json 中添加配置。

配置内容如下:

{
  "mcpServers": {
    "weather-server": {
      "command": "/path/to/weather-server/build/index.js"
    }
  }
}

💻 使用示例

基础用法

安装依赖

npm install

构建服务器

npm run build

开发模式

npm run watch

高级用法

调试服务器

npm run inspector

此命令会启动 MCP 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