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

@qwe8652591/rules-fetch

v0.1.3

Published

MCP服务器用于文档获取,支持Git获取内容

Downloads

4

Readme

Git-Fetch MCP 服务器

这是一个基于MCP(Meta Content Protocol)协议的文档获取服务器,支持从Git仓库获取内容并复制到本地目录。

功能

  • 从Git仓库获取指定文件或目录
  • 支持指定分支
  • 将获取的内容复制到本地目标路径

安装

# 安装依赖
npm install

# 构建项目
npm run build

使用方法

本地安装后运行

启动服务器:

npm start

或在开发模式下运行:

npm run dev

通过 npx 直接运行

无需安装,可以直接通过 npx 运行:

# 运行最新版本
npx @qwe8652591/rules-fetch

# 运行特定版本
npx @qwe8652591/[email protected]

# 使用模拟模式
USE_MOCK_GIT=true npx @qwe8652591/rules-fetch

提供的工具

git_fetch

从Git仓库获取内容并复制到当前工具目录。

参数:

  • repositoryUrl: Git仓库的URL (必需)
  • branch: 分支名称 (可选)
  • sourcePath: 仓库中源文件的路径 (必需)
  • targetPath: 目标文件路径 (必需)

示例:

{
  "repositoryUrl": "https://github.com/username/repo.git",
  "branch": "main",
  "sourcePath": "docs/README.md",
  "targetPath": "docs/fetched-readme.md"
}

MCP服务器配置

要在AI助手中使用此服务器,您需要在助手的配置中添加以下MCP服务器配置:

Windows配置

{
  "mcpServers": {
    "git-fetch": {
      "command": "cmd",
      "args": ["/c", "node", "{ABSOLUTE_PATH}/dist/index.js"],
      "type": "command",
      "env": {
        "FETCH_TIMEOUT": "30000",
        "NODE_ENV": "production"
      },
      "logLevel": "info",
      "autoApprove": ["git_fetch"]
    }
  }
}

macOS/Linux配置

{
  "mcpServers": {
    "git-fetch": {
      "command": "node",
      "args": ["{ABSOLUTE_PATH}/dist/index.js"],
      "type": "command",
      "env": {
        "FETCH_TIMEOUT": "30000",
        "NODE_ENV": "production"
      },
      "logLevel": "info",
      "autoApprove": ["git_fetch"]
    }
  }
}

Docker配置

{
  "mcpServers": {
    "git-fetch": {
      "command": "docker",
      "args": ["run", "-i", "git-fetch-mcp"],
      "type": "command",
      "env": {
        "FETCH_TIMEOUT": "30000"
      },
      "logLevel": "info",
      "autoApprove": ["git_fetch"]
    }
  }
}

配置参数说明

  • command: 启动MCP服务器的命令
  • args: 传递给command的参数列表
    • {ABSOLUTE_PATH} 应替换为实际的绝对路径
  • type: 通信协议类型,这里使用"command"通过标准输入输出与本地进程通信
  • env: 环境变量配置
    • FETCH_TIMEOUT: 请求超时时间(毫秒)
    • NODE_ENV: 运行环境
  • logLevel: 日志级别(debug/info/warn/error)
  • autoApprove: 自动批准的工具列表,无需每次都确认

与AI助手集成

此MCP服务器可以与支持MCP协议的AI助手集成,使它们能够:

  1. 发现服务器提供的git_fetch工具
  2. 调用该工具获取Git仓库中的内容
  3. 使用获取的内容进行进一步处理或向用户提供响应

开发

如果需要添加更多功能,可以在src/目录下创建新的工具类,并在index.ts中注册。

发布到 npm

本项目支持发布到 npm 仓库,详细的发布流程请查看 NPM发布指南

简要步骤:

# 登录 npm
npm login

# 构建项目(也可以跳过,因为 prepublishOnly 会自动构建)
npm run build

# 发布公开包
npm publish --access public

# 更新版本并发布
npm version patch  # 或 minor 或 major
npm publish --access public

许可证

MIT