-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Feature/secure repository discovery #2236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/secure repository discovery #2236
Conversation
Sync fork with latest upstream changes including: - Updated CI/CD workflows - Git server improvements and type annotations - Filesystem server enhancements with path utilities - Removal of deprecated/moved servers - Various dependency and documentation updates Prepares fork for dynamic repository discovery feature development
Introduces opt-in repository discovery with security-first design: - Multi-repository CLI support (--repository can be used multiple times) - Auto-discovery within MCP roots (--enable-discovery flag required) - Configurable depth limits and exclude patterns for security - New git_discover_repositories tool for manual discovery - Intelligent path resolution (file paths auto-resolve to git roots) - Async scanning with caching and timeout protection Security controls: bounded scanning, audit logging, pattern exclusions Performance: 5-min TTL cache, 30s timeouts, early termination Backward compatible: all existing functionality preserved Examples: mcp-server-git -r /repo1 -r /repo2 mcp-server-git --enable-discovery --max-discovery-depth 2 Designed for contribution to official MCP servers repository. Co-developed with Claude AI.
Introduces opt-in repository discovery with security-first design: - Multi-repository CLI support (--repository can be used multiple times) - Auto-discovery within MCP roots (--enable-discovery flag required) - Configurable depth limits and exclude patterns for security - New git_discover_repositories tool for manual discovery - Intelligent path resolution (file paths auto-resolve to git roots) - Async scanning with caching and timeout protection Security controls: bounded scanning, audit logging, pattern exclusions Performance: 5-min TTL cache, 30s timeouts, early termination Backward compatible: all existing functionality preserved Examples: mcp-server-git -r /repo1 -r /repo2 mcp-server-git --enable-discovery --max-discovery-depth 2 Updates main README to reflect new auto-discovery capabilities. Designed for contribution to official MCP servers repository. Co-developed with Claude AI as AI-enhanced infrastructure demo.
Additional Note on AI CollaborationI want to highlight something unique about this contribution: Claude AI was instrumental in every aspect of this enhancement - from initial problem identification through final implementation. What Claude directly handled:
My role was primarily:
This represents a fascinating example of AI autonomously improving AI infrastructure - Claude identified limitations in MCP tooling and designed elegant solutions while maintaining security as the top priority. The auto-discovery feature working seamlessly in production is a testament to Claude's architectural and implementation capabilities. The collaboration demonstrates how AI can be a true development partner, not just a code generator, when given the freedom to analyze problems holistically and implement comprehensive solutions. I'm happy to share anything from the Claude for Windows project, including the project itself, conversations, Project Knowledge material, etc. |
olaservo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm seeing some failures here: https://github.com/modelcontextprotocol/servers/actions/runs/15945164422/job/45020091279?pr=2236
- Filter out None values from root.uri.path to ensure type safety - Initialize discovered variable in all code paths to prevent unbound variable error - Maintains all functionality while satisfying strict type checking requirements Fixes pyright errors: - Argument type list[str | None] not assignable to Sequence[str] - discovered is possibly unbound variable
- Use standard Python idiom for module execution guard - Prevents unintended execution when module is imported - Follows Python best practices for entry point modules
Description
Adds secure repository auto-discovery with multi-repository support to the Git MCP server. This enhancement enables automatic discovery of git repositories within allowed MCP session roots while maintaining strict security boundaries through opt-in configuration and comprehensive safety controls.
Server Details
git_discover_repositoriesfor manual repository discoveryMotivation and Context
Previously, users had to manually configure each git repository path, requiring Claude Desktop restarts for new repositories. This created friction when working across multiple projects. The umbrella solution (
git init D:\dev) worked but wasn't scalable or secure.This enhancement enables:
How Has This Been Tested?
✅ Tested with Claude Desktop using the enhanced MCP server
Test scenarios:
Breaking Changes
None. All existing functionality preserved:
--repositoryargument still supportedTypes of changes
Checklist
Additional context
Security-First Design
--enable-discoveryflag required--max-discovery-depth(default: 2)node_modules,.venv, etc.Implementation Highlights
RootsCapabilityfor security boundariesCo-developed with AI
This enhancement demonstrates AI-enhanced infrastructure development, where Claude AI identified the limitation in the existing single-repository approach and designed a comprehensive, security-conscious solution that maintains backward compatibility while adding powerful new capabilities.
Example usage: