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

@artern/git-relay-mcp

v0.1.0

Published

A stdio MCP server that relays a local Git branch to remote agents through clone, head lookup, and patch replay tools.

Readme

Git Relay MCP

English README

Git Relay MCP 是一个基于 stdio 的 MCP Server,设计目标是配合 mcp-proxy 使用,让远端 AI agent 能在不直接访问本地文件系统的前提下,对 NodeG 上某个本地 Git 仓库分支进行克隆、读取 HEAD 和回放补丁。

能力概览

  • clone_tar:对配置好的分支执行深度 1 克隆,移除 origin,再把整个克隆目录打成 tar 并以 base64 返回。
  • get_head:返回当前分支 HEAD 的 commit id 和少量提交元数据。
  • apply_patch_series:把 git format-patch --stdout 产出的 mbox 补丁流通过 git am --3way 回放到目标分支。

使用方式

pnpx mcp-proxy -- pnpx -y @artern/git-relay-mcp --repo /path/to/local-git-repo --branch dev-001

其中:

  • --repo 是标准参数名
  • --local 仍然可用,但只作为兼容别名
  • --branch 必须是本地分支名,且不能是 mastermaindev

启动校验

服务启动时会检查:

  • 仓库路径存在
  • 路径是一个 Git working tree
  • 指定分支存在于本地 refs/heads/
  • 分支名不是 mastermaindev

任何一项不满足,服务都会直接拒绝启动。

典型工作流

  1. NodeG 通过 mcp-proxy 启动本服务。
  2. NodeA 连接该 MCP 服务并调用 clone_tar
  3. NodeA 解包 tar,得到一个可继续提交的浅克隆仓库。
  4. NodeA 在该克隆目录中进行修改和提交。
  5. NodeA 调用 get_head 获取 NodeG 当前分支的 HEAD。
  6. NodeA 基于该 HEAD 执行 git format-patch <head>..HEAD --stdout
  7. NodeA 调用 apply_patch_series,把补丁流和 expectedHead 发回 NodeG。

Tool 契约

clone_tar

输入:{}

输出字段:

  • repoName
  • branch
  • headCommit
  • archiveFormat
  • mediaType
  • encoding
  • shallow
  • depth
  • includesGitDir
  • originPolicy
  • suggestedDirectoryName
  • archiveData

get_head

输入:{}

输出字段:

  • repoName
  • branch
  • headCommit
  • headShortCommit
  • headAuthorName
  • headAuthorEmail
  • headCommittedAt
  • headSubject

apply_patch_series

输入字段:

  • expectedHead:必须精确等于 get_head 返回的 headCommit
  • patchContentgit format-patch --stdout 生成的原始 mbox 文本

输出字段:

  • repoName
  • branch
  • previousHead
  • expectedHead
  • newHead
  • appliedCommitCount
  • appliedCommitIds
  • usedThreeWayMerge
  • workingTreeCleanAfterApply

运行注意事项

  • apply_patch_series 会按仓库分支串行执行,避免并发回放。
  • 如果 git am 中途失败,服务会尽力执行 git am --abort 做清理。
  • 服务可能会在 apply 前把工作区切换到配置的目标分支。
  • tool 结果中不会暴露 NodeG 上的绝对仓库路径。

开发与测试

nvm use 20
pnpm install
pnpm build
pnpm test

当前自动化测试覆盖:

  • 成功链路:clone_target_headapply_patch_series
  • expectedHead 过期拒绝
  • git am 失败后的自动 --abort 回滚
  • 启动时禁止主分支名校验

发布到 npm

npm login
pnpm test
npm publish --access public

当前包名已准备为 @artern/git-relay-mcp

提交到 GitHub 前建议

建议仓库地址使用:

  • https://github.com/artern/git-relay-mcp

当前 package.json 已预置该仓库地址、主页地址和 issue 地址;如果你最终使用了别的仓库名,再同步修改即可。