Get the FREE Ultimate OpenClaw Setup Guide →

github -go

An unofficial implementation of an mcp server for github in go. Used internally at Metoro.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio metoro-io-github-mcp-server-go go run main.go \
  --env GITHUB_PERSONAL_ACCESS_TOKEN="your_github_token"

How to use

This MCP server provides a Go implementation of the GitHub Model Context Protocol (MCP), enabling AI assistants to interact with the GitHub API to perform common repository operations. After starting the server with your GitHub token configured, you can leverage the available tools to search repositories, create repositories, manage branches, read and write files, and handle issues and commits. The server authenticates via an environment variable or an Authorization header, and supports both standard HTTP requests and Gin context integration for authentication passthrough, ensuring flexibility across frameworks.

To use the tools, supply the appropriate authentication token and issue commands through the MCP interface. The server exposes tools such as search_repositories, create_repository, fork_repository, create_branch, get_file_contents, create_or_update_file, push_files, create_issue, get_issue, list_issues, update_issue, add_issue_comment, list_commits, search_code, search_issues, and search_users. Each tool corresponds to a GitHub API operation, allowing you to perform tasks ranging from repository creation to content manipulation and issue management directly via MCP calls.

How to install

Prerequisites:

  • Go 1.21 or higher
  • A GitHub personal access token with appropriate permissions

Installation steps:

  1. Install Go if you haven't already (https://golang.org/dl/).
  2. Retrieve the MCP server package:
go get github.com/metoro-io/github-mcp-server-go
  1. Ensure your environment variable for authentication is set, or prepare to pass tokens via HTTP headers (see Authentication section in README).

  2. Run the server from the project directory:

go run main.go

Optional: Build a binary for deployment:

go build -o github-mcp-server

Note: If you prefer to build and run with a specific module layout, adjust the path to main.go accordingly.

Additional notes

Environment and authentication:

  • Set GITHUB_PERSONAL_ACCESS_TOKEN for environment-based authentication.
  • Alternatively, you can provide the token via the HTTP Authorization header (Bearer token or just the token).
  • The server supports context passthrough for HTTP requests and Gin frameworks, enabling seamless integration with existing web services.

Operational tips:

  • Ensure the GitHub token has scopes required by the operations you intend to perform (repo, workflow, admin:repo_hook, etc. as needed).
  • When using push_files or create_or_update_file, provide precise file paths and contents to avoid unintended overwrites.
  • Use list_issues and search_* tools with appropriate filters to manage large repositories efficiently.

Common issues:

  • If the server fails to authenticate, verify that the token is valid and has the necessary scopes.
  • Ensure network access to GitHub APIs and that rate limits are considered in long-running automation.

Related MCP Servers

Sponsor this space

Reach thousands of developers