Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Changelog

All notable changes to the GitHub MCP Extension for Zed will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.0.4] - 2025-01-19

### Added

- **Cross-Platform Wrapper Scripts**: Added `github-mcp-wrapper.sh` (Bash) and `github-mcp-wrapper.ps1` (PowerShell)
- **Zero Dependencies**: Eliminated Node.js requirement - uses system shell (Bash/PowerShell)
- **Auto-Detection**: Extension automatically finds and uses appropriate wrapper script for platform
- **Wrapper Mode Setting**: New `use_wrapper_script` boolean setting to enable automatic authentication
- **GitHub CLI Integration**: Automatic token detection via `gh auth token` command
- **Environment Variable Support**: Fallback authentication using `GITHUB_TOKEN`, `GITHUB_PERSONAL_ACCESS_TOKEN`, `GH_TOKEN`
- **Token File Support**: Reads tokens from `~/.config/gh/hosts.yml`, `~/.github_token`, and other common locations
- **Token Validation**: Optional token validation against GitHub API before starting server
- **Debug Mode**: Verbose logging support via `LOG_LEVEL=debug`

### Enhanced

- **Cross-Platform Compatibility**: Native support for Unix/Linux/macOS (Bash) and Windows (PowerShell)
- **Documentation**: Updated README and installation instructions to reflect dependency removal
- **Security**: No hardcoded tokens required in configuration files
- **Performance**: Reduced overhead by eliminating Node.js runtime dependency

### Technical Details

- **Platform Detection**: Automatically selects Bash or PowerShell wrapper based on OS
- **Backwards Compatibility**: Node.js wrapper (`github-mcp-wrapper.js`) maintained as fallback
- **Authentication Priority**: CLI tokens β†’ Environment variables β†’ Token files
- **WASM Sandbox Bypass**: Wrapper scripts run outside Zed's WASM sandbox to access system resources

### Breaking Changes

- None - all existing configurations remain functional

### Dependencies

- **Removed**: Node.js requirement (was previously required for wrapper script)
- GitHub CLI (optional, recommended for automatic authentication)
- Go (for GitHub's official MCP server)

### Configuration Examples

#### Traditional Method (Unchanged)

```json
{
"context_servers": {
"mcp-server-github": {
"source": "extension",
"settings": {
"github_personal_access_token": "ghp_your_token_here"
}
}
}
}
```

#### Wrapper Method (Recommended - Zero Dependencies)

```json
{
"context_servers": {
"mcp-server-github": {
"source": "extension",
"settings": {
"use_wrapper_script": true
}
}
}
}
```

### Benefits

- βœ… **Zero additional dependencies** - uses system shell
- βœ… **Cross-platform ready** - supports Unix/Linux/macOS and Windows
- βœ… No hardcoded tokens in Zed settings
- βœ… Automatic token refresh via GitHub CLI
- βœ… Auto-detection of wrapper script path
- βœ… Better security practices
- βœ… Seamless GitHub CLI integration

### Files Added

- `wrappers/github-mcp-wrapper.sh` - Bash wrapper script for Unix/Linux/macOS
- `wrappers/github-mcp-wrapper.ps1` - PowerShell wrapper script for Windows
- `wrappers/github-mcp-wrapper.js` - Node.js wrapper script (backwards compatibility)
- `DEPENDENCY_REMOVAL_SUMMARY.md` - Technical details of dependency removal

### Files Modified

- `src/mcp_server_github.rs` - Platform-aware wrapper detection with wrappers/ subfolder support
- `README.md` - Updated for cross-platform support and organized file structure
- `docs/configuration.md` - Removed Node.js requirement and updated paths
- `docs/default_settings.jsonc` - Updated prerequisite comments

## [0.0.3] - Previous Release

### Added

- Initial GitHub MCP server integration
- Basic token authentication
- Core GitHub API operations

---

**Migration Guide**: No migration required. Existing configurations continue to work. New wrapper approach is optional but recommended for better security and automation.
103 changes: 94 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,104 @@
# GitHub MCP Server Extension for Zed
# GitHub MCP Extension for Zed

This extension integrates [GitHub MCP Server](https://github.com/github/github-mcp-server) as a context server for
[Zed's](https://zed.dev) [Agent Panel.](https://zed.dev/docs/ai/overview)
A Zed extension that provides GitHub integration through the Model Context Protocol (MCP), enabling AI-powered GitHub operations directly within your editor.

To install navigate to: **Zed** > **Extensions**. Or use the command palette ([macOS](https://github.com/zed-industries/zed/blob/main/assets/keymaps/default-macos.json#L581), [Linux](https://github.com/zed-industries/zed/blob/main/assets/keymaps/default-linux.json#L459)) to search `extensions`.
## πŸš€ Quick Start

You'll need to [create](https://github.com/settings/tokens) a PAT with `repo` permissions.
1. **Install Extension**: Search "GitHub MCP Server" in Zed Extensions
2. **Configure Authentication**: Choose your preferred method below
3. **Start Using**: Ask AI about GitHub operations in natural language

## βš™οΈ Authentication Setup

### πŸ”§ Automatic Setup (Recommended) ⭐

**Just 2 steps:**

1. **Authenticate with GitHub**: `gh auth login`
2. **Configure Zed**:

```json
{
"context_servers": {
"mcp-server-github": {
"source": "extension",
"settings": {
"use_wrapper_script": true
}
}
}
}
```

Done! Extension automatically uses your GitHub CLI credentials.

### πŸ“‹ Manual Token Setup

If you prefer direct token configuration:

```json
"context_servers": {
"mcp-server-github": {
{
"context_servers": {
"mcp-server-github": {
"source": "extension",
"settings": {
"github_personal_access_token": "<GITHUB_PERSONAL_ACCESS_TOKEN>"
"github_personal_access_token": "your_token_here"
}
}
}
},
}
```

Get token: `gh auth token` or [github.com/settings/tokens](https://github.com/settings/tokens)

## πŸ“– Usage Examples

Once configured, you can use natural language commands in Zed's AI chat:

### Repository Operations

- "Show me my GitHub repositories"
- "List files in the src directory of my main project"
- "Create a new repository called 'my-awesome-project'"

### File Management

- "Create a README.md with installation instructions"
- "Update the version in package.json to 2.0.0"
- "Show me the contents of the main.rs file"

### Issue & PR Management

- "Create an issue about the login bug I found"
- "Show me all open pull requests waiting for review"
- "List issues labeled 'bug' in my repository"

### Code Search & Analysis

- "Find all functions containing 'authenticate' in this repo"
- "Show me security vulnerabilities in my projects"
- "Search for React components in public repositories"

### CI/CD & Workflows

- "Check the status of my latest GitHub Actions run"
- "Why did my last build fail?"
- "Create a new release for version 1.5.0"

## 🀝 Contributing

1. Fork the repository
2. Create a feature branch: `git checkout -b feature/amazing-feature`
3. Commit your changes: `git commit -m 'Add amazing feature'`
4. Push to the branch: `git push origin feature/amazing-feature`
5. Open a Pull Request

### Development Setup

```bash
git clone https://github.com/LoamStudios/zed-mcp-server-github.git
cd zed-mcp-server-github
cargo build --release
chmod +x wrappers/github-mcp-wrapper.sh # macOS/Linux
./wrappers/github-mcp-wrapper.sh --validate # Test setup
```
27 changes: 25 additions & 2 deletions configuration/default_settings.jsonc
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
{
/// Your GitHub Personal Access Token
"github_personal_access_token": "GITHUB_PERSONAL_ACCESS_TOKEN"
// Option 1: Automatic Authentication (Recommended) ⭐
// Uses GitHub CLI - no hardcoded tokens required!
// Setup: gh auth login
"context_servers": {
"mcp-server-github": {
"source": "extension",
"settings": {
"use_wrapper_script": true
}
}
}
}
// OR
{
// Option 2: Direct Token Configuration
// Get token: gh auth token
// Or create at: https://github.com/settings/tokens
"context_servers": {
"mcp-server-github": {
"source": "extension",
"settings": {
"github_personal_access_token": "ghp_your_token_here"
}
}
}
}
1 change: 0 additions & 1 deletion configuration/installation_instructions.md

This file was deleted.

83 changes: 83 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# GitHub MCP Extension Configuration

## Quick Start (Recommended) ⭐

1. **Install GitHub CLI**: `brew install gh`
2. **Authenticate**: `gh auth login`
3. **Configure Zed**:

```json
{
"context_servers": {
"mcp-server-github": {
"source": "extension",
"settings": {
"use_wrapper_script": true
}
}
}
}
```

That's it! The extension automatically handles authentication using your GitHub CLI credentials.

## Alternative: Direct Token

If you prefer not to use GitHub CLI:

1. **Get token**: `gh auth token` or create at [github.com/settings/tokens](https://github.com/settings/tokens)
2. **Configure Zed**:

```json
{
"context_servers": {
"mcp-server-github": {
"source": "extension",
"settings": {
"github_personal_access_token": "ghp_your_token_here"
}
}
}
}
```

## Benefits of GitHub CLI Approach

βœ… **No hardcoded tokens** in settings
βœ… **Automatic token refresh**
βœ… **Zero dependencies** - uses system shell
βœ… **Cross-platform** - works on macOS, Linux, Windows
βœ… **Secure** - tokens managed by GitHub CLI

## Authentication Methods

The wrapper tries these in order:

1. **GitHub CLI**: `gh auth token`
2. **Environment variables**: `GITHUB_TOKEN`, `GITHUB_PERSONAL_ACCESS_TOKEN`
3. **Token files**: `~/.config/gh/hosts.yml`, `~/.github_token`

## Troubleshooting

**"No GitHub token found"**
```bash
gh auth login
```

**"Wrapper script not found"**
- Ensure `use_wrapper_script: true` is set
- Extension auto-detects wrapper scripts in `wrappers/` folder

**Need to validate setup?**
```bash
./wrappers/github-mcp-wrapper.sh --validate # macOS/Linux
.\wrappers\github-mcp-wrapper.ps1 -Validate # Windows
```

## Cross-Platform Support

- **macOS/Linux**: Uses Bash (`wrappers/github-mcp-wrapper.sh`)
- **Windows**: Uses PowerShell (`wrappers/github-mcp-wrapper.ps1`)
- **Fallback**: Node.js (`wrappers/github-mcp-wrapper.js`)

Choose the method that works best for you!
Loading