GitHub Stars
0
User Rating
Not Rated
Forks
0
Issues
1
Views
4
Favorites
0
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
17
Total Contributions