🌐 AI搜索 & 代理 主页
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ require (
github.com/go-viper/mapstructure/v2 v2.4.0
github.com/google/go-querystring v1.1.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/modelcontextprotocol/go-sdk v1.1.0
github.com/modelcontextprotocol/go-sdk v1.2.0-pre.1
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rogpeppe/go-internal v1.13.1 // indirect
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ github.com/go-openapi/swag v0.21.1 h1:wm0rhTb5z7qpJRHBdPOMuY4QjVUMbF6/kwoYeRAOrK
github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs=
github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8=
github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
Expand Down Expand Up @@ -55,8 +57,8 @@ github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwX
github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA=
github.com/migueleliasweb/go-github-mock v1.3.0 h1:2sVP9JEMB2ubQw1IKto3/fzF51oFC6eVWOOFDgQoq88=
github.com/migueleliasweb/go-github-mock v1.3.0/go.mod h1:ipQhV8fTcj/G6m7BKzin08GaJ/3B5/SonRAkgrk0zCY=
github.com/modelcontextprotocol/go-sdk v1.1.0 h1:Qjayg53dnKC4UZ+792W21e4BpwEZBzwgRW6LrjLWSwA=
github.com/modelcontextprotocol/go-sdk v1.1.0/go.mod h1:6fM3LCm3yV7pAs8isnKLn07oKtB0MP9LHd3DfAcKw10=
github.com/modelcontextprotocol/go-sdk v1.2.0-pre.1 h1:14+JrlEIFvUmbu5+iJzWPLk8CkpvegfKr42oXyjp3O4=
github.com/modelcontextprotocol/go-sdk v1.2.0-pre.1/go.mod h1:6fM3LCm3yV7pAs8isnKLn07oKtB0MP9LHd3DfAcKw10=
github.com/muesli/cache2go v0.0.0-20221011235721-518229cd8021 h1:31Y+Yu373ymebRdJN1cWLLooHH8xAr0MhKTEJGV/87g=
github.com/muesli/cache2go v0.0.0-20221011235721-518229cd8021/go.mod h1:WERUkUryfUWlrHnFSO/BEUZ+7Ns8aZy7iVOGewxKzcc=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
Expand Down
18 changes: 17 additions & 1 deletion pkg/github/__toolsnaps__/assign_copilot_to_issue.snap
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,21 @@
}
}
},
"name": "assign_copilot_to_issue"
"name": "assign_copilot_to_issue",
"icons": [
{
"src": "https://raw.githubusercontent.com/primer/octicons/main/icons/copilot-16.svg",
"mimeType": "image/svg+xml",
"sizes": [
"16x16"
]
},
{
"src": "https://raw.githubusercontent.com/primer/octicons/main/icons/copilot-24.svg",
"mimeType": "image/svg+xml",
"sizes": [
"24x24"
]
}
]
}
18 changes: 17 additions & 1 deletion pkg/github/__toolsnaps__/fork_repository.snap
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,21 @@
}
}
},
"name": "fork_repository"
"name": "fork_repository",
"icons": [
{
"src": "https://raw.githubusercontent.com/primer/octicons/main/icons/repo-forked-16.svg",
"mimeType": "image/svg+xml",
"sizes": [
"16x16"
]
},
{
"src": "https://raw.githubusercontent.com/primer/octicons/main/icons/repo-forked-24.svg",
"mimeType": "image/svg+xml",
"sizes": [
"24x24"
]
}
]
}
18 changes: 17 additions & 1 deletion pkg/github/__toolsnaps__/merge_pull_request.snap
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,21 @@
}
}
},
"name": "merge_pull_request"
"name": "merge_pull_request",
"icons": [
{
"src": "https://raw.githubusercontent.com/primer/octicons/main/icons/git-merge-16.svg",
"mimeType": "image/svg+xml",
"sizes": [
"16x16"
]
},
{
"src": "https://raw.githubusercontent.com/primer/octicons/main/icons/git-merge-24.svg",
"mimeType": "image/svg+xml",
"sizes": [
"24x24"
]
}
]
}
18 changes: 17 additions & 1 deletion pkg/github/__toolsnaps__/request_copilot_review.snap
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,21 @@
}
}
},
"name": "request_copilot_review"
"name": "request_copilot_review",
"icons": [
{
"src": "https://raw.githubusercontent.com/primer/octicons/main/icons/copilot-16.svg",
"mimeType": "image/svg+xml",
"sizes": [
"16x16"
]
},
{
"src": "https://raw.githubusercontent.com/primer/octicons/main/icons/copilot-24.svg",
"mimeType": "image/svg+xml",
"sizes": [
"24x24"
]
}
]
}
18 changes: 17 additions & 1 deletion pkg/github/__toolsnaps__/star_repository.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,21 @@
}
}
},
"name": "star_repository"
"name": "star_repository",
"icons": [
{
"src": "https://raw.githubusercontent.com/primer/octicons/main/icons/star-fill-16.svg",
"mimeType": "image/svg+xml",
"sizes": [
"16x16"
]
},
{
"src": "https://raw.githubusercontent.com/primer/octicons/main/icons/star-fill-24.svg",
"mimeType": "image/svg+xml",
"sizes": [
"24x24"
]
}
]
}
2 changes: 2 additions & 0 deletions pkg/github/issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

ghErrors "github.com/github/github-mcp-server/pkg/errors"
"github.com/github/github-mcp-server/pkg/lockdown"
"github.com/github/github-mcp-server/pkg/octicons"
"github.com/github/github-mcp-server/pkg/sanitize"
"github.com/github/github-mcp-server/pkg/toolsets"
"github.com/github/github-mcp-server/pkg/translations"
Expand Down Expand Up @@ -1622,6 +1623,7 @@ func AssignCopilotToIssue(t translations.TranslationHelperFunc) toolsets.ServerT
mcp.Tool{
Name: "assign_copilot_to_issue",
Description: t("TOOL_ASSIGN_COPILOT_TO_ISSUE_DESCRIPTION", description.String()),
Icons: octicons.Icons("copilot"),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_ASSIGN_COPILOT_TO_ISSUE_USER_TITLE", "Assign Copilot to issue"),
ReadOnlyHint: false,
Expand Down
3 changes: 3 additions & 0 deletions pkg/github/pullrequests.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

ghErrors "github.com/github/github-mcp-server/pkg/errors"
"github.com/github/github-mcp-server/pkg/lockdown"
"github.com/github/github-mcp-server/pkg/octicons"
"github.com/github/github-mcp-server/pkg/sanitize"
"github.com/github/github-mcp-server/pkg/toolsets"
"github.com/github/github-mcp-server/pkg/translations"
Expand Down Expand Up @@ -1008,6 +1009,7 @@ func MergePullRequest(t translations.TranslationHelperFunc) toolsets.ServerTool
mcp.Tool{
Name: "merge_pull_request",
Description: t("TOOL_MERGE_PULL_REQUEST_DESCRIPTION", "Merge a pull request in a GitHub repository."),
Icons: octicons.Icons("git-merge"),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_MERGE_PULL_REQUEST_USER_TITLE", "Merge pull request"),
ReadOnlyHint: false,
Expand Down Expand Up @@ -1777,6 +1779,7 @@ func RequestCopilotReview(t translations.TranslationHelperFunc) toolsets.ServerT
mcp.Tool{
Name: "request_copilot_review",
Description: t("TOOL_REQUEST_COPILOT_REVIEW_DESCRIPTION", "Request a GitHub Copilot code review for a pull request. Use this for automated feedback on pull requests, usually before requesting a human reviewer."),
Icons: octicons.Icons("copilot"),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_REQUEST_COPILOT_REVIEW_USER_TITLE", "Request Copilot review"),
ReadOnlyHint: false,
Expand Down
3 changes: 3 additions & 0 deletions pkg/github/repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"strings"

ghErrors "github.com/github/github-mcp-server/pkg/errors"
"github.com/github/github-mcp-server/pkg/octicons"
"github.com/github/github-mcp-server/pkg/raw"
"github.com/github/github-mcp-server/pkg/toolsets"
"github.com/github/github-mcp-server/pkg/translations"
Expand Down Expand Up @@ -776,6 +777,7 @@ func ForkRepository(t translations.TranslationHelperFunc) toolsets.ServerTool {
mcp.Tool{
Name: "fork_repository",
Description: t("TOOL_FORK_REPOSITORY_DESCRIPTION", "Fork a GitHub repository to your account or specified organization"),
Icons: octicons.Icons("repo-forked"),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_FORK_REPOSITORY_USER_TITLE", "Fork repository"),
ReadOnlyHint: false,
Expand Down Expand Up @@ -2028,6 +2030,7 @@ func StarRepository(t translations.TranslationHelperFunc) toolsets.ServerTool {
mcp.Tool{
Name: "star_repository",
Description: t("TOOL_STAR_REPOSITORY_DESCRIPTION", "Star a GitHub repository"),
Icons: octicons.Icons("star-fill"),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_STAR_REPOSITORY_USER_TITLE", "Star repository"),
ReadOnlyHint: false,
Expand Down
11 changes: 8 additions & 3 deletions pkg/github/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"strconv"
"strings"

"github.com/github/github-mcp-server/pkg/octicons"
"github.com/github/github-mcp-server/pkg/utils"
"github.com/google/go-github/v79/github"
"github.com/google/jsonschema-go/jsonschema"
Expand All @@ -24,15 +25,19 @@ func NewServer(version string, opts *mcp.ServerOptions) *mcp.Server {
// Always advertise capabilities so clients know we support list_changed notifications.
// This is important for dynamic toolsets mode where we start with few tools
// and add more at runtime.
opts.HasTools = true
opts.HasResources = true
opts.HasPrompts = true
if opts.Capabilities == nil {
opts.Capabilities = &mcp.ServerCapabilities{}
}
opts.Capabilities.Tools = &mcp.ToolCapabilities{ListChanged: true}
opts.Capabilities.Resources = &mcp.ResourceCapabilities{ListChanged: true}
opts.Capabilities.Prompts = &mcp.PromptCapabilities{ListChanged: true}

// Create a new MCP server
s := mcp.NewServer(&mcp.Implementation{
Name: "github-mcp-server",
Title: "GitHub MCP Server",
Version: version,
Icons: octicons.Icons("mark-github"),
}, opts)

return s
Expand Down
Loading