github-repo-explorer-mcp

juancgarza/github-repo-explorer-mcp

3.3

If you are the rightful owner of github-repo-explorer-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A Model Context Protocol (MCP) server that enables Claude Code to explore and understand any GitHub repository.

Tools
4
Resources
0
Prompts
0

GitHub Repository Explorer MCP

A Model Context Protocol (MCP) server that gives Claude Code the ability to explore and understand any GitHub repository. Perfect for learning from existing codebases, understanding implementation patterns, or researching how other projects solve similar problems.

Why Use This?

Ever wondered how VS Code implements its editor, how React handles state management, or how any open-source project structures their code? This MCP server lets Claude Code dive into any public repository to help you understand and learn from real-world implementations.

Features

  • šŸš€ Instant Repository Access: Clone and explore any public GitHub repository
  • šŸ“ Navigate Codebases: Browse directory structures just like in your local environment
  • šŸ“„ Read Source Code: Examine implementation details of any file
  • šŸ” Smart Code Search: Find specific patterns, functions, or implementations across entire projects
  • šŸ’” Learn by Example: Study how successful projects implement features you want to build
  • šŸ”’ Safe Exploration: Read-only access ensures you're just learning, not modifying

Use Cases

šŸŽÆ Learning from Popular Projects

// Explore how VS Code implements its text editor
await clone_repo({ url: "https://github.com/microsoft/vscode" })
await grep({ pattern: "TextEditor", path: "src" })

// Understand React's hooks implementation
await clone_repo({ url: "https://github.com/facebook/react" })
await cat({ path: "packages/react/src/ReactHooks.js" })

// Study Next.js routing architecture
await clone_repo({ url: "https://github.com/vercel/next.js" })
await ls({ path: "packages/next/src/client/components" })

šŸ” Researching Implementation Patterns

  • Authentication: See how Supabase handles auth flows
  • State Management: Study Redux or Zustand internals
  • API Design: Learn from Stripe's SDK patterns
  • Testing Strategies: Explore Jest or Vitest codebases
  • Build Tools: Understand how Vite or Webpack work

Installation

# Clone this repository
git clone https://github.com/yourusername/github-repo-explorer-mcp.git
cd github-repo-explorer-mcp

# Install dependencies
npm install

# Build TypeScript files
npm run build

Setup with Claude Code

1. Running the Server

# Use the provided shell script (recommended)
./run-github-mcp.sh

# Or run directly with npm
npm run dev

2. Adding to Claude Desktop

# Add using Claude CLI
claude mcp add github-repo /path/to/github-repo-explorer-mcp/run-github-mcp.sh

# For example, if you cloned to your Projects folder:
claude mcp add github-repo /Users/yourusername/Projects/github-repo-explorer-mcp/run-github-mcp.sh

# The server will now be available in Claude Code sessions

API Reference

Tools

clone_repo

Clone a GitHub repository to the local filesystem.

{
  url: string;     // GitHub repository URL
  name?: string;   // Optional custom directory name
}
ls

List files and directories in the repository.

{
  path?: string;   // Optional path relative to repo root (defaults to root)
}
cat

Read file contents from the repository.

{
  path: string;    // Path to file relative to repo root
}
grep

Search for patterns within repository files.

{
  pattern: string;     // Search pattern (supports regex)
  path?: string;       // Optional path to search in
  ignoreCase?: boolean; // Case-insensitive search
}

Resources

  • repository_info - Shows current repository URL and local path

Example Exploration Sessions

Understanding VS Code's Editor Implementation

// Clone VS Code repository
await clone_repo({ url: "https://github.com/microsoft/vscode" })

// Find where the editor is implemented
await grep({ pattern: "class.*Editor", path: "src/vs/editor" })

// Explore the monaco editor structure
await ls({ path: "src/vs/editor/browser" })

// Read specific implementation
await cat({ path: "src/vs/editor/browser/editorBrowser.ts" })

Learning Authentication Patterns from Supabase

// Clone Supabase auth helpers
await clone_repo({ url: "https://github.com/supabase/auth-helpers" })

// Find OAuth implementations
await grep({ pattern: "OAuth|oauth", ignoreCase: true })

// Study the auth client structure
await ls({ path: "packages/shared/src" })

Exploring Modern Build Tools

// See how Vite handles HMR (Hot Module Replacement)
await clone_repo({ url: "https://github.com/vitejs/vite" })
await grep({ pattern: "hot.*update|hmr", path: "packages/vite/src", ignoreCase: true })

// Understand Turbopack's architecture
await clone_repo({ url: "https://github.com/vercel/turbo" })
await ls({ path: "crates/turbopack-core/src" })

Project Structure

github-mcp-server/
ā”œā”€ā”€ src/
│   └── index.ts         # Main server implementation
ā”œā”€ā”€ build/               # Compiled JavaScript output
ā”œā”€ā”€ CLAUDE.md           # Instructions for Claude Code
ā”œā”€ā”€ package.json        # Project dependencies
ā”œā”€ā”€ tsconfig.json       # TypeScript configuration
└── run-github-mcp.sh   # Shell script for running the server

Development

Prerequisites

  • Node.js 16+
  • npm or yarn
  • TypeScript

Building from Source

# Install dependencies
npm install

# Run in development mode
npm run dev

# Build for production
npm run build

# Run tests (if available)
npm test

Security Considerations

  • šŸ”’ Only works with public GitHub repositories
  • šŸ“ File access is restricted to the cloned repository directory
  • šŸ›”ļø Shell commands are properly escaped to prevent injection
  • 🚫 No authentication tokens are stored or transmitted
  • šŸ“ Cloned repositories are stored locally in ./repo by default

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details