Skip to content

Commit 491b7cf

Browse files
authored
Render multi-scope tools as "any of" in generated docs
1 parent b677d37 commit 491b7cf

6 files changed

Lines changed: 44 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ The following sets of tools are available:
875875
- `type`: Type of this issue. Only use if the repository has issue types configured. Use list_issue_types tool to get valid type values for the organization. If the repository doesn't support issue types, omit this parameter. (string, optional)
876876

877877
- **list_issue_types** - List available issue types
878-
- **Required OAuth Scopes**: `repo`, `read:org`
878+
- **Required OAuth Scopes (any of)**: `repo`, `read:org`
879879
- **Accepted OAuth Scopes**: `admin:org`, `read:org`, `repo`, `write:org`
880880
- `owner`: The account owner of the repository or organization. (string, required)
881881
- `repo`: The name of the repository. When provided, returns issue types for this specific repository. When omitted, returns org-level issue types directly. (string, optional)

cmd/github-mcp-server/generate_docs.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,15 @@ func writeToolDoc(buf *strings.Builder, tool inventory.ServerTool) {
221221

222222
// OAuth scopes if present
223223
if len(tool.RequiredScopes) > 0 {
224-
fmt.Fprintf(buf, " - **Required OAuth Scopes**: `%s`\n", strings.Join(tool.RequiredScopes, "`, `"))
224+
// Scope filtering uses "any of" semantics (see scopes.HasRequiredScopes),
225+
// so when multiple required scopes are listed, render them as alternatives
226+
// rather than implying all are required.
227+
scopeList := "`" + strings.Join(tool.RequiredScopes, "`, `") + "`"
228+
if len(tool.RequiredScopes) > 1 {
229+
fmt.Fprintf(buf, " - **Required OAuth Scopes (any of)**: %s\n", scopeList)
230+
} else {
231+
fmt.Fprintf(buf, " - **Required OAuth Scopes**: %s\n", scopeList)
232+
}
225233

226234
// Only show accepted scopes if they differ from required scopes
227235
if len(tool.AcceptedScopes) > 0 && !scopesEqual(tool.RequiredScopes, tool.AcceptedScopes) {

docs/feature-flags.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ runtime behavior (such as output formatting) won't appear here.
9595
- `type`: Type of this issue. Only use if the repository has issue types configured. Use list_issue_types tool to get valid type values for the organization. If the repository doesn't support issue types, omit this parameter. (string, optional)
9696

9797
- **list_issue_fields** - List issue fields
98-
- **Required OAuth Scopes**: `repo`, `read:org`
98+
- **Required OAuth Scopes (any of)**: `repo`, `read:org`
9999
- **Accepted OAuth Scopes**: `admin:org`, `read:org`, `repo`, `write:org`
100100
- `owner`: The account owner of the repository or organization. The name is not case sensitive. (string, required)
101101
- `repo`: The name of the repository. When provided, returns fields for this specific repository (inherited from its organization). When omitted, returns org-level fields directly. (string, optional)

docs/insiders-features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ The list below is generated from the Go source. It covers tool **inventory and s
8989
- `type`: Type of this issue. Only use if the repository has issue types configured. Use list_issue_types tool to get valid type values for the organization. If the repository doesn't support issue types, omit this parameter. (string, optional)
9090

9191
- **list_issue_fields** - List issue fields
92-
- **Required OAuth Scopes**: `repo`, `read:org`
92+
- **Required OAuth Scopes (any of)**: `repo`, `read:org`
9393
- **Accepted OAuth Scopes**: `admin:org`, `read:org`, `repo`, `write:org`
9494
- `owner`: The account owner of the repository or organization. The name is not case sensitive. (string, required)
9595
- `repo`: The name of the repository. When provided, returns fields for this specific repository (inherited from its organization). When omitted, returns org-level fields directly. (string, optional)

pkg/utils/api.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,22 @@ func newDotcomHost() (APIHost, error) {
9494
}, nil
9595
}
9696

97+
// DEV-ONLY: mirror newDotcomHost but pointed at the Codespaces monolith on http://*.github.localhost.
98+
func newLocalDotcomHost() (APIHost, error) {
99+
baseRestURL, _ := url.Parse("http://api.github.localhost/")
100+
gqlURL, _ := url.Parse("http://api.github.localhost/graphql")
101+
uploadURL, _ := url.Parse("http://uploads.github.localhost/")
102+
rawURL, _ := url.Parse("http://raw.github.localhost/")
103+
authorizationServerURL, _ := url.Parse("http://github.localhost/login/oauth")
104+
return APIHost{
105+
restURL: baseRestURL,
106+
gqlURL: gqlURL,
107+
uploadURL: uploadURL,
108+
rawURL: rawURL,
109+
authorizationServerURL: authorizationServerURL,
110+
}, nil
111+
}
112+
97113
func newGHECHost(hostname string) (APIHost, error) {
98114
u, err := url.Parse(hostname)
99115
if err != nil {
@@ -235,6 +251,11 @@ func parseAPIHost(s string) (APIHost, error) {
235251
return APIHost{}, fmt.Errorf("host must have a scheme (http or https): %s", s)
236252
}
237253

254+
// DEV-ONLY: route github.localhost (Codespaces monolith) to local dotcom-style URLs.
255+
if u.Hostname() == "github.localhost" || strings.HasSuffix(u.Hostname(), ".github.localhost") {
256+
return newLocalDotcomHost()
257+
}
258+
238259
if u.Hostname() == "github.com" || strings.HasSuffix(u.Hostname(), ".github.com") {
239260
return newDotcomHost()
240261
}

script/mcp-local

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5+
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
6+
7+
go build -C "$REPO_ROOT" -o "$REPO_ROOT/bin/github-mcp-server-local" ./cmd/github-mcp-server
8+
9+
export GITHUB_PERSONAL_ACCESS_TOKEN="${MY_TOKEN:-${GITHUB_TOKEN:-$(gh auth token 2>/dev/null || true)}}"
10+
11+
exec "$REPO_ROOT/bin/github-mcp-server-local" stdio "$@"

0 commit comments

Comments
 (0)