lgh
LGH’s MCP server lets AI agents manage local Git hosting, backups, and health on your machine.
Register local Git repos with LGH and get clone URLs (
lgh_add)Clone/restore registered repos into working directories (
lgh_clone)Preview uncommitted changes or full diffs before saving (
lgh_diff)List registered repos and their paths/URLs (
lgh_list)Read server runtime logs for troubleshooting (
lgh_log)Unregister repos and delete LGH-side backups (
lgh_remove)Roll back commits locally and optionally force-push to LGH (
lgh_rollback)Commit locally without pushing (
lgh_save)Start/stop the LGH HTTP server (
lgh_serve_start,lgh_serve_stop)Check LGH and ActionD health/status (
lgh_status)One-click commit + push backup to LGH, optionally triggering ActionD CI (
lgh_up)Dry-run
lgh_upto preview changed files, registration state, and trash detection (lgh_up_dryrun)
Allows exposing the local Git server to the internet via Cloudflare Tunnel (cloudflared).
Allows exposing the local Git server to the internet through ngrok tunnels for remote access.
LGH - LocalGitHub
LGH (LocalGitHub) is a lightweight local Git hosting service. It wraps git http-backend to provide GitHub-like HTTP access, running entirely on localhost - turning your local directory into a Git server.
🌐 Ecosystem
LGH is the foundation of a local-first dev-toolchain for AI agents:
ActionD — local CI/CD engine that listens to LGH git events and runs plugin jobs (MCP server with 22 tools, incl. the one-call
dev_cycle_runcommit→CI loop)actiond-web — web console with live dashboard, SSE log streaming, and in-browser failure diagnosis
homebrew-tap —
brew install lgh/brew install actiond
Related MCP server: my-local-mcp
✨ Features
🚀 Lightweight - Single binary, no external dependencies
🔧 Easy to Use - Intuitive CLI commands, one-click repository setup
🌐 HTTP Access - Standard Git HTTP protocol, compatible with all Git clients
🔒 Authentication - Built-in Basic Auth with salted password hashing
🛡️ Read-Only Mode - Optional read-only mode to protect repositories
📡 mDNS Discovery - Automatic LAN discovery for team collaboration
🌍 Tunnel Support - One-click expose to internet (ngrok, cloudflared)
⚡ Smart Archival (v1.2.0) -
lgh up/lgh savecommands with auto .gitignore🤖 MCP Server (v1.2.0) - AI Agent integration (Cursor, Claude Desktop)
📦 Installation
Option 1: Download Pre-built Binary (Recommended)
Download the pre-built binary for your system — these links always point to the latest release:
OS | Architecture | Download |
macOS | Apple Silicon (M1/M2/M3) | |
macOS | Intel | |
Linux | x86_64 | |
Linux | ARM64 | |
Windows | x86_64 |
# Install after download (macOS ARM64 example)
chmod +x lgh-darwin-arm64
sudo mv lgh-darwin-arm64 /usr/local/bin/lghWindows Installation
Download
lgh-windows-amd64.exeRename to
lgh.exeMove to a folder in your
%PATH%(e.g.,C:\Program Files\lgh\)Run in PowerShell or Command Prompt
Option 2: Install Script
# Install
curl -sSL https://raw.githubusercontent.com/JoeGlenn1213/lgh/main/install.sh | bash
# Uninstall
curl -sSL https://raw.githubusercontent.com/JoeGlenn1213/lgh/main/uninstall.sh | bashOption 3: Homebrew (macOS / Linux)
brew install JoeGlenn1213/tap/lghOption 4: Build from Source
git clone https://github.com/JoeGlenn1213/lgh.git
cd lgh
make build
sudo make install
# Or manually
go build -o lgh ./cmd/lgh/
sudo mv lgh /usr/local/bin/Option 5: Go Install
go install github.com/JoeGlenn1213/lgh/cmd/lgh@latest🚀 Quick Start
1. Initialize LGH Environment
lgh initThis creates the necessary directories and config files in ~/.localgithub/.
Run on Startup
Run this only after lgh init. The service runs lgh serve and stops until lgh init has created ~/.localgithub/.
brew services start lghA helper that starts LGH and ActionD together ships with ActionD's next release. Until then, start ActionD from its README after lgh init.
2. Start the Server
# Start in foreground
lgh serve
# Start in background (daemon mode)
lgh serve -d
# Check server status
lgh status
# Stop the server
lgh stopServer listens on http://127.0.0.1:9418 by default.
3. One-Step Add & Push (v1.0.9+)
The fastest way to host a local project:
cd your-project
lgh add . --pushThis single command will:
Initialize a Git repo (if not already one).
Auto-Commit all files (if the repo is empty).
Register it with LGH.
Auto-Push to the server immediately.
4. Add Without Pushing
If you prefer manual control:
lgh add .
# Then push manually later
git push -u lgh main5. Smart Archival (v1.2.0+)
The fastest way to backup and sync your code:
# One-click: auto .gitignore + add + commit + push
lgh up "commit message"
# Local save only (no push)
lgh save "WIP: work in progress"Smart Ignore automatically:
Detects project type (Python, Go, Node, Java, Rust, AI/ML)
Generates appropriate
.gitignorefileBlocks large files (>50MB) and sensitive files (.env, *.key)
(v1.2.3+) When used via MCP, returns exact
triggered_job_ids: [...]array, allowing AI to track pipeline status with zero blind spots
5. Push Code
After adding, you can use standard Git commands:
git push lgh main
# or
git push5. Clone from Elsewhere
git clone http://127.0.0.1:9418/your-project.git📖 Command Reference
Command | Description | Example |
| Initialize LGH environment |
|
| Start HTTP server |
|
| Stop running server |
|
| Add repository to LGH |
|
| List all repositories (detailed) |
|
| View server status and repo list |
|
| Remove repository (use status/list first) |
|
| Expose to internet |
|
| Manage authentication |
|
| Show version |
|
| Check system health |
|
| Check repo connection state |
|
| Switch active remote |
|
| Simple clone from LGH |
|
| View/watch system event logs |
|
| One-click commit and push (MCP returns ActionD triggered_job_ids) |
|
| Local save (no push) |
|
| View server logs |
|
| Start MCP server for AI |
|
Repository Management (v1.0.4+)
LGH provides tools to manage your local repository state without complex git commands.
Check Connection State
See exactly which remote you are pushing to:
lgh repo statusSwitch Remote
Easily switch between LGH and origin (e.g., GitHub):
lgh remote use lgh # Switch upstream to LGH
lgh remote use origin # Switch upstream to OriginOther Tools
# Clone easily (no full URL needed)
lgh clone my-project
# Inspect bare repo details (HEAD, branches)
lgh repo inspect my-project
# Set default branch for bare repo
lgh repo set-default my-project main
# Check system health
lgh doctorMonitoring & Logs (v1.0.5+)
Track system activity and repository changes in real-time.
# View recent events
lgh events
# Watch for new events (like 'tail -f')
lgh events --watch
```bash
# Filter by type
lgh events --type git.pushAgent Integration (v1.1.0+)
LGH is designed to be the "source of truth" for AI Agents.
1. Real-time Subscription (Socket)
Connect to the Unix Domain Socket at ~/.localgithub/lgh.sock to receive a real-time stream of JSON events for every action (repo added, git push, etc.).
Protocol: Unix Socket, JSON Lines.
Security: Read-Only. Only the local user can connect.
2. Event Replay (Simulation) Inject past events back into the system to test your Agents without performing real Git actions.
# Replay last 10 events to all connected agents
lgh events replay --last 10
# Replay specific event types
lgh events replay --type git.pushNote: Replayed events include “_replayed”: true in their payload.
Server Options
# Daemon mode (background)
lgh serve -d
# Read-only mode (disable push)
lgh serve --read-only
# Custom port
lgh serve --port 8080
# Enable mDNS for LAN discovery
lgh serve --mdns
# Bind to all interfaces (LAN access)
lgh serve --bind 0.0.0.0🤖 MCP Quick Setup Guide
Want to connect LGH to Cursor or Claude Desktop?
Scenario 1: You already have LGH installed
Simply update your AI editor's config file (e.g., ~/.cursor/mcp.json) with:
{
"mcpServers": {
"lgh": {
"command": "lgh",
"args": ["mcp"]
}
}
}Scenario 2: You don't have LGH yet (One-Click Install)
Run this single command to install the latest binary:
curl -sSL https://raw.githubusercontent.com/JoeGlenn1213/lgh/main/install.sh | bashOnce installed, follow the "Scenario 1" step. We designed LGH as a single binary, so you don't need a separate "MCP Plugin". The lgh binary IS the MCP server!
Verify Setup
Ask your AI Agent:
"Check LGH status" If it calls
lgh_statusand responds, you're all set!
Add Repository Options
# Custom name
lgh add . --name custom-name
# Don't auto-add remote
lgh add . --no-remote🔐 Authentication
Enable authentication when sharing repositories over the network:
Setup Authentication
# Interactive setup (hidden password input)
lgh auth setup
# View auth status
lgh auth status
# Generate password hash (for manual config)
lgh auth hash
# Disable auth
lgh auth disableClient Authentication
# Method 1: URL embedded credentials
git clone http://username:password@192.168.1.100:9418/repo.git
# Method 2: Use Git credential helper
git config credential.helper store
git clone http://192.168.1.100:9418/repo.git
# Enter username/password on first accessSecurity Best Practices
Scenario | Recommended Config |
Local development | Default config (127.0.0.1) |
LAN sharing |
|
Internet exposure | Reverse proxy (Caddy/Nginx) + TLS + Auth |
⚠️ Security Note: Password must be at least 8 characters. Config file stores salted hash, not plaintext.
See docs/SECURITY.md for detailed security guidelines.
🏗️ Directory Structure
~/.localgithub/
├── config.yaml # Global config
├── mappings.yaml # Repository mappings
├── lgh.pid # Server PID file
└── repos/ # Bare repository storage
├── MyApp.git/
└── ProjectB.git/⚙️ Configuration
~/.localgithub/config.yaml:
port: 9418
bind_address: "127.0.0.1"
repos_dir: "/Users/you/.localgithub/repos"
read_only: false
mdns_enabled: false
# Authentication (optional)
auth_enabled: true
auth_user: "git-user"
auth_password_hash: "salt:hash..."🌐 Tunnel Feature
LGH supports multiple ways to expose your local service to the internet:
# Show all available tunnel methods
lgh tunnel
# Use ngrok
lgh tunnel --method ngrok
# Use Cloudflare Tunnel
lgh tunnel --method cloudflared
# SSH reverse proxy
lgh tunnel --method ssh⚠️ Security Note: Always enable authentication (
lgh auth setup) or use a reverse proxy before exposing to the internet.
🔧 Advanced Usage
LAN Sharing (with Auth)
# 1. Setup auth
lgh auth setup
# 2. Bind to all interfaces with read-only mode
lgh serve --bind 0.0.0.0 --read-only --mdns
# 3. Access from other devices (requires auth)
git clone http://username:password@your-hostname.local:9418/repo.gitProduction Deployment (Recommended)
# 1. LGH listens on localhost only
lgh serve
# 2. Use Caddy reverse proxy + auto HTTPS
# Caddyfile:
# git.example.com {
# basicauth * {
# user $2a$14$...
# }
# reverse_proxy localhost:9418
# }CI/CD Integration
# Temporarily expose for GitHub Actions
lgh auth setup
lgh tunnel --method ngrok &
# Use ngrok URL + credentials⚖️ Comparison with Other Solutions
Feature | LGH | GitLab | Gitea | git daemon | File Sharing |
Setup Complexity | ⭐ Single binary | ❌ Needs database | ⚠️ Needs config | ⭐ Simple | ⭐ No install |
HTTP Protocol | ✅ | ✅ | ✅ | ❌ | ❌ |
Authentication | ✅ Optional | ✅ Required | ✅ Required | ❌ | ❌ |
Web UI | ❌ | ✅ | ✅ | ❌ | ❌ |
Resource Usage | ⭐ <10MB | ❌ >1GB | ⚠️ ~100MB | ⭐ <5MB | ⭐ None |
Startup Time | ⭐ <1s | ❌ >30s | ⚠️ ~10s | ⭐ <1s | ⭐ Instant |
LAN Discovery | ✅ mDNS | ❌ | ❌ | ❌ | ✅ |
Use Case | Local/Temp | Enterprise | Team | Simple share | File transfer |
LGH's Position: Fills the gap between "simple file sharing" and "full Git platform".
🧪 Testing
# Run all tests
go test ./... -v
# Run integration tests
go test ./test/... -v
# Skip long-running tests
go test ./... -v -short📋 System Requirements
Go 1.23+ (for building)
Git (runtime)
macOS, Linux, or Windows
🤝 Contributing
Contributions are welcome! See CONTRIBUTING.md for details.
Fork the repository
Create feature branch (
git checkout -b feature/amazing-feature)Commit changes (
git commit -m 'Add amazing feature')Push to branch (
git push origin feature/amazing-feature)Create Pull Request
📄 License
This project is licensed under the MIT License - see LICENSE file.
🙏 Acknowledgments
spf13/cobra - CLI framework
spf13/viper - Configuration management
fatih/color - Terminal coloring
hashicorp/mdns - mDNS support
Available Tools
13 toolslgh_addA
Register a local Git repository with the LGH local server. Creates a bare repository under the LGH repos dir and adds an "lgh" remote pointing at it to the source repo. Initializes a git repo first if the directory is not one yet; refuses with an error if the path does not exist, the name is already registered, or a bare repo already exists at the target path. Returns the repository name and its clone URL. Use lgh_up to push subsequent commits and lgh_remove to unregister.
Inputs: path (required), name.
lgh_cloneA
Clone a repository from the LGH local server into a new working directory on this machine — the restore side of the backup loop and the inverse of lgh_up. Use it to recover a working copy after data loss or to materialize an existing backup on a new machine: find the exact registered name with lgh_list, make sure the server is up (lgh_status, otherwise lgh_serve_start), then clone. The name may carry a .git suffix. Refuses with a clear error when the name is not registered, the server is not running, or the destination directory already exists and is not empty — it never overwrites existing files. Returns JSON with name, clone_url, destination (absolute path), and the checked-out branch and HEAD commit.
Inputs: name (required), dest.
lgh_diffARead-onlyIdempotent
Show uncommitted changes in a Git working directory: runs git diff --stat for a per-file summary plus the full unified diff, and returns JSON with has_changes, stat, diff, truncated, and staged. The full diff is truncated at 32KB to protect the caller's context. Refuses with an error when the path is not inside a git work tree. Use this to review patch content before lgh_save or lgh_up; use lgh_up_dryrun instead when you only need the changed-file list, trash detection, and LGH registration state.
Inputs: path, staged.
lgh_listARead-onlyIdempotent
List every Git repository registered with the LGH local server, each with its name, source_path (local working dir), bare_path, clone_url (LGH server URL), and created_at. Reads only the local registry under ~/.localgithub; no network access. Use it to discover the clone_url of an existing backup or the exact registered name required by lgh_remove. Returns a JSON array, empty when nothing is registered.
Inputs: filter.
lgh_logARead-onlyIdempotent
Read the LGH server's runtime log from ~/.localgithub/logs/server.jsonl and return the most recent entries as a JSON array of {ts, level, msg, component} objects (an empty array if no log file exists yet). A level filter keeps only entries at exactly that severity, so level=ERROR surfaces just the failures. Use this to investigate why a push or the server misbehaved in the past: lgh_status only shows the current health snapshot, while lgh_log shows the history that led to it.
Inputs: level, limit.
lgh_removeADestructive
Unregister a repository from LGH. Deletes the bare backup repository from the LGH repos dir and removes the "lgh" remote from the local working directory; the local working tree and its git history are never touched. Fails with an error if the name is not registered. Destructive: the LGH-side backup copy and its history are permanently deleted and only come back by re-registering (lgh_add) and pushing again (lgh_up). Use lgh_list first to find the exact registered name.
Inputs: name (required).
lgh_rollbackADestructive
Roll the repository back N commits by running git reset --hard HEAD~N. Destructive: uncommitted changes and the rolled-back commits are discarded from the local branch, so run lgh_up or lgh_save first if anything there is worth keeping. With push enabled it also force-pushes the reset state to the LGH server so the backup matches; without push only the local branch moves. Returns JSON with from_commit, to_commit, rolled_back (the discarded commit's subject), and push success. Use lgh_diff or lgh_up_dryrun to inspect what would be lost before rolling back.
Inputs: path, push, steps.
lgh_saveA
Create a local checkpoint: ensures a .gitignore exists, then git add + git commit in the working directory WITHOUT pushing anywhere — nothing is synced to the LGH server or any other remote. Initializes git if the directory is not a repo yet, and aborts when trash detection finds blocking issues. Use this for intermediate saves; switch to lgh_up when the work should also reach the LGH backup. Returns JSON with success and a human-readable output line ("Nothing to commit, working tree clean" when there are no changes).
Inputs: message (required), path.
lgh_serve_startAIdempotent
Start the LGH HTTP server in the background by spawning "lgh serve --daemon" from the current binary. The server hosts the git endpoints that repos push to, so start it before lgh_up or before cloning from LGH. Returns the daemon's startup output, or an error with that output if the server cannot start (for example the port is already taken). Check lgh_status afterwards to confirm the PID and listen address.
Inputs: port.
lgh_serve_stopAIdempotent
Stop the background LGH HTTP server by shutting down its PID. Registered repositories and local commits are unaffected; pushes simply fail until the server is restarted with lgh_serve_start. Returns a friendly notice instead of an error when the server is not running, so it is safe to call speculatively as a cleanup step. Takes no arguments; use lgh_status to check state first if you want to avoid a no-op call.
lgh_statusARead-onlyIdempotent
Get a unified health snapshot of the LGH server and the ActionD daemon. Aggregates LGH running state, PID, listen address, registered repo count, repos dir, and read-only flag, plus the ActionD daemon's running state and PID (probed via its PID file). Takes no arguments and reads only local state, so it is safe to call at any time. Use this to answer "is LGH up?"; use lgh_log when you need the historical runtime events that led to the current state. Returns pretty-printed JSON with top-level "lgh" and "actiond" objects.
lgh_upA
One-click backup: ensures a .gitignore exists, then git add + git commit + git push to the LGH local server (localhost, NOT GitHub/GitLab). Auto-registers the repo with LGH and initializes git if needed, so it also works on a fresh directory. Aborts with an error when trash detection finds blocking issues (large files, .env secrets) unless force is set. If ActionD is running, the result includes event_id and triggered_job_ids for the CI jobs spawned by this push; use the ActionD server's dev_cycle_run tool when you need full job tracing. Returns JSON with success, output, project_type, commit, and optional triggered_job_ids.
Inputs: message (required), path, force.
lgh_up_dryrunARead-onlyIdempotent
Dry-run preview of lgh_up without touching any state: nothing is committed, pushed, registered, or written. Reports whether the directory is a git repo, the pending changed files, LGH registration status (or the name it would auto-register as), and trash-detection results including whether lgh_up would fail and why. Call this before lgh_up whenever you are unsure what a backup would include; use lgh_diff when you want the actual patch content instead of the changed-file list. Returns a JSON object with dry_run=true.
Inputs: path.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 13 tools
Most tools target distinct actions and descriptions explicitly cross-reference siblings (e.g. lgh_save vs lgh_up, lgh_diff vs lgh_up_dryrun, lgh_status vs lgh_log), so selection is clear. Minor overlap remains: lgh_up auto-registers, duplicating lgh_add, and lgh_up vs lgh_save differ only in whether a push happens.
Every tool shares the lgh_ prefix and uses snake_case, giving a predictable scheme. A few break the verb-first pattern (lgh_serve_start/lgh_serve_stop place the object first, lgh_up_dryrun appends a modifier), a small deviation but still readable.
13 tools is well-scoped for a git backup/server-management server. Each tool maps to a distinct lifecycle step (server control, registration, checkpoint/backup, inspection, recovery) and none feels redundant.
The surface covers the full loop: server start/stop/status, add/remove/list/clone, save/up/up_dryrun, diff, rollback, and log inspection. Minor gaps exist around pulling/fetching into an existing tree and branch/tag management, but core backup and restore workflows are covered.
Maintenance
Related MCP Connectors
AI-native git hosting — repos, PRs, issues, CI gates, and AI code review over MCP (60 tools).
Git-backed platform for skills, tools, and context for AI agents
Plain-English git for agents: 22 tools to branch, commit, push and tag. Free tier.
A MCP server built for developers enabling Git based project management with project and personal…
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceA lightweight MCP server that enables AI assistants to manage local Git repositories by executing commands like status, add, and commit. It streamlines development workflows by providing repository context and diffs directly to the assistant.Apache 2.0
- FlicenseNot gradedqualityDmaintenanceA local MCP server that turns AI clients into power users of local git repositories, enabling clone, browse, search, and inspect code without burning API tokens.-
- AlicenseNot gradedqualityDmaintenanceA secure and scalable Git MCP server giving AI agents powerful version control for local and (soon) serverless environments.Apache 2.0
- FlicenseNot gradedqualityDmaintenanceA local-only MCP server that exposes git repository history, diffs, and status as tools for LLM clients, working entirely against a local git repo on disk.-