The ShadowGit MCP Server provides AI assistants with secure read-only access to ShadowGit repositories and organized commit management through session-based workflows.
Discover repositories: List all available ShadowGit-tracked repositories
Execute read-only git commands: Run safe git operations like
log
,diff
,blame
, andstatus
to inspect repository history, analyze code evolution, and debug changesManage AI work sessions: Start sessions to pause auto-commits, create organized checkpoint commits with custom titles and AI authorship, and end sessions to reactivate automatic tracking
Follow secure workflow: Enforce a structured process (start_session → make changes → checkpoint → end_session) with built-in protections against write operations, destructive commands, path traversal, and command injection
Provides read-only access to Git repositories with fine-grained commit history, enabling AI assistants to analyze code evolution, debug recent changes, trace function development, and perform cross-repository analysis using standard Git commands
ShadowGit MCP Server
A Model Context Protocol (MCP) server that provides AI assistants with secure git access to your ShadowGit repositories, including the ability to create organized commits through the Session API. This enables powerful debugging, code analysis, and clean commit management by giving AI controlled access to your project's git history.
What is ShadowGit?
ShadowGit automatically captures every save as a git commit while also providing a Session API that allows AI assistants to pause auto-commits and create clean, organized commits. The MCP server provides both read access to your detailed development history and the ability to manage AI-assisted changes properly.
Installation
Setup with Claude Code
Setup with Claude Desktop
Add to your Claude Desktop MCP configuration:
macOS/Linux: ~/.config/Claude/claude_desktop_config.json
Windows: %APPDATA%\\Claude\\claude_desktop_config.json
Requirements
- Node.js 18+
- ShadowGit app installed and running with tracked repositories
- Session API requires ShadowGit version >= 0.3.0
- Git available in PATH
How It Works
MCP servers are stateless and use stdio transport:
- The server runs on-demand when AI tools (Claude, Cursor) invoke it
- Communication happens via stdin/stdout, not HTTP
- The server starts when needed and exits when done
- No persistent daemon or background process
Environment Variables
You can configure the server behavior using these optional environment variables:
SHADOWGIT_TIMEOUT
- Command execution timeout in milliseconds (default: 10000)SHADOWGIT_SESSION_API
- Session API URL (default: http://localhost:45289/api)SHADOWGIT_LOG_LEVEL
- Log level: debug, info, warn, error (default: info)SHADOWGIT_HINTS
- Set to0
to disable workflow hints in git command outputs (default: enabled)
Example:
Available Commands
Session Management
The Session API (requires ShadowGit >= 0.3.0) allows AI assistants to temporarily pause ShadowGit's auto-commit feature and create clean, organized commits instead of having fragmented auto-commits during AI work.
IMPORTANT: AI assistants MUST follow this four-step workflow when making changes:
start_session({repo, description})
- Start work session BEFORE making changes (pauses auto-commits)- Make your changes - Edit code, fix bugs, add features
checkpoint({repo, title, message?, author?})
- Create a clean commit AFTER completing workend_session({sessionId, commitHash?})
- End session when done (resumes auto-commits)
This workflow ensures AI-assisted changes result in clean, reviewable commits instead of fragmented auto-saves.
list_repos()
Lists all ShadowGit-tracked repositories.
git_command({repo, command})
Executes read-only git commands on a specific repository.
start_session({repo, description})
Starts an AI work session using the Session API. This pauses ShadowGit's auto-commit feature, allowing you to make multiple changes that will be grouped into a single clean commit.
checkpoint({repo, title, message?, author?})
Creates a checkpoint commit to save your work.
end_session({sessionId, commitHash?})
Ends the AI work session via the Session API. This resumes ShadowGit's auto-commit functionality for regular development.
Parameters:
repo
(required): Repository name or full pathtitle
(required): Short commit title (max 50 characters)message
(optional): Detailed description of changesauthor
(optional): Your identifier (e.g., "Claude", "GPT-4", "Gemini") - defaults to "AI Assistant"
Notes:
- Sessions prevent auto-commits from interfering with AI work
- Automatically respects
.gitignore
patterns - Creates a timestamped commit with author identification
- Will report if there are no changes to commit
Security
- Read-only access: Only safe git commands are allowed
- No write operations: Commands like
commit
,push
,merge
are blocked - No destructive operations: Commands like
branch
,tag
,reflog
are blocked to prevent deletions - Repository validation: Only ShadowGit repositories can be accessed
- Path traversal protection: Attempts to access files outside repositories are blocked
- Command injection prevention: Uses
execFileSync
with array arguments for secure execution - Dangerous flag blocking: Blocks
--git-dir
,--work-tree
,--exec
,-c
,--config
,-C
and other risky flags - Timeout protection: Commands are limited to prevent hanging
- Enhanced error reporting: Git errors now include stderr/stdout for better debugging
Best Practices for AI Assistants
When using ShadowGit MCP Server, AI assistants should:
- Follow the workflow: Always:
start_session()
→ make changes →checkpoint()
→end_session()
- Use descriptive titles: Keep titles under 50 characters but make them meaningful
- Always create checkpoints: Call
checkpoint()
after completing each task - Identify yourself: Use the
author
parameter to identify which AI created the checkpoint - Document changes: Use the
message
parameter to explain what was changed and why - End sessions properly: Always call
end_session()
to resume auto-commits
Complete Example Workflow
Example Use Cases
Debug Recent Changes
Trace Code Evolution
Cross-Repository Analysis
Troubleshooting
No repositories found
- Ensure ShadowGit app is installed and has tracked repositories
- Check that
~/.shadowgit/repos.json
exists
Repository not found
- Use
list_repos()
to see exact repository names - Ensure the repository has a
.shadowgit.git
directory
Git commands fail
- Verify git is installed:
git --version
- Only read-only commands are allowed
- Use absolute paths or repository names from
list_repos()
- Check error output which now includes stderr details for debugging
Workflow hints are too verbose
- Set
SHADOWGIT_HINTS=0
environment variable to disable workflow banners - This provides cleaner output for programmatic use
Session API offline
If you see "Session API is offline. Proceeding without session tracking":
- The ShadowGit app may not be running
- Sessions won't be tracked but git commands will still work
- Auto-commits won't be paused (may cause fragmented commits)
- Make sure ShadowGit app is running
- Go in ShadowGit settings and check that the Session API is healthy
Development
For contributors who want to modify or extend the MCP server:
Publishing Updates
License
MIT License - see LICENSE file for details.
Related Projects
Transform your development history into a powerful AI debugging assistant! 🚀
local-only server
The server can only run on the client's local machine because it depends on local resources.
Tools
Provides AI assistants with secure, read-only access to ShadowGit repositories for debugging and code analysis. Enables powerful analysis of fine-grained git history captured automatically by ShadowGit's continuous commit tracking.
Related MCP Servers
- AsecurityAlicenseAqualityProvides comprehensive Git operations as tools for AI assistants and applications. This server enables AI systems to interact with Git repositories, allowing to initialize, fetch, commit, log, status, etc..Last updated -1001MIT License
- -securityFlicense-qualityConnects AI assistants to GitLab, allowing users to manage merge requests, view reviews, and interact with discussions through natural language queries.Last updated -9
- -securityAlicense-qualityEnables AI applications to automatically analyze local repositories and create GitHub repositories with proper configuration, topics, and complete setup workflow.Last updated -1GPL 3.0
- -securityFlicense-qualityEnables AI assistants to automatically analyze GitHub repositories and set up development environments by detecting tech stacks, installing dependencies, and verifying project builds. Provides safe tools for repository cloning, file system operations, package installation, and build verification through an allowlisted command system.Last updated -