Skip to content

Commit 658df29

Browse files
Merge branch 'main' into fix-ring-buffer-panic
2 parents 1b1676d + 82c4930 commit 658df29

File tree

160 files changed

+11833
-8515
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+11833
-8515
lines changed

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This is the **GitHub MCP Server**, a Model Context Protocol (MCP) server that co
99
- **Type:** MCP server application with CLI interface
1010
- **Primary Package:** github-mcp-server (stdio MCP server - **this is the main focus**)
1111
- **Secondary Package:** mcpcurl (testing utility - don't break it, but not the priority)
12-
- **Framework:** Uses mark3labs/mcp-go for MCP protocol, google/go-github for GitHub API
12+
- **Framework:** Uses modelcontextprotocol/go-sdk for MCP protocol, google/go-github for GitHub API
1313
- **Size:** ~60MB repository, 70 Go files
1414
- **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.
1515

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,13 @@ See [Remote Server Documentation](docs/remote-server.md) for full details on rem
9595

9696
When no toolsets are specified, [default toolsets](#default-toolset) are used.
9797

98-
#### Enterprise Cloud with data residency (ghe.com)
98+
#### GitHub Enterprise
99+
100+
##### GitHub Enterprise Cloud with data residency (ghe.com)
99101

100102
GitHub Enterprise Cloud can also make use of the remote server.
101103

102-
Example for `https://octocorp.ghe.com`:
104+
Example for `https://octocorp.ghe.com` with GitHub PAT token:
103105
```
104106
{
105107
...
@@ -114,6 +116,10 @@ Example for `https://octocorp.ghe.com`:
114116
}
115117
```
116118

119+
> **Note:** When using OAuth with GitHub Enterprise with VS Code and GitHub Copilot, you also need to configure your VS Code settings to point to your GitHub Enterprise instance - see [Authenticate from VS Code](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/configure-personal-settings/authenticate-to-ghecom)
120+
121+
##### GitHub Enterprise Server
122+
117123
GitHub Enterprise Server does not support remote server hosting. Please refer to [GitHub Enterprise Server and Enterprise Cloud with data residency (ghe.com)](#github-enterprise-server-and-enterprise-cloud-with-data-residency-ghecom) from the local server configuration.
118124

119125
---
@@ -719,8 +725,8 @@ The following sets of tools are available:
719725

720726
- **issue_read** - Get issue details
721727
- `issue_number`: The number of the issue (number, required)
722-
- `method`: The read operation to perform on a single issue.
723-
Options are:
728+
- `method`: The read operation to perform on a single issue.
729+
Options are:
724730
1. get - Get details of a specific issue.
725731
2. get_comments - Get issue comments.
726732
3. get_sub_issues - Get sub-issues of the issue.
@@ -738,8 +744,8 @@ Options are:
738744
- `issue_number`: Issue number to update (number, optional)
739745
- `labels`: Labels to apply to this issue (string[], optional)
740746
- `method`: Write operation to perform on a single issue.
741-
Options are:
742-
- 'create' - creates a new issue.
747+
Options are:
748+
- 'create' - creates a new issue.
743749
- 'update' - updates an existing issue.
744750
(string, required)
745751
- `milestone`: Milestone number (number, optional)
@@ -819,7 +825,7 @@ Options are:
819825
<summary>Notifications</summary>
820826

821827
- **dismiss_notification** - Dismiss notification
822-
- `state`: The new state of the notification (read/done) (string, optional)
828+
- `state`: The new state of the notification (read/done) (string, required)
823829
- `threadID`: The ID of the notification thread (string, required)
824830

825831
- **get_notification_details** - Get notification details

cmd/github-mcp-server/generate_docs.go

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import (
1515
"github.com/github/github-mcp-server/pkg/toolsets"
1616
"github.com/github/github-mcp-server/pkg/translations"
1717
gogithub "github.com/google/go-github/v79/github"
18-
"github.com/mark3labs/mcp-go/mcp"
18+
"github.com/google/jsonschema-go/jsonschema"
19+
"github.com/modelcontextprotocol/go-sdk/mcp"
1920
"github.com/shurcooL/githubv4"
2021
"github.com/spf13/cobra"
2122
)
@@ -226,7 +227,16 @@ func generateToolDoc(tool mcp.Tool) string {
226227
lines = append(lines, fmt.Sprintf("- **%s** - %s", tool.Name, tool.Annotations.Title))
227228

228229
// Parameters
229-
schema := tool.InputSchema
230+
if tool.InputSchema == nil {
231+
lines = append(lines, " - No parameters required")
232+
return strings.Join(lines, "\n")
233+
}
234+
schema, ok := tool.InputSchema.(*jsonschema.Schema)
235+
if !ok || schema == nil {
236+
lines = append(lines, " - No parameters required")
237+
return strings.Join(lines, "\n")
238+
}
239+
230240
if len(schema.Properties) > 0 {
231241
// Get parameter names and sort them for deterministic order
232242
var paramNames []string
@@ -243,30 +253,22 @@ func generateToolDoc(tool mcp.Tool) string {
243253
requiredStr = "required"
244254
}
245255

246-
// Get the type and description
247-
typeStr := "unknown"
248-
description := ""
249-
250-
if propMap, ok := prop.(map[string]interface{}); ok {
251-
if typeVal, ok := propMap["type"].(string); ok {
252-
if typeVal == "array" {
253-
if items, ok := propMap["items"].(map[string]interface{}); ok {
254-
if itemType, ok := items["type"].(string); ok {
255-
typeStr = itemType + "[]"
256-
}
257-
} else {
258-
typeStr = "array"
259-
}
260-
} else {
261-
typeStr = typeVal
262-
}
263-
}
256+
var typeStr, description string
264257

265-
if desc, ok := propMap["description"].(string); ok {
266-
description = desc
258+
// Get the type and description
259+
switch prop.Type {
260+
case "array":
261+
if prop.Items != nil {
262+
typeStr = prop.Items.Type + "[]"
263+
} else {
264+
typeStr = "array"
267265
}
266+
default:
267+
typeStr = prop.Type
268268
}
269269

270+
description = prop.Description
271+
270272
paramLine := fmt.Sprintf(" - `%s`: %s (%s, %s)", propName, description, typeStr, requiredStr)
271273
lines = append(lines, paramLine)
272274
}

0 commit comments

Comments
 (0)