A Spring Boot-based Model Context Protocol (MCP) server that provides GitHub integration tools for AI assistants like Claude Desktop.
This server implements the Model Context Protocol to expose GitHub operations as tools that can be used by MCP clients. It leverages the GitHub CLI (gh
) to perform various GitHub operations including repository management, issue tracking, pull request management, and more. This provides a lightweight alternative to the official GitHub MCP server that doesn't require Docker.
To use this server with Claude Desktop, add the following to your Claude configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"github": {
"command": "java",
"args": ["-jar", "/path/to/gh_mcp_server/build/libs/gh_mcp_server.jar"],
"env": {}
}
}
}
Replace /path/to/gh_mcp_server
with the actual path to your project directory.
- List repositories for authenticated user
- Search repositories on GitHub
- Get detailed repository information
- List branches in a repository
- Create new branches
- Get file contents from repositories
- Get commit history
- List issues (open, closed, or all)
- Get detailed issue information
- Create new issues
- Close issues
- Add comments to issues
- Edit issue title and body
- List pull requests
- Get detailed pull request information
- Create new pull requests
- Merge pull requests (merge, squash, or rebase)
- Close pull requests
- Add comments to pull requests
- List workflows in a repository
- List workflow runs with optional filtering
- View detailed workflow run information
- List releases
- View release details
- Create new releases (with draft/prerelease options)
- Get authenticated user details
- Java 21 or higher - Uses modern Java features (virtual threads, records, pattern matching)
- GitHub CLI (
gh
) - Must be installed and authenticated - Gradle - Wrapper included in project
- 🚀 Lightweight: No Docker required, pure Java implementation
- 🔧 Comprehensive: 26 GitHub operations covering complete workflows
- ⚡ Fast: Direct GitHub CLI integration with optimized JSON responses
- 🧪 Well-Tested: 75+ test cases ensuring reliability
- 🛡️ Secure: Leverages existing GitHub CLI authentication
-
Install GitHub CLI
# macOS brew install gh # or download from https://cli.github.com/
-
Authenticate with GitHub
gh auth login
-
Clone and build the project
git clone <repository-url> cd gh_mcp_server ./gradlew build
Note: The build automatically creates a version-independent symlink
gh_mcp_server.jar
→gh_mcp_server-1.0.0.jar
-
Configure Claude Desktop
After building, configure Claude to use this MCP server. You have two options:
Option A: Using the JAR file (Recommended)
{ "mcpServers": { "github": { "command": "java", "args": ["-jar", "/path/to/gh_mcp_server/build/libs/gh_mcp_server.jar"], "env": {} } } }
Note: A symlink
gh_mcp_server.jar
points to the current version (gh_mcp_server-1.0.0.jar
). This provides version-independent deployment. For version-specific deployment, use the full versioned filename instead.Option B: Using Gradle
{ "mcpServers": { "github": { "command": "./gradlew", "args": ["bootRun"], "cwd": "/path/to/gh_mcp_server", "env": {} } } }
-
Restart Claude Desktop to load the new server configuration
After configuring Claude Desktop, you can use natural language to interact with GitHub:
- "List my repositories" → Shows your repositories with details
- "List my private repositories" → Filter by visibility (public/private/internal)
- "Search for Spring Boot repositories with over 1000 stars"
- "Show me details about the microsoft/vscode repository"
- "Get the last 5 commits from my project repository"
- "List open issues in my project" → Lists current open issues
- "Show me issue #123 details" → Gets specific issue information
- "Create a new issue titled 'Bug: Login fails' with description..."
- "Close issue #123 and add a comment 'Fixed in latest release'"
- "List all pull requests in the kubernetes/kubernetes repository"
- "Show me details for PR #456"
- "Create a pull request from my feature-branch to main"
- "Merge PR #789 using squash strategy"
- "Show me all workflows in this repository" → Lists GitHub Actions
- "What's the status of recent workflow runs?"
- "List releases for the golang/go repository"
- "Create a new release v2.1.0 as a draft"
- "Get the contents of package.json from my project"
- "Show me the README file from the main branch"
If the server fails to start, check that:
- Java 21+ is installed and in your PATH
- GitHub CLI is installed and authenticated (
gh auth status
) - The JAR file path in the configuration is correct
- Claude Desktop has been restarted
To test the server independently (without Claude):
./gradlew bootRun
The server will start in STDIO mode and wait for MCP protocol messages. However, for normal usage, the server should be configured to run automatically by Claude Desktop as shown above.
# Build the project and run all tests
./gradlew build
# Run tests (command syntax validation only)
./gradlew test
# Run tests including GitHub CLI integration tests
./gradlew test -Dtest.gh.integration=true
# Format code with Spotless (Google Java Format)
./gradlew spotlessApply
# Check code formatting without applying changes
./gradlew spotlessCheck
# Clean build artifacts
./gradlew clean
# Run the server locally for testing
./gradlew bootRun
The project includes comprehensive test coverage:
- 75+ test cases validating all 26 GitHub operations
- Command syntax tests - Verify exact
gh
command construction - Edge case tests - Handle special characters, Unicode, null values
- Integration tests - Optional real GitHub CLI execution
- Error handling tests - Validate graceful failure modes
See src/test/java/com/kousenit/gh_mcp_server/TEST_README.md
for detailed testing documentation.
The server uses Spring Boot's default configuration. You can customize settings in src/main/resources/application.properties
.
github.defaultBranch
- Default branch name for operations (default:main
)spring.threads.virtual.enabled
- Enable virtual threads for better performance (default:true
)- MCP server runs in STDIO mode for CLI integration
listRepositories
- List user's repositories with optional visibility filter (public/private/internal)searchRepositories
- Search GitHub repositoriesgetRepository
- Get detailed repository informationgetCommitHistory
- Get repository commit history with configurable limitlistBranches
- List repository branchescreateBranch
- Create a new branch
listIssues
- List issues in repositorygetIssue
- Get specific issue detailscreateIssue
- Create new issuecloseIssue
- Close an issuecommentOnIssue
- Add comment to issueeditIssue
- Edit issue title/body
listPullRequests
- List pull requestsgetPullRequest
- Get PR detailscreatePullRequest
- Create new pull requestmergePullRequest
- Merge PR (merge/squash/rebase)closePullRequest
- Close pull requestcommentOnPullRequest
- Add PR comment
listWorkflows
- List repository workflowslistWorkflowRuns
- List workflow runs with filteringgetWorkflowRun
- Get workflow run details
listReleases
- List repository releasesgetRelease
- Get release detailscreateRelease
- Create new release (draft/prerelease options)
getFileContents
- Get file contents from repositorygetMe
- Get authenticated user details
All operations return optimized JSON responses and support comprehensive error handling.
"gh: command not found"
- Install GitHub CLI from https://cli.github.com/
- Ensure
gh
is in your system PATH - Test with
gh --version
Authentication errors
- Run
gh auth login
to authenticate - Check status with
gh auth status
- Ensure you have access to the repositories you're trying to access
Server startup failures
- Verify Java 21+ is installed:
java --version
- Check the JAR file path in Claude configuration
- Look for error messages in Claude Desktop logs
- Ensure the server isn't already running on another instance
Command timeouts
- Large repositories or slow networks may cause timeouts
- Default timeout is 30 seconds per operation
- Check your internet connection and GitHub API status
Permission denied errors
- Ensure GitHub CLI has proper permissions for the repository
- For organization repositories, check if you have appropriate access
- Some operations require write permissions (create, edit, merge, close)
- Use specific repository and owner names for faster responses
- Limit search results with appropriate limit parameters
- The server uses virtual threads for optimal concurrent performance
- GitHub CLI handles rate limiting automatically
- Check GitHub CLI documentation:
gh help
- Review MCP protocol: https://modelcontextprotocol.io/
- For server issues, enable debug logging in application.properties
The build process generates JAR files with version numbers in the filename (e.g., gh_mcp_server-1.0.0.jar
). When deploying or updating:
-
Initial Deployment: Use the current version in your Claude Desktop configuration:
"args": ["-jar", "/path/to/gh_mcp_server/build/libs/gh_mcp_server-1.0.0.jar"]
-
Version Updates: When updating to a new version, you must:
- Build the new version:
./gradlew build
- Update your Claude Desktop configuration with the new JAR filename
- Restart Claude Desktop to load the new version
- Build the new version:
-
Version-Independent Deployment: For easier deployment, you can:
- Use the auto-generated symlink
gh_mcp_server.jar
(created automatically during build) - Use the Gradle option (automatically uses latest build)
- Use a deployment script that handles version updates
Automatic Symlink Management: The build process automatically creates and maintains the symlink:
./gradlew build
createsgh_mcp_server.jar
→gh_mcp_server-X.Y.Z.jar
./gradlew clean build
recreates the symlink with the correct version- No manual symlink management required
- Use the auto-generated symlink
- Keep your Claude Desktop configuration in version control
- Document the specific JAR version being used in production
- Consider using environment variables for paths in deployment scripts
- Spring Boot 3.5.0 - Application framework
- Spring AI 1.0.0 - AI integration and MCP server capabilities
- Java 21 - Programming language with virtual threads support
- GitHub CLI - GitHub API integration
- Gradle - Build tool
- Spotless - Code formatting with Google Java Format
- Virtual Threads (Java 21) - Efficient concurrent I/O operations
- ProcessBuilder - Secure command execution with timeout support
- Records (Java 17) - Immutable data structures for command results
- Pattern Matching - Modern Java syntax for type checking
- String Templates - Using
String.formatted()
for cleaner string construction
This project is licensed under the MIT License - see the LICENSE file for details.