Skip to content
Draft
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
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ module github.com/github/github-mcp-server

go 1.24.0

// Use fork with schema caching and SchemaProvider interface for zero-reflection schema generation
replace github.com/modelcontextprotocol/go-sdk => github.com/SamMorrowDrums/go-sdk v0.0.0-20251204141811-d56ca1559a02

require (
github.com/google/go-github/v79 v79.0.0
github.com/google/jsonschema-go v0.3.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
github.com/SamMorrowDrums/go-sdk v0.0.0-20251204141811-d56ca1559a02 h1:fMiSefai2435z5MnNk4Nr+3UfHcEeBd8dUIzZGsBUPk=
github.com/SamMorrowDrums/go-sdk v0.0.0-20251204141811-d56ca1559a02/go.mod h1:6fM3LCm3yV7pAs8isnKLn07oKtB0MP9LHd3DfAcKw10=
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
Expand Down Expand Up @@ -55,8 +57,6 @@ 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/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
5 changes: 3 additions & 2 deletions pkg/github/__toolsnaps__/fork_repository.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"properties": {
"organization": {
"type": "string",
"description": "Organization to fork to"
"description": "Organization to fork to (defaults to authenticated user)"
},
"owner": {
"type": "string",
Expand All @@ -22,7 +22,8 @@
"type": "string",
"description": "Repository name"
}
}
},
"additionalProperties": false
},
"name": "fork_repository"
}
3 changes: 2 additions & 1 deletion pkg/github/__toolsnaps__/get_latest_release.snap
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"type": "string",
"description": "Repository name"
}
}
},
"additionalProperties": false
},
"name": "get_latest_release"
}
5 changes: 4 additions & 1 deletion pkg/github/__toolsnaps__/get_me.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"title": "Get my user profile"
},
"description": "Get details of the authenticated GitHub user. Use this when a request is about the user's own profile for GitHub. Or when information is missing to build other tool calls.",
"inputSchema": null,
"inputSchema": {
"type": "object",
"additionalProperties": false
},
"name": "get_me"
}
5 changes: 3 additions & 2 deletions pkg/github/__toolsnaps__/get_release_by_tag.snap
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
},
"tag": {
"type": "string",
"description": "Tag name (e.g., 'v1.0.0')"
"description": "Tag name (e.g. 'v1.0.0')"
}
}
},
"additionalProperties": false
},
"name": "get_release_by_tag"
}
14 changes: 6 additions & 8 deletions pkg/github/__toolsnaps__/list_branches.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,19 @@
"description": "Repository owner"
},
"page": {
"type": "number",
"description": "Page number for pagination (min 1)",
"minimum": 1
"type": "integer",
"description": "Page number for pagination (min 1)"
},
"perPage": {
"type": "number",
"description": "Results per page for pagination (min 1, max 100)",
"minimum": 1,
"maximum": 100
"type": "integer",
"description": "Results per page for pagination (min 1 and max 100)"
},
"repo": {
"type": "string",
"description": "Repository name"
}
}
},
"additionalProperties": false
},
"name": "list_branches"
}
14 changes: 6 additions & 8 deletions pkg/github/__toolsnaps__/list_releases.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,19 @@
"description": "Repository owner"
},
"page": {
"type": "number",
"description": "Page number for pagination (min 1)",
"minimum": 1
"type": "integer",
"description": "Page number for pagination (min 1)"
},
"perPage": {
"type": "number",
"description": "Results per page for pagination (min 1, max 100)",
"minimum": 1,
"maximum": 100
"type": "integer",
"description": "Results per page for pagination (min 1 and max 100)"
},
"repo": {
"type": "string",
"description": "Repository name"
}
}
},
"additionalProperties": false
},
"name": "list_releases"
}
14 changes: 6 additions & 8 deletions pkg/github/__toolsnaps__/list_tags.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,19 @@
"description": "Repository owner"
},
"page": {
"type": "number",
"description": "Page number for pagination (min 1)",
"minimum": 1
"type": "integer",
"description": "Page number for pagination (min 1)"
},
"perPage": {
"type": "number",
"description": "Results per page for pagination (min 1, max 100)",
"minimum": 1,
"maximum": 100
"type": "integer",
"description": "Results per page for pagination (min 1 and max 100)"
},
"repo": {
"type": "string",
"description": "Repository name"
}
}
},
"additionalProperties": false
},
"name": "list_tags"
}
20 changes: 9 additions & 11 deletions pkg/github/__toolsnaps__/search_code.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,30 @@
"properties": {
"order": {
"type": "string",
"description": "Sort order for results",
"description": "Sort order for results (asc/desc)",
"enum": [
"asc",
"desc"
]
},
"page": {
"type": "number",
"description": "Page number for pagination (min 1)",
"minimum": 1
"type": "integer",
"description": "Page number for pagination (min 1)"
},
"perPage": {
"type": "number",
"description": "Results per page for pagination (min 1, max 100)",
"minimum": 1,
"maximum": 100
"type": "integer",
"description": "Results per page for pagination (min 1 and max 100)"
},
"query": {
"type": "string",
"description": "Search query using GitHub's powerful code search syntax. Examples: 'content:Skill language:Java org:github', 'NOT is:archived language:Python OR language:go', 'repo:github/github-mcp-server'. Supports exact matching, language filters, path filters, and more."
"description": "Search query using GitHub code search syntax"
},
"sort": {
"type": "string",
"description": "Sort field ('indexed' only)"
"description": "Sort field (indexed only)"
}
}
},
"additionalProperties": false
},
"name": "search_code"
}
18 changes: 8 additions & 10 deletions pkg/github/__toolsnaps__/search_orgs.snap
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,28 @@
]
},
"page": {
"type": "number",
"description": "Page number for pagination (min 1)",
"minimum": 1
"type": "integer",
"description": "Page number for pagination (min 1)"
},
"perPage": {
"type": "number",
"description": "Results per page for pagination (min 1, max 100)",
"minimum": 1,
"maximum": 100
"type": "integer",
"description": "Results per page for pagination (min 1 and max 100)"
},
"query": {
"type": "string",
"description": "Organization search query. Examples: 'microsoft', 'location:california', 'created:\u003e=2025-01-01'. Search is automatically scoped to type:org."
"description": "Organization search query using GitHub search syntax"
},
"sort": {
"type": "string",
"description": "Sort field by category",
"description": "Sort field",
"enum": [
"followers",
"repositories",
"joined"
]
}
}
},
"additionalProperties": false
},
"name": "search_orgs"
}
23 changes: 10 additions & 13 deletions pkg/github/__toolsnaps__/search_repositories.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,40 @@
"properties": {
"minimal_output": {
"type": "boolean",
"description": "Return minimal repository information (default: true). When false, returns full GitHub API repository objects.",
"default": true
"description": "Return minimal repository information - when false returns full GitHub API objects"
},
"order": {
"type": "string",
"description": "Sort order",
"description": "Sort order (asc/desc)",
"enum": [
"asc",
"desc"
]
},
"page": {
"type": "number",
"description": "Page number for pagination (min 1)",
"minimum": 1
"type": "integer",
"description": "Page number for pagination (min 1)"
},
"perPage": {
"type": "number",
"description": "Results per page for pagination (min 1, max 100)",
"minimum": 1,
"maximum": 100
"type": "integer",
"description": "Results per page for pagination (min 1 and max 100)"
},
"query": {
"type": "string",
"description": "Repository search query. Examples: 'machine learning in:name stars:\u003e1000 language:python', 'topic:react', 'user:facebook'. Supports advanced search syntax for precise filtering."
"description": "Repository search query using GitHub search syntax"
},
"sort": {
"type": "string",
"description": "Sort repositories by field, defaults to best match",
"description": "Sort repositories by field - defaults to best match",
"enum": [
"stars",
"forks",
"help-wanted-issues",
"updated"
]
}
}
},
"additionalProperties": false
},
"name": "search_repositories"
}
20 changes: 9 additions & 11 deletions pkg/github/__toolsnaps__/search_users.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,35 @@
"properties": {
"order": {
"type": "string",
"description": "Sort order",
"description": "Sort order (asc/desc)",
"enum": [
"asc",
"desc"
]
},
"page": {
"type": "number",
"description": "Page number for pagination (min 1)",
"minimum": 1
"type": "integer",
"description": "Page number for pagination (min 1)"
},
"perPage": {
"type": "number",
"description": "Results per page for pagination (min 1, max 100)",
"minimum": 1,
"maximum": 100
"type": "integer",
"description": "Results per page for pagination (min 1 and max 100)"
},
"query": {
"type": "string",
"description": "User search query. Examples: 'john smith', 'location:seattle', 'followers:\u003e100'. Search is automatically scoped to type:user."
"description": "User search query using GitHub search syntax"
},
"sort": {
"type": "string",
"description": "Sort users by number of followers or repositories, or when the person joined GitHub.",
"description": "Sort users by followers/repositories/joined",
"enum": [
"followers",
"repositories",
"joined"
]
}
}
},
"additionalProperties": false
},
"name": "search_users"
}
5 changes: 3 additions & 2 deletions pkg/github/context_tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,17 @@ type UserDetails struct {
}

// GetMe creates a tool to get details of the authenticated user.
func GetMe(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) {
func GetMe(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[GetMeInput, any]) {
return mcp.Tool{
Name: "get_me",
Description: t("TOOL_GET_ME_DESCRIPTION", "Get details of the authenticated GitHub user. Use this when a request is about the user's own profile for GitHub. Or when information is missing to build other tool calls."),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_GET_ME_USER_TITLE", "Get my user profile"),
ReadOnlyHint: true,
},
InputSchema: GetMeInput{}.MCPSchema(),
},
mcp.ToolHandlerFor[map[string]any, any](func(ctx context.Context, _ *mcp.CallToolRequest, _ map[string]any) (*mcp.CallToolResult, any, error) {
mcp.ToolHandlerFor[GetMeInput, any](func(ctx context.Context, _ *mcp.CallToolRequest, _ GetMeInput) (*mcp.CallToolResult, any, error) {
client, err := getClient(ctx)
if err != nil {
return utils.NewToolResultErrorFromErr("failed to get GitHub client", err), nil, nil
Expand Down
Loading