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 71b96e2
Browse filesBrowse the repository at this point in the historyBrowse files
Merge remote-tracking branch 'origin/main' into docs/oauth-proxy-dcr-clarification
Keep main's request-state encryption section and the note that the override only changes advertised metadata. Describe what an OAuth proxy must provide and that the flag does not apply to the hosted server.
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
+17-28Lines changed: 17 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,12 +5,11 @@
5
5
This is the **GitHub MCP Server**, a Model Context Protocol (MCP) server that connects AI tools to GitHub's platform. It enables AI agents to manage repositories, issues, pull requests, workflows, and more through natural language.
6
6
7
7
**Key Details:**
8
-
-**Language:** Go 1.27.3+ (~38k lines of code)
8
+
-**Language:** Go 1.27.4+ (~38k lines of code)
9
9
-**Type:** MCP server application with CLI interface
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,21 +173,17 @@ 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/`
186
+
2. Register tool in appropriate toolset in `pkg/github/`
192
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.
193
188
4. Write unit tests following the tool test pattern
194
189
5. Run `UPDATE_TOOLSNAPS=true go test ./...` to create snapshot
@@ -277,22 +272,16 @@ server.json - MCP server registry metadata
277
272
### Main Entry Point
278
273
279
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
287
-
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.
288
-
3.**ALWAYS** trust these instructions first - only search if information is incomplete or incorrect
289
-
4.**NEVER** use `script/tag-release` or push tags
290
-
5.**NEVER** skip `script/lint` before committing Go code changes
291
-
6.**ALWAYS** update toolsnaps when changing MCP tool schemas
292
-
7.**ALWAYS** run `script/generate-docs` after modifying tools
293
-
8. For specific test files, use `go test ./path -run TestName` not full suite
294
-
9. E2E tests require PAT token - you likely cannot run them
295
-
10. Toolsnaps are API documentation - treat changes seriously
296
-
11. Build/test/lint are very fast (~1s each) - run frequently
297
-
12. CI failures for docs-check or license-check have simple fixes (run the script)
298
-
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)
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ Thanks for contributing and for helping us build toolsets that are truly valuabl
26
26
27
27
These are one time installations required to be able to test your changes locally as part of the pull request (PR) submission process.
28
28
29
-
1. Install Go 1.27.3 or later [through download](https://go.dev/doc/install) | [through Homebrew](https://formulae.brew.sh/formula/go)
29
+
1. Install Go 1.27.4 or later [through download](https://go.dev/doc/install) | [through Homebrew](https://formulae.brew.sh/formula/go)
30
30
2.[Install golangci-lint v2.14.0](https://golangci-lint.run/welcome/install/#local-installation), or let `script/lint` install the repository-pinned version. The pinned version supports both Go 1.26 and Go 1.27.
0 commit comments