Skip to content

Commit 334892b

Browse files
authored
Merge pull request #142 from maartenvandiemen/feature/pass-toolsets
Pass GitHub MCP Tools
2 parents 112739f + bbe0ccb commit 334892b

File tree

13 files changed

+108
-30
lines changed

13 files changed

+108
-30
lines changed

.github/workflows/check-dist.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ jobs:
2828
steps:
2929
- name: Checkout
3030
id: checkout
31-
uses: actions/checkout@v5
31+
uses: actions/checkout@v6
3232

3333
- name: Setup Node.js
3434
id: setup-node
35-
uses: actions/setup-node@v4
35+
uses: actions/setup-node@v6
3636
with:
3737
node-version-file: .node-version
3838
cache: npm
@@ -66,7 +66,7 @@ jobs:
6666
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
6767
name: Upload Artifact
6868
id: upload
69-
uses: actions/upload-artifact@v4
69+
uses: actions/upload-artifact@v5
7070
with:
7171
name: dist
7272
path: dist/

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ jobs:
2020
steps:
2121
- name: Checkout
2222
id: checkout
23-
uses: actions/checkout@v5
23+
uses: actions/checkout@v6
2424

2525
- name: Setup Node.js
2626
id: setup-node
27-
uses: actions/setup-node@v4
27+
uses: actions/setup-node@v6
2828
with:
2929
node-version-file: .node-version
3030
cache: npm
@@ -54,7 +54,7 @@ jobs:
5454
steps:
5555
- name: Checkout
5656
id: checkout
57-
uses: actions/checkout@v5
57+
uses: actions/checkout@v6
5858

5959
- name: Setup Node.js
6060
uses: actions/setup-node@v4
@@ -108,7 +108,7 @@ jobs:
108108
steps:
109109
- name: Checkout
110110
id: checkout
111-
uses: actions/checkout@v5
111+
uses: actions/checkout@v6
112112

113113
- name: Setup Node.js
114114
uses: actions/setup-node@v4

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ jobs:
3030
steps:
3131
- name: Checkout
3232
id: checkout
33-
uses: actions/checkout@v5
33+
uses: actions/checkout@v6
3434

3535
- name: Initialize CodeQL
3636
id: initialize
37-
uses: github/codeql-action/init@v3
37+
uses: github/codeql-action/init@v4
3838
with:
3939
languages: ${{ matrix.language }}
4040
source-root: src
4141

4242
- name: Autobuild
4343
id: autobuild
44-
uses: github/codeql-action/autobuild@v3
44+
uses: github/codeql-action/autobuild@v4
4545

4646
- name: Perform CodeQL Analysis
4747
id: analyze
48-
uses: github/codeql-action/analyze@v3
48+
uses: github/codeql-action/analyze@v4

.github/workflows/licensed.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ jobs:
2727
steps:
2828
- name: Checkout
2929
id: checkout
30-
uses: actions/checkout@v5
30+
uses: actions/checkout@v6
3131

3232
- name: Setup Node.js
3333
id: setup-node
34-
uses: actions/setup-node@v4
34+
uses: actions/setup-node@v6
3535
with:
3636
node-version-file: .node-version
3737
cache: npm
@@ -42,7 +42,7 @@ jobs:
4242

4343
- name: Setup Ruby
4444
id: setup-ruby
45-
uses: ruby/setup-ruby@829114fc20da43a41d27359103ec7a63020954d4
45+
uses: ruby/setup-ruby@8aeb6ff8030dd539317f8e1769a044873b56ea71
4646
with:
4747
ruby-version: ruby
4848

.github/workflows/linter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
steps:
2222
- name: Checkout
2323
id: checkout
24-
uses: actions/checkout@v5
24+
uses: actions/checkout@v6
2525
with:
2626
fetch-depth: 0
2727

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,25 @@ steps:
201201
github-mcp-token: ${{ secrets.USER_PAT }} # or a ghs_ installation token
202202
```
203203

204+
#### Configuring GitHub MCP Toolsets
205+
206+
By default, the GitHub MCP server provides a standard set of tools (`context`, `repos`, `issues`, `pull_requests`, `users`). You can customize which toolsets are available by specifying the `github-mcp-toolsets` parameter:
207+
208+
```yaml
209+
steps:
210+
- name: AI Inference with Custom Toolsets
211+
id: inference
212+
uses: actions/ai-inference@v2
213+
with:
214+
prompt: 'Analyze recent workflow runs and check security alerts'
215+
enable-github-mcp: true
216+
token: ${{ secrets.USER_PAT }}
217+
github-mcp-toolsets: 'repos,issues,pull_requests,actions,code_security'
218+
```
219+
220+
**Available toolsets:**
221+
See: [Tool configuration](https://github.com/github/github-mcp-server/blob/main/README.md#tool-configuration)
222+
204223
When MCP is enabled, the AI model will have access to GitHub tools and can
205224
perform actions like searching issues and PRs.
206225

__tests__/main.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ describe('main.ts', () => {
195195

196196
await run()
197197

198-
expect(mockConnectToGitHubMCP).toHaveBeenCalledWith('fake-token')
198+
expect(mockConnectToGitHubMCP).toHaveBeenCalledWith('fake-token', '')
199199
expect(mockMcpInference).toHaveBeenCalledWith(
200200
expect.objectContaining({
201201
messages: [
@@ -222,7 +222,7 @@ describe('main.ts', () => {
222222

223223
await run()
224224

225-
expect(mockConnectToGitHubMCP).toHaveBeenCalledWith('fake-token')
225+
expect(mockConnectToGitHubMCP).toHaveBeenCalledWith('fake-token', '')
226226
expect(mockSimpleInference).toHaveBeenCalled()
227227
expect(mockMcpInference).not.toHaveBeenCalled()
228228
expect(core.warning).toHaveBeenCalledWith('MCP connection failed, falling back to simple inference')

__tests__/mcp.test.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,40 @@ describe('mcp.ts', () => {
113113
expect(result?.tools).toHaveLength(0)
114114
expect(core.info).toHaveBeenCalledWith('Retrieved 0 tools from GitHub MCP server')
115115
})
116+
117+
it('uses default toolsets when toolsets parameter is not provided', async () => {
118+
const token = 'test-token'
119+
120+
mockConnect.mockResolvedValue(undefined)
121+
mockListTools.mockResolvedValue({tools: []})
122+
123+
await connectToGitHubMCP(token)
124+
125+
expect(core.info).toHaveBeenCalledWith('Using default GitHub MCP toolsets')
126+
})
127+
128+
it('uses custom toolsets when toolsets parameter is provided', async () => {
129+
const token = 'test-token'
130+
const toolsets = 'repos,issues,pull_requests,actions'
131+
132+
mockConnect.mockResolvedValue(undefined)
133+
mockListTools.mockResolvedValue({tools: []})
134+
135+
await connectToGitHubMCP(token, toolsets)
136+
137+
expect(core.info).toHaveBeenCalledWith('Using GitHub MCP toolsets: repos,issues,pull_requests,actions')
138+
})
139+
140+
it('ignores empty toolsets parameter', async () => {
141+
const token = 'test-token'
142+
143+
mockConnect.mockResolvedValue(undefined)
144+
mockListTools.mockResolvedValue({tools: []})
145+
146+
await connectToGitHubMCP(token, ' ')
147+
148+
expect(core.info).toHaveBeenCalledWith('Using default GitHub MCP toolsets')
149+
})
116150
})
117151

118152
describe('executeToolCall', () => {

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ inputs:
5858
description: The token to use for GitHub MCP server (defaults to the main token if not specified). This must be a PAT for MCP to work.
5959
required: false
6060
default: ''
61+
github-mcp-toolsets:
62+
description: 'Comma-separated list of toolsets to enable for GitHub MCP (e.g., "repos,issues,pull_requests,actions"). Use "all" for all toolsets, "default" for default set. If not specified, uses default toolsets (context,repos,issues,pull_requests,users).'
63+
required: false
64+
default: ''
6165

6266
# Define your outputs here.
6367
outputs:

dist/index.js

Lines changed: 16 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)