You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 08f6c98
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: .github/agents/go-sdk-tool-migrator.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ When generating the migration guide, consider the following aspects:
15
15
16
16
* The initial tool file and its corresponding test file will have the `//go:build ignore` build tag, as the tests will fail if the code is not ignored. The `ignore` build tag should be removed before work begins.
17
17
* The import for `github.com/mark3labs/mcp-go/mcp` should be changed to `github.com/modelcontextprotocol/go-sdk/mcp`
18
-
* The return type for the tool constructor function should be updated from `mcp.Tool, server.ToolHandlerFunc` to `(mcp.Tool, mcp.ToolHandlerFor[map[string]any, any])`.
18
+
* The return type for the tool constructor function should be updated from `mcp.Tool, server.ToolHandlerFunc` to `inventory.ServerTool`.
19
19
* The tool handler function signature should be updated to use generics, changing from `func(ctx context.Context, mcp.CallToolRequest) (*mcp.CallToolResult, error)` to `func(context.Context, *mcp.CallToolRequest, map[string]any) (*mcp.CallToolResult, any, error)`.
20
20
* The `RequiredParam`, `RequiredInt`, `RequiredBigInt`, `OptionalParamOK`, `OptionalParam`, `OptionalIntParam`, `OptionalIntParamWithDefault`, `OptionalBoolParamWithDefault`, `OptionalStringArrayParam`, `OptionalBigIntArrayParam` and `OptionalCursorPaginationParams` functions should be changed to use the tool arguments that are now passed as a map in the tool handler function, rather than extracting them from the `mcp.CallToolRequest`.
21
21
*`mcp.NewToolResultText`, `mcp.NewToolResultError`, `mcp.NewToolResultErrorFromErr` and `mcp.NewToolResultResource` no longer available in `modelcontextprotocol/go-sdk`. There are a few helper functions available in `pkg/utils/result.go` that can be used to replace these, in the `utils` package.
@@ -64,7 +64,7 @@ The corresponding input schema in modelcontextprotocol/go-sdk would look like th
64
64
65
65
```go
66
66
...
67
-
return mcp.Tool{
67
+
tool:= mcp.Tool{
68
68
Name: "list_dependabot_alerts",
69
69
Description: t("TOOL_LIST_DEPENDABOT_ALERTS_DESCRIPTION", "List dependabot alerts in a GitHub repository."),
70
70
Annotations: &mcp.ToolAnnotations{
@@ -86,7 +86,7 @@ return mcp.Tool{
86
86
Type: "string",
87
87
Description: "Filter dependabot alerts by state. Defaults to open",
@@ -109,4 +109,4 @@ At the end of your changes, you will continue to have an issue with the `toolsna
109
109
UPDATE_TOOLSNAPS=true go test ./...
110
110
```
111
111
112
-
You should however, only update the toolsnaps after confirming that the schema changes are intentional and correct. Some schema changes are unavoidable, such as argument ordering, however the schemas themselves should remain logically equivalent.
112
+
You should however, only update the toolsnaps after confirming that the schema changes are intentional and correct. Some schema changes are unavoidable, however the schemas themselves should remain logically equivalent.
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+27-31Lines changed: 27 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,6 @@ This is the **GitHub MCP Server**, a Model Context Protocol (MCP) server that co
10
10
-**Primary Package:** github-mcp-server (stdio MCP server - **this is the main focus**)
11
11
-**Secondary Package:** mcpcurl (testing utility - don't break it, but not the priority)
12
12
-**Framework:** Uses modelcontextprotocol/go-sdk for MCP protocol, google/go-github for GitHub API
13
-
-**Size:**~60MB repository, 70 Go files
14
13
-**Library Usage:** This repository is also used as a library by the remote server. Functions that could be called by other repositories should be exported (capitalized), even if not required internally. Preserve existing export patterns.
15
14
16
15
**Code Quality Standards:**
@@ -71,7 +70,7 @@ go test ./pkg/github -run TestGetMe
71
70
├── pkg/ # Public API packages
72
71
│ ├── github/ # GitHub API MCP tools implementation
**All of these must pass for PR merge.** If docs-check fails, run `script/generate-docs` and commit changes.
@@ -130,7 +129,7 @@ All workflows run on push/PR unless noted. Located in `.github/workflows/`:
130
129
### Unit Tests
131
130
132
131
- Use `testify` for assertions (`require` for critical checks, `assert` for non-blocking)
133
-
- Tests are in `*_test.go` files alongside implementation (internal tests, not `_test` package)
132
+
- Tests are in `*_test.go` files alongside implementation (internal and external test packages)
134
133
- Mock GitHub API with `go-github-mock` (REST) or `githubv4mock` (GraphQL)
135
134
- Test structure for tools:
136
135
1. Test tool snapshot
@@ -174,27 +173,30 @@ All workflows run on push/PR unless noted. Located in `.github/workflows/`:
174
173
### Code Patterns
175
174
176
175
-**Keep changes minimal and focused** on the specific issue being addressed
177
-
-**Prefer clarity over cleverness** - code must be understandable by a wide audience
178
176
-**Atomic commits** - each commit should be a complete, logical change
179
-
-**Maintain or improve structure** - never degrade code organization
180
177
- Use table-driven tests for behavioral testing
181
-
- Comment sparingly - code should be self-documenting
182
178
- Follow standard Go conventions (Effective Go, Go proverbs)
183
179
-**Test changes thoroughly** before committing
184
-
- Export functions (capitalize) if they could be used by other repos as a library
185
180
186
181
## Common Development Workflows
187
182
188
183
### Adding a New MCP Tool
189
184
190
185
1. Add tool implementation in `pkg/github/` (e.g., `foo_tools.go`)
191
-
2. Register tool in appropriate toolset in `pkg/github/` or `pkg/toolsets/`
192
-
3. Write unit tests following the tool test pattern
193
-
4. Run `UPDATE_TOOLSNAPS=true go test ./...` to create snapshot
194
-
5. Run `script/generate-docs` to update README
195
-
6. Run `script/lint` and `script/test` before committing
196
-
7. If e2e tests are relevant, update `e2e/e2e_test.go` using existing test style
197
-
8. Commit code + snapshots + README changes together
186
+
2. Register tool in appropriate toolset in `pkg/github/`
187
+
3. Update the relevant bundled skill, or add a reasoned exemption in `pkg/skills/catalog/availability_test.go`. Every tool must be covered or explicitly exempted.
188
+
4. Write unit tests following the tool test pattern
189
+
5. Run `UPDATE_TOOLSNAPS=true go test ./...` to create snapshot
190
+
6. Run `script/generate-docs` to update README
191
+
7. Run `script/lint` and `script/test` before committing
192
+
8. If e2e tests are relevant, update `e2e/e2e_test.go` using existing test style
193
+
9. Commit code + snapshots + README changes together
194
+
195
+
When adding or changing a toolset `InstructionsFunc`, update the associated
196
+
skills as well: skills mode suppresses those instructions. The
197
+
`TestToolsetInstructionsAreCoveredBySkills` failure names the skills to revisit;
198
+
after updating them, refresh its digest with
199
+
`UPDATE_SKILLS_INSTRUCTIONS=true go test ./pkg/github -run TestToolsetInstructionsAreCoveredBySkills -count=1`.
198
200
199
201
### Fixing a Bug
200
202
@@ -270,22 +272,16 @@ server.json - MCP server registry metadata
270
272
### Main Entry Point
271
273
272
274
`cmd/github-mcp-server/main.go` - Uses cobra for CLI, viper for config, supports:
1.**PRIMARY FOCUS:** The local stdio MCP server (github-mcp-server) - this is what you should work on and test with
280
-
2.**REMOTE SERVER:** Ignore remote server instructions when making code changes (unless specifically asked). This repo is used as a library by the remote server, so keep functions exported (capitalized) if they could be called by other repos, even if not needed internally.
281
-
3.**ALWAYS** trust these instructions first - only search if information is incomplete or incorrect
282
-
4.**NEVER** use `script/tag-release` or push tags
283
-
5.**NEVER** skip `script/lint` before committing Go code changes
284
-
6.**ALWAYS** update toolsnaps when changing MCP tool schemas
285
-
7.**ALWAYS** run `script/generate-docs` after modifying tools
286
-
8. For specific test files, use `go test ./path -run TestName` not full suite
287
-
9. E2E tests require PAT token - you likely cannot run them
288
-
10. Toolsnaps are API documentation - treat changes seriously
289
-
11. Build/test/lint are very fast (~1s each) - run frequently
290
-
12. CI failures for docs-check or license-check have simple fixes (run the script)
291
-
13. mcpcurl is secondary - don't break it, but it's not the priority
281
+
1.**REMOTE SERVER:** Ignore remote server instructions when making code changes (unless specifically asked). This repo is used as a library by the remote server, so keep functions exported (capitalized) if they could be called by other repos, even if not needed internally.
282
+
2.**ALWAYS** trust these instructions first - only search if information is incomplete or incorrect
283
+
3.**NEVER** use `script/tag-release` or push tags
284
+
4. For specific test files, use `go test ./path -run TestName` not full suite
285
+
5. Toolsnaps are API documentation - treat changes seriously
286
+
6. Build/test/lint are very fast (~1s each) - run frequently
287
+
7. CI failures for docs-check or license-check have simple fixes (run the script)
0 commit comments