Skip to content

Commit 60aef5d

Browse files
omgitsadsCopilotCopilotLuluBeatsonSamMorrowDrums
authored
Convert to modelcontextprotocol/go-sdk (#1428)
Move from `mark3labs/mcp-go` to `modelcontextprotocol/go-sdk`. This is mostly focused on updating tool schema and tool handler signatures, along with any associated internal changes related to those changes. --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: omgitsads <[email protected]> Co-authored-by: LuluBeatson <[email protected]> Co-authored-by: Lulu <[email protected]> Co-authored-by: SamMorrowDrums <[email protected]> Co-authored-by: Sam Morrow <[email protected]>
1 parent ada4bc0 commit 60aef5d

File tree

158 files changed

+11083
-8514
lines changed

Some content is hidden

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

158 files changed

+11083
-8514
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: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -719,8 +719,8 @@ The following sets of tools are available:
719719

720720
- **issue_read** - Get issue details
721721
- `issue_number`: The number of the issue (number, required)
722-
- `method`: The read operation to perform on a single issue.
723-
Options are:
722+
- `method`: The read operation to perform on a single issue.
723+
Options are:
724724
1. get - Get details of a specific issue.
725725
2. get_comments - Get issue comments.
726726
3. get_sub_issues - Get sub-issues of the issue.
@@ -738,8 +738,8 @@ Options are:
738738
- `issue_number`: Issue number to update (number, optional)
739739
- `labels`: Labels to apply to this issue (string[], optional)
740740
- `method`: Write operation to perform on a single issue.
741-
Options are:
742-
- 'create' - creates a new issue.
741+
Options are:
742+
- 'create' - creates a new issue.
743743
- 'update' - updates an existing issue.
744744
(string, required)
745745
- `milestone`: Milestone number (number, optional)
@@ -819,7 +819,7 @@ Options are:
819819
<summary>Notifications</summary>
820820

821821
- **dismiss_notification** - Dismiss notification
822-
- `state`: The new state of the notification (read/done) (string, optional)
822+
- `state`: The new state of the notification (read/done) (string, required)
823823
- `threadID`: The ID of the notification thread (string, required)
824824

825825
- **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)