lazygit-mcp-bridge
lazygit-mcp-bridge is a tool that integrates lazygit with AI assistants via the Model Context Protocol (MCP). It allows users to send comments and context to their AI assistant directly while reviewing code changes, eliminating the need for manual clipboard operations. It features real-time message delivery and the ability to accumulate multiple messages.
GitHub Stars
0
User Rating
Not Rated
Favorites
0
Views
32
Forks
0
Issues
1
lazygit-mcp-bridge
Bridge between lazygit and AI assistants via Model Context Protocol (MCP)
Overview
lazygit-mcp-bridge
enables seamless integration between lazygit and AI coding assistants (like Claude, ChatGPT, etc.) through the Model Context Protocol. When you're reviewing code changes in lazygit, you can instantly send comments and context to your AI assistant without copy-pasting.
Features
- ๐ Send code diff comments directly from lazygit
- ๐ Real-time message delivery via file watching
- ๐ค Works with any MCP-compatible AI assistant
- โก Zero-copy workflow - no manual clipboard operations needed
- ๐ง Single binary with both server and client functionality
- ๐๏ธ Multiple message accumulation with deduplication
Installation
1. Install the tool
go install github.com/cappyzawa/lazygit-mcp-bridge/cmd/lazygit-mcp-bridge@latest
2. Configure Claude Code
Add to your Claude Code MCP settings:
"mcpServers": {
"lazygit-mcp-bridge": {
"command": "lazygit-mcp-bridge",
"args": ["server"]
}
}
Or use the CLI:
claude mcp add lazygit-mcp-bridge lazygit-mcp-bridge server
3. Configure lazygit
Add to your ~/.config/jesseduffield/lazygit/config.yml
:
customCommands:
- key: "<c-y>"
context: "staging"
description: "Send comment to AI assistant"
loadingText: "Sending commentโฆ"
prompts:
- type: "input"
title: "Comment:"
command: |
lazygit-mcp-bridge send \
--file "{{ .SelectedPath }}" \
--comment "{{ index .PromptResponses 0 }}"
That's it! No shell scripts needed anymore. The lazygit-mcp-bridge
binary handles everything.
Usage
Basic Usage
- Open lazygit
- Navigate to the diff view
- Press
Ctrl+Y
- Enter your comment
- The AI assistant receives your message automatically!
Using Custom Commands (Recommended)
For the best experience, set up a custom Claude Code command:
Create the command directory in your project:
mkdir -p .claude/commands
Create
.claude/commands/lg.md
:--- allowed-tools: mcp__lazygit-mcp-bridge__check_lazygit_messages description: Check for new lazygit comments and provide concise code improvement suggestions --- # lazygit Comment Check Use the MCP tool `mcp__lazygit-mcp-bridge__check_lazygit_messages` to retrieve the latest comment from lazygit. Then provide concise, focused code improvement suggestions based on the received message. Keep responses brief and actionable. Additional context: $ARGUMENTS
Now you can use
/project:lg
in Claude Code to instantly check for lazygit messages!
How it works
- When you press
Ctrl+Y
in lazygit, it executes the custom command - The
send
subcommand creates a JSON message file - The MCP server (running as
server
subcommand) watches for file changes - When detected, it queues messages with deduplication
- Your AI assistant retrieves all accumulated messages via MCP tools
Command Line Interface
# Run as MCP server
lazygit-mcp-bridge server
# Send a message from lazygit (usually called automatically)
lazygit-mcp-bridge send --file main.go --comment "Add error handling for line 42"
# Show help
lazygit-mcp-bridge --help
lazygit-mcp-bridge server --help
lazygit-mcp-bridge send --help
Multiple Message Support
The tool supports multiple message accumulation:
- Messages no longer overwrite each other
- Up to 10 messages are retained in memory
- SHA-256 hash-based deduplication prevents duplicates
- All messages delivered together when requested
- Clear separation between messages in the response
Development
# Clone the repository
git clone https://github.com/cappyzawa/lazygit-mcp-bridge
cd lazygit-mcp-bridge
# Install dependencies
go mod tidy
# Build with make
make build
# Run server locally
make run-server
# Install to GOPATH/bin
make install
# Run tests
make test
Project Structure
lazygit-mcp-bridge/
โโโ cmd/lazygit-mcp-bridge/ # CLI entry point
โ โโโ main.go # Cobra command definitions
โโโ internal/ # Internal packages
โ โโโ server/ # MCP server implementation
โ โ โโโ server.go
โ โโโ client/ # Send command implementation
โ โโโ client.go
โโโ docs/ # Documentation
โโโ Makefile # Build automation
โโโ go.mod # Go modules
โโโ README.md
License
MIT
Documentation
- Architecture Overview - System design and components
- MCP Protocol Specification - Protocol implementation details
- Custom Commands Guide - Advanced Claude Code integration
- Development Guide - Building and contributing
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. See the Development Guide for details.
45
Followers
186
Repositories
2
Gists
0
Total Contributions