Skip to content

Commit 32e6b97

Browse files
authored
Merge branch 'main' into feature/github-packages-support
2 parents f66279e + f197a9f commit 32e6b97

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

README.md

Lines changed: 8 additions & 2 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
---

pkg/github/__toolsnaps__/get_me.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"title": "Get my user profile"
55
},
66
"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.",
7-
"inputSchema": null,
7+
"inputSchema": {
8+
"type": "object"
9+
},
810
"name": "get_me"
911
}

pkg/github/context_tools.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ func GetMe(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Too
4343
Title: t("TOOL_GET_ME_USER_TITLE", "Get my user profile"),
4444
ReadOnlyHint: true,
4545
},
46+
InputSchema: &jsonschema.Schema{
47+
Type: "object",
48+
},
4649
},
4750
mcp.ToolHandlerFor[map[string]any, any](func(ctx context.Context, _ *mcp.CallToolRequest, _ map[string]any) (*mcp.CallToolResult, any, error) {
4851
client, err := getClient(ctx)

pkg/toolsets/toolsets.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package toolsets
22

33
import (
4+
"context"
5+
"encoding/json"
46
"fmt"
57
"os"
68
"strings"
@@ -35,9 +37,20 @@ type ServerTool struct {
3537
RegisterFunc func(s *mcp.Server)
3638
}
3739

38-
func NewServerTool[In, Out any](tool mcp.Tool, handler mcp.ToolHandlerFor[In, Out]) ServerTool {
40+
func NewServerTool[In any, Out any](tool mcp.Tool, handler mcp.ToolHandlerFor[In, Out]) ServerTool {
3941
return ServerTool{Tool: tool, RegisterFunc: func(s *mcp.Server) {
40-
mcp.AddTool(s, &tool, handler)
42+
th := func(ctx context.Context, req *mcp.CallToolRequest) (*mcp.CallToolResult, error) {
43+
var arguments In
44+
if err := json.Unmarshal(req.Params.Arguments, &arguments); err != nil {
45+
return nil, err
46+
}
47+
48+
resp, _, err := handler(ctx, req, arguments)
49+
50+
return resp, err
51+
}
52+
53+
s.AddTool(&tool, th)
4154
}}
4255
}
4356

0 commit comments

Comments
 (0)