Skip to main content
Glama
Git 工具
by wudx

zcode-plugin-git

Git workbench side panel for ZCode, built on MCP Apps — review, stage, and commit changes without leaving the chat, with AI-generated commit messages.

English | 简体中文

Features

  • Git side panel — branches, ahead/behind, staged & working-tree changes (renames, conflicts, and untracked files included)

  • List & tree views — collapsible directory tree with single-child chains merged (a/b/c); view preference remembered

  • Diff viewer — inline unified diff per file, switchable side-by-side compare, adjustable context (±10 / ±20 lines / full file), previous/next change navigation, and a minimap overview (add/del coloring, viewport indicator, click/drag to jump)

  • Image compare — image files open as an old-vs-new side-by-side preview across staged / worktree / HEAD versions (>2MB is skipped with a hint)

  • File actions — stage, unstage, and discard (inline confirmation for destructive ones), plus bulk actions per section

  • Pull & stash — one-click git pull; stash push (including untracked), pop, apply, and list with a count badge

  • AI commit messages — generate Conventional Commits messages from the staged diff via host model sampling (sampling/createMessage), with an optional custom prompt; also available as the /git:commit slash command

  • Live updates — status refreshes every 3s while the panel is visible; open diffs follow their files across stage/unstage

Related MCP server: Git Code Review MCP

Requirements

  • ZCode host with MCP Apps support

  • Node.js ≥ 18

  • git on PATH

Install

Built artifacts are committed under plugins/git/dist/, so installing from a checkout needs no build step.

zcode plugins marketplace add https://github.com/wudx/zcode-plugin-git

Then install the Git 工具 plugin from the marketplace and open the Git panel in the sidebar.

From source

git clone https://github.com/wudx/zcode-plugin-git
cd zcode-plugin-git
npm install
npm run build
zcode plugins marketplace add /path/to/zcode-plugin-git

Development

npm install                    # esbuild + MCP SDK (build-time only)
npm run build                  # bundle server + panel into plugins/git/dist/
npm run smoke                  # MCP protocol smoke tests against a temp git repo
node scripts/serve-panel.mjs   # open http://127.0.0.1:8137/mock to test the panel UI

After changing source, run npm run build, then refresh the marketplace and update the plugin in ZCode (source is not hot-reloaded).

Project layout

marketplace.json                Marketplace manifest (add this repo as a source)
plugins/
  git/
    .zcode-plugin/plugin.json   Plugin manifest (sidebar surface + MCP server)
    commands/commit.md          /git:commit slash command
    icon.png
    server/server.mjs           MCP server source (14 git tools + panel resource)
    ui/src/                     Panel source (vanilla JS + @modelcontextprotocol/ext-apps)
    dist/                       Build output (committed — what actually runs)
      server.mjs                Bundled MCP server (zero runtime dependencies)
      ui/panel.html             Panel page with all JS/CSS inlined
scripts/
  build.mjs                     Build script
  smoke.mjs                     MCP protocol smoke tests
  serve-panel.mjs               Static server for the panel test bench
  mock-host.html                Mock ZCode host (ui/initialize + tool/sampling stubs)

MCP tools

Tool

Description

git_status

Branch, ahead/behind, staged/worktree/conflict file lists, stash count

git_diff

Single-file diff (staged=true for index vs HEAD; untracked files become an all-added diff; scope=function/file for wider context)

git_stage

git add

git_unstage

git restore --staged (equals git rm --cached before the first commit)

git_discard

Discard worktree changes / delete untracked files (dangerous)

git_commit

Commit the index (message read from stdin, multi-line UTF-8)

git_log

Recent commit history

git_pull

git pull --no-edit

git_push

Push the current branch to its upstream (sets upstream with -u automatically for new branches)

git_stash

git stash push -u (includes untracked files)

git_stash_pop

Pop the latest stash entry

git_stash_apply

Apply a stash entry (keep it)

git_stash_list

List stash entries (ref + subject)

git_blob

Read a file's content at worktree/index/HEAD (images as base64 for panel preview)

License

MIT

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    Enables AI assistants to interact with local Git repositories for operations like status, commits, branching, and diffs, plus GitHub API integration for managing pull requests when authenticated.
    -
  • A
    license
    B
    quality
    D
    maintenance
    Enables AI assistants to perform code reviews by providing access to staged files, git diffs, and repository file content. It allows users to evaluate changes and context within any local git repository before committing or pushing.
    3
    7 npm
    ISC
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI-powered git assistance including commit message generation, branch naming, and branch analysis using conventional commits and git status/diff/log.
    1
    -