From 22e493620cd7c64af54571e1d6920ab583f93841 Mon Sep 17 00:00:00 2001 From: Toby Padilla Date: Thu, 17 Apr 2025 04:50:19 -0600 Subject: [PATCH 1/5] fix: update json schema for `create_pull_request_review` to make OpenAI compatible (#300) Co-authored-by: Sam Morrow --- pkg/github/pullrequests.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/github/pullrequests.go b/pkg/github/pullrequests.go index 2be249c8a..b1584c0e4 100644 --- a/pkg/github/pullrequests.go +++ b/pkg/github/pullrequests.go @@ -908,30 +908,30 @@ func CreatePullRequestReview(getClient GetClientFn, t translations.TranslationHe map[string]interface{}{ "type": "object", "additionalProperties": false, - "required": []string{"path", "body"}, + "required": []string{"path", "body", "position", "line", "side", "start_line", "start_side"}, "properties": map[string]interface{}{ "path": map[string]interface{}{ "type": "string", "description": "path to the file", }, "position": map[string]interface{}{ - "type": "number", + "type": []string{"number", "null"}, "description": "position of the comment in the diff", }, "line": map[string]interface{}{ - "type": "number", + "type": []string{"number", "null"}, "description": "line number in the file to comment on. For multi-line comments, the end of the line range", }, "side": map[string]interface{}{ - "type": "string", + "type": []string{"string", "null"}, "description": "The side of the diff on which the line resides. For multi-line comments, this is the side for the end of the line range. (LEFT or RIGHT)", }, "start_line": map[string]interface{}{ - "type": "number", + "type": []string{"number", "null"}, "description": "The first line of the range to which the comment refers. Required for multi-line comments.", }, "start_side": map[string]interface{}{ - "type": "string", + "type": []string{"string", "null"}, "description": "The side of the diff on which the start line resides for multi-line comments. (LEFT or RIGHT)", }, "body": map[string]interface{}{ From aa573152726abd942a617ba0805171e29ccaa54c Mon Sep 17 00:00:00 2001 From: Sam Morrow Date: Tue, 15 Apr 2025 00:57:53 +0200 Subject: [PATCH 2/5] chore: update readme for tool paritioning --- README.md | 104 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 92 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8a5ee5394..703df68b6 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,95 @@ If you don't have Docker, you can use `go build` to build the binary in the } ``` +## Tool Configuration + +The GitHub MCP Server supports enabling or disabling specific groups of functionalities via the `--toolsets` flag. This allows you to control which GitHub API capabilities are available to your AI tools. + +### Available Toolsets + +The following sets of tools are available (all are on by default): + +| Toolset | Description | +| ----------------------- | ------------------------------------------------------------- | +| `repos` | Repository-related tools (file operations, branches, commits) | +| `issues` | Issue-related tools (create, read, update, comment) | +| `users ` | Anything relating to GitHub Users | +| `pull_requests` | Pull request operations (create, merge, review) | +| `code_security` | Code scanning alerts and security features | +| `experiments` | Experimental features (not considered stable) | + +#### Specifying Toolsets + +To reduce the available tools, you can pass an allow-list in two ways: + +1. **Using Command Line Argument**: + + ```bash + github-mcp-server --toolsets repos,issues,pull_requests,code_security + ``` + +2. **Using Environment Variable**: + ```bash + GITHUB_TOOLSETS="repos,issues,pull_requests,code_security" ./github-mcp-server + ``` + +The environment variable `GITHUB_TOOLSETS` takes precedence over the command line argument if both are provided. + +Any toolsets you specify will be enabled from the start, including when `--dynamic-toolsets` is on. + +You might want to do this if the model is confused about which tools to call and you only require a subset. + + +### Using Toolsets With Docker + +When using Docker, you can pass the toolsets as environment variables: + +```bash +docker run -i --rm \ + -e GITHUB_PERSONAL_ACCESS_TOKEN= \ + -e GITHUB_TOOLSETS="repos,issues,pull_requests,code_security,experiments" \ + ghcr.io/github/github-mcp-server +``` + +### The "all" Toolset + +The special toolset `all` can be provided to enable all available toolsets regardless of any other configuration: + +```bash +./github-mcp-server --toolsets all +``` + +Or using the environment variable: + +```bash +GITHUB_TOOLSETS="all" ./github-mcp-server +``` + +## Dynamic Tool Discovery + +Instead of starting with all tools enabled, you can turn on Dynamic Toolset Discovery. +This feature provides tools that help the MCP Host application to discover and enable sets of GitHub tools only when needed. +This helps to avoid situations where models get confused by the shear number of tools available to them, which varies by model. + +### Using Dynamic Tool Discovery + +When using the binary, you can pass the `--dynamic-toolsets` flag. + +```bash +./github-mcp-server --dynamic-toolsets +``` + +When using Docker, you can pass the toolsets as environment variables: + +```bash +docker run -i --rm \ + -e GITHUB_PERSONAL_ACCESS_TOKEN= \ + -e GITHUB_DYNAMIC_TOOLSETS=1 \ + ghcr.io/github/github-mcp-server +``` + + + ## GitHub Enterprise Server The flag `--gh-host` and the environment variable `GH_HOST` can be used to set @@ -329,7 +418,6 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description ### Repositories - **create_or_update_file** - Create or update a single file in a repository - - `owner`: Repository owner (string, required) - `repo`: Repository name (string, required) - `path`: File path (string, required) @@ -339,14 +427,12 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description - `sha`: File SHA if updating (string, optional) - **list_branches** - List branches in a GitHub repository - - `owner`: Repository owner (string, required) - `repo`: Repository name (string, required) - `page`: Page number (number, optional) - `perPage`: Results per page (number, optional) - **push_files** - Push multiple files in a single commit - - `owner`: Repository owner (string, required) - `repo`: Repository name (string, required) - `branch`: Branch to push to (string, required) @@ -354,7 +440,6 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description - `message`: Commit message (string, required) - **search_repositories** - Search for GitHub repositories - - `query`: Search query (string, required) - `sort`: Sort field (string, optional) - `order`: Sort order (string, optional) @@ -362,27 +447,23 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description - `perPage`: Results per page (number, optional) - **create_repository** - Create a new GitHub repository - - `name`: Repository name (string, required) - `description`: Repository description (string, optional) - `private`: Whether the repository is private (boolean, optional) - `autoInit`: Auto-initialize with README (boolean, optional) - **get_file_contents** - Get contents of a file or directory - - `owner`: Repository owner (string, required) - `repo`: Repository name (string, required) - `path`: File path (string, required) - `ref`: Git reference (string, optional) - **fork_repository** - Fork a repository - - `owner`: Repository owner (string, required) - `repo`: Repository name (string, required) - `organization`: Target organization name (string, optional) - **create_branch** - Create a new branch - - `owner`: Repository owner (string, required) - `repo`: Repository name (string, required) - `branch`: New branch name (string, required) @@ -403,16 +484,15 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description - `page`: Page number, for files in the commit (number, optional) - `perPage`: Results per page, for files in the commit (number, optional) -### Search - -- **search_code** - Search for code across GitHub repositories - + - **search_code** - Search for code across GitHub repositories - `query`: Search query (string, required) - `sort`: Sort field (string, optional) - `order`: Sort order (string, optional) - `page`: Page number (number, optional) - `perPage`: Results per page (number, optional) +### Users + - **search_users** - Search for GitHub users - `query`: Search query (string, required) - `sort`: Sort field (string, optional) From 11b18286d13bc8d386159a53ec063f16137abd56 Mon Sep 17 00:00:00 2001 From: Sam Morrow Date: Tue, 15 Apr 2025 01:00:06 +0200 Subject: [PATCH 3/5] Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 703df68b6..574c60f63 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ The following sets of tools are available (all are on by default): | ----------------------- | ------------------------------------------------------------- | | `repos` | Repository-related tools (file operations, branches, commits) | | `issues` | Issue-related tools (create, read, update, comment) | -| `users ` | Anything relating to GitHub Users | +| `users` | Anything relating to GitHub Users | | `pull_requests` | Pull request operations (create, merge, review) | | `code_security` | Code scanning alerts and security features | | `experiments` | Experimental features (not considered stable) | From 89914364974088cda9bec4fd559afaf1123e462f Mon Sep 17 00:00:00 2001 From: Toby Padilla Date: Wed, 16 Apr 2025 14:08:36 -0600 Subject: [PATCH 4/5] docs: update toolset copy --- README.md | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 574c60f63..5493adba6 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ If you don't have Docker, you can use `go build` to build the binary in the ## Tool Configuration -The GitHub MCP Server supports enabling or disabling specific groups of functionalities via the `--toolsets` flag. This allows you to control which GitHub API capabilities are available to your AI tools. +The GitHub MCP Server supports enabling or disabling specific groups of functionalities via the `--toolsets` flag. This allows you to control which GitHub API capabilities are available to your AI tools. Enabling only the toolsets that you need can help the LLM with tool choice and reduce the context size. ### Available Toolsets @@ -127,7 +127,7 @@ The following sets of tools are available (all are on by default): #### Specifying Toolsets -To reduce the available tools, you can pass an allow-list in two ways: +To specify toolsets you want available to the LLM, you can pass an allow-list in two ways: 1. **Using Command Line Argument**: @@ -142,11 +142,6 @@ To reduce the available tools, you can pass an allow-list in two ways: The environment variable `GITHUB_TOOLSETS` takes precedence over the command line argument if both are provided. -Any toolsets you specify will be enabled from the start, including when `--dynamic-toolsets` is on. - -You might want to do this if the model is confused about which tools to call and you only require a subset. - - ### Using Toolsets With Docker When using Docker, you can pass the toolsets as environment variables: @@ -174,9 +169,9 @@ GITHUB_TOOLSETS="all" ./github-mcp-server ## Dynamic Tool Discovery -Instead of starting with all tools enabled, you can turn on Dynamic Toolset Discovery. -This feature provides tools that help the MCP Host application to discover and enable sets of GitHub tools only when needed. -This helps to avoid situations where models get confused by the shear number of tools available to them, which varies by model. +**Note**: This feature is currently in beta and may not be available in all environments. Please test it out and let us know if you encounter any issues. + +Instead of starting with all tools enabled, you can turn on dynamic toolset discovery. Dynamic toolsets allow the MCP host to list and enable toolsets in response to a user prompt. This should help to avoid situations where the model gets confused by the shear number of tools available. ### Using Dynamic Tool Discovery @@ -195,8 +190,6 @@ docker run -i --rm \ ghcr.io/github/github-mcp-server ``` - - ## GitHub Enterprise Server The flag `--gh-host` and the environment variable `GH_HOST` can be used to set From 2cece8f979aa4d08dc34077dbf6b8b45c31ea194 Mon Sep 17 00:00:00 2001 From: Sam Morrow Date: Thu, 17 Apr 2025 16:05:09 +0200 Subject: [PATCH 5/5] fix: incorrect env var in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5493adba6..bf0bcce37 100644 --- a/README.md +++ b/README.md @@ -192,7 +192,7 @@ docker run -i --rm \ ## GitHub Enterprise Server -The flag `--gh-host` and the environment variable `GH_HOST` can be used to set +The flag `--gh-host` and the environment variable `GITHUB_HOST` can be used to set the GitHub Enterprise Server hostname. ## i18n / Overriding Descriptions