-
Notifications
You must be signed in to change notification settings - Fork 2.4k
feat: add CreateRelease tool for GitHub releases #1015
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
base: main
Are you sure you want to change the base?
Conversation
Implements a new CreateRelease tool following the existing pattern used by CreateRepository and other create operations. Features: - Creates GitHub releases with tag name, target commitish, and release notes - Supports draft and prerelease flags - Supports automatic release notes generation - Comprehensive test coverage following existing test patterns Closes github#1012
Addresses Copilot review comment - the response body was being closed before attempting to read it in the error case. Now we only close it after reading when needed.
Put single defer statement right after successful API call to ensure body is closed in all paths. Removes duplicate defer statements.
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.
Pull Request Overview
This PR adds a new CreateRelease
tool to the GitHub MCP server, enabling programmatic creation of GitHub releases. This complements the existing create tools (repository, issue, pull request) and addresses a gap in the server's GitHub operations support.
Key changes:
- Added
CreateRelease
tool with comprehensive parameter support (required: owner, repo, tag_name; optional: target_commitish, name, body, draft, prerelease, generate_release_notes) - Implemented proper error handling and response formatting following established patterns
- Added comprehensive test coverage with table-driven tests for success and error scenarios
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
pkg/github/tools.go | Registers the new CreateRelease tool in the default toolset |
pkg/github/create_release.go | Implements the CreateRelease tool with parameter validation and GitHub API integration |
pkg/github/create_release_test.go | Comprehensive test suite covering success cases and error handling |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
this release was created via Claude Code using this MCP as built from this branch ![]() |
Summary
This PR adds a new
CreateRelease
tool to the GitHub MCP server, enabling users to create GitHub releases programmatically through the MCP interface.Motivation
As discussed in #1012, the GitHub MCP server currently supports reading release information but lacks the ability to create releases. This is a common need for CI/CD workflows and automation tasks. The addition of
CreateRelease
complements the existingCreateRepository
,CreateIssue
, andCreatePullRequest
tools, providing a more complete set of GitHub operations.Implementation
The implementation follows the established patterns in the codebase:
GetClientFn
pattern as other toolsCreateRepository
mcp.NewToolResultError
Features
The
CreateRelease
tool supports:owner
,repo
,tag_name
target_commitish
: Branch or commit SHA for the releasename
: Release namebody
: Release descriptiondraft
: Create as draft releaseprerelease
: Mark as pre-releasegenerate_release_notes
: Auto-generate release notes from commitsTesting
Added comprehensive test coverage including:
Checklist
Example Usage