npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@hyou/my_mcp_server

v1.0.3

Published

## 项目简介

Readme

my_mcp_server

项目简介

my_mcp_server 是一个基于 Model Context Protocol (MCP) 的服务器,提供了多种实用工具,包括天气查询、文件系统操作和 Flutter 应用打包功能。

功能特性

  • 天气工具:获取美国各州的天气预警信息和特定位置的天气预报
  • 文件系统工具:列出目录内容、读取文件和写入文件
  • Flutter 工具:根据指定的类型、模式和环境构建 Flutter 应用

安装

前提条件

  • Node.js 18.0 或更高版本
  • npm 9.0 或更高版本

安装步骤

  1. 克隆仓库
git clone https://github.com/yourusername/my_mcp_server.git
cd my_mcp_server
  1. 安装依赖
npm install
  1. 构建项目
npm run build

使用方法

启动服务器

npm start

服务器将在标准输入/输出上运行,等待 MCP 客户端的连接。

通过 JSON 配置文件配置到支持 MCP 的 AI 工具

许多支持 MCP 的 AI 工具允许通过 JSON 配置文件来添加自定义 MCP 服务器。以下是标准的 MCP server 配置格式:

  1. 在你的配置文件中添加以下内容:
{
  "mcpServers": {
    "my_mcp_server": {
      "command": "npx",
      "args": [
        "@hyou/my_mcp_server"
      ]
    }
  }
}
  1. 根据你使用的 AI 工具的说明,将此配置添加到相应的配置文件中。

  2. 保存配置后,AI 工具应该能够识别并使用 my_mcp_server 提供的所有工具。

配置说明

  • mcpServers:MCP 服务器配置的根节点
  • my_mcp_server:服务器的名称,可自定义
  • command:执行命令,使用 npx
  • args:命令参数数组,包含包名 @hyou/my_mcp_server

不同的 AI 工具可能有略微不同的配置格式,请参考你使用的具体工具的文档进行调整。

工具详情

天气工具

get-alerts

  • 功能:获取指定州的天气预警信息
  • 参数
    • state:两字母州代码(例如:CA, NY)
  • 返回:该州的天气预警信息列表

get-forecast

  • 功能:获取指定位置的天气预报
  • 参数
    • latitude:位置的纬度
    • longitude:位置的经度
  • 返回:该位置的天气预报信息

文件系统工具

list-files

  • 功能:列出指定目录中的文件和子目录
  • 参数
    • directory:要列出文件的目录路径
  • 返回:目录中的文件和子目录列表

read-file

  • 功能:读取指定文件的内容
  • 参数
    • file_path:要读取的文件路径
  • 返回:文件的内容

write-file

  • 功能:向指定文件写入内容
  • 参数
    • file_path:要写入的文件路径
    • content:要写入文件的内容
  • 返回:写入操作的结果

Flutter 工具

build-flutter

  • 功能:构建 Flutter 应用
  • 参数
    • type:打包类型(apk 或 aab)
    • mode:编译模式(debug、profile 或 release)
    • env:接口环境(test 或 prod)
  • 返回:构建操作的结果和输出文件信息

示例

获取加州的天气预警

// 客户端代码示例
const result = await client.callTool('get-alerts', { state: 'CA' });
console.log(result.content[0].text);

获取纽约市的天气预报

// 客户端代码示例
const result = await client.callTool('get-forecast', {
  latitude: 40.7128,
  longitude: -74.0060
});
console.log(result.content[0].text);

列出目录内容

// 客户端代码示例
const result = await client.callTool('list-files', {
  directory: '/path/to/directory'
});
console.log(result.content[0].text);

构建 Flutter 应用

// 客户端代码示例
const result = await client.callTool('build-flutter', {
  type: 'apk',
  mode: 'release',
  env: 'prod'
});
console.log(result.content[0].text);

技术栈

  • Node.js
  • TypeScript
  • @modelcontextprotocol/sdk
  • commander
  • js-yaml

许可证

ISC 许可证

贡献

欢迎提交问题和拉取请求!

联系方式

如有问题,请通过 GitHub Issues 与我们联系。