Skip to content

Commit d7be203

Browse files
committed
Refactor GitHub tools to use GraphQL for organization members and outside collaborators
- Updated GetOrgMembers to utilize GraphQL for fetching organization members with roles. - Refactored ListOutsideCollaborators to use the GitHub API for listing outside collaborators. - Improved error handling and response structures in both tools. - Added tests for new GraphQL implementations and ensured compatibility with existing functionality.
1 parent bede236 commit d7be203

File tree

8 files changed

+268
-445
lines changed

8 files changed

+268
-445
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -672,9 +672,9 @@ The following sets of tools are available:
672672
- No parameters required
673673

674674
- **get_org_members** - Get organization members
675+
- **Required OAuth Scopes**: `read:org`
676+
- **Accepted OAuth Scopes**: `admin:org`, `read:org`, `write:org`
675677
- `org`: Organization login (owner) to get members for. (string, required)
676-
- `page`: Page number for pagination (number, optional)
677-
- `per_page`: Results per page (max 100) (number, optional)
678678
- `role`: Filter by role: all, admin, member (string, optional)
679679

680680
- **get_team_members** - Get team members
@@ -689,9 +689,9 @@ The following sets of tools are available:
689689
- `user`: Username to get teams for. If not provided, uses the authenticated user. (string, optional)
690690

691691
- **list_outside_collaborators** - List outside collaborators
692+
- **Required OAuth Scopes**: `read:org`
693+
- **Accepted OAuth Scopes**: `admin:org`, `read:org`, `write:org`
692694
- `org`: The organization name (string, required)
693-
- `page`: Page number for pagination (number, optional)
694-
- `per_page`: Results per page (max 100) (number, optional)
695695

696696
</details>
697697

go.mod

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module github.com/github/github-mcp-server
22

3-
go 1.24.0
3+
go 1.24.4
4+
5+
toolchain go1.24.11
46

57
require (
68
github.com/google/go-github/v79 v79.0.0
@@ -13,6 +15,12 @@ require (
1315
github.com/stretchr/testify v1.11.1
1416
)
1517

18+
require (
19+
github.com/google/go-github/v73 v73.0.0 // indirect
20+
github.com/gorilla/mux v1.8.1 // indirect
21+
golang.org/x/time v0.11.0 // indirect
22+
)
23+
1624
require (
1725
github.com/aymerick/douceur v0.2.0 // indirect
1826
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
@@ -27,6 +35,7 @@ require (
2735
github.com/josharian/intern v1.0.0 // indirect
2836
github.com/lithammer/fuzzysearch v1.1.8
2937
github.com/mailru/easyjson v0.7.7 // indirect
38+
github.com/migueleliasweb/go-github-mock v1.5.0
3039
github.com/modelcontextprotocol/go-sdk v1.2.0
3140
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
3241
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect

go.sum

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVI
2424
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
2525
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
2626
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
27+
github.com/google/go-github/v73 v73.0.0 h1:aR+Utnh+Y4mMkS+2qLQwcQ/cF9mOTpdwnzlaw//rG24=
28+
github.com/google/go-github/v73 v73.0.0/go.mod h1:fa6w8+/V+edSU0muqdhCVY7Beh1M8F1IlQPZIANKIYw=
2729
github.com/google/go-github/v79 v79.0.0 h1:MdodQojuFPBhmtwHiBcIGLw/e/wei2PvFX9ndxK0X4Y=
2830
github.com/google/go-github/v79 v79.0.0/go.mod h1:OAFbNhq7fQwohojb06iIIQAB9CBGYLq999myfUFnrS4=
2931
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
@@ -32,6 +34,8 @@ github.com/google/jsonschema-go v0.4.2 h1:tmrUohrwoLZZS/P3x7ex0WAVknEkBZM46iALbc
3234
github.com/google/jsonschema-go v0.4.2/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE=
3335
github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8=
3436
github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0=
37+
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
38+
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
3539
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
3640
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
3741
github.com/josephburnett/jd v1.9.2 h1:ECJRRFXCCqbtidkAHckHGSZm/JIaAxS1gygHLF8MI5Y=
@@ -55,6 +59,8 @@ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0
5559
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
5660
github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk=
5761
github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA=
62+
github.com/migueleliasweb/go-github-mock v1.5.0 h1:dIr6vgVz8QY9sDiDopWxk6pDw4d7K/xIcCk/NQe4ajM=
63+
github.com/migueleliasweb/go-github-mock v1.5.0/go.mod h1:/DUmhXkxrgVlDOVBqGoUXkV4w0ms5n1jDQHotYm135o=
5864
github.com/modelcontextprotocol/go-sdk v1.2.0 h1:Y23co09300CEk8iZ/tMxIX1dVmKZkzoSBZOpJwUnc/s=
5965
github.com/modelcontextprotocol/go-sdk v1.2.0/go.mod h1:6fM3LCm3yV7pAs8isnKLn07oKtB0MP9LHd3DfAcKw10=
6066
github.com/muesli/cache2go v0.0.0-20221011235721-518229cd8021 h1:31Y+Yu373ymebRdJN1cWLLooHH8xAr0MhKTEJGV/87g=
@@ -138,6 +144,8 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
138144
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
139145
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
140146
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
147+
golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0=
148+
golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
141149
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
142150
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
143151
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=

pkg/github/__toolsnaps__/get_org_members.snap

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"annotations": {
3-
"title": "Get organization members",
4-
"readOnlyHint": true
3+
"readOnlyHint": true,
4+
"title": "Get organization members"
55
},
66
"description": "Get member users of a specific organization. Returns a list of user objects with fields: login, id, avatar_url, type. Limited to organizations accessible with current credentials",
77
"inputSchema": {
@@ -10,14 +10,6 @@
1010
"description": "Organization login (owner) to get members for.",
1111
"type": "string"
1212
},
13-
"page": {
14-
"description": "Page number for pagination",
15-
"type": "number"
16-
},
17-
"per_page": {
18-
"description": "Results per page (max 100)",
19-
"type": "number"
20-
},
2113
"role": {
2214
"description": "Filter by role: all, admin, member",
2315
"type": "string"

pkg/github/__toolsnaps__/list_outside_collaborators.snap

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
{
22
"annotations": {
3-
"title": "List outside collaborators",
4-
"readOnlyHint": true
3+
"readOnlyHint": true,
4+
"title": "List outside collaborators"
55
},
66
"description": "List all outside collaborators of an organization (users with access to organization repositories but not members).",
77
"inputSchema": {
88
"properties": {
99
"org": {
1010
"description": "The organization name",
1111
"type": "string"
12-
},
13-
"page": {
14-
"description": "Page number for pagination",
15-
"type": "number"
16-
},
17-
"per_page": {
18-
"description": "Results per page (max 100)",
19-
"type": "number"
2012
}
2113
},
2214
"required": [

0 commit comments

Comments
 (0)