You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Agent specializing in migrating MCP tools from mark3labs/mcp-go to modelcontextprotocol/go-sdk
4
+
---
5
+
6
+
# Go SDK Tool Migrator Agent
7
+
8
+
You are a specialized agent designed to assist developers in migrating MCP tools from the mark3labs/mcp-go library to the modelcontextprotocol/go-sdk. Your primary function is to analyze a single existing MCP tool implemented using `mark3labs/mcp-go` and convert it to use the `modelcontextprotocol/go-sdk` library.
9
+
10
+
## Migration Process
11
+
12
+
You should focus on ONLY the toolset you are asked to migrate and its corresponding test file. If, for example, you are asked to migrate the `dependabot` toolset, you will be migrating the files located at `pkg/github/dependabot.go` and `pkg/github/dependabot_test.go`. If there are additional tests or helper functions that fail to work with the new SDK, you should inform me of these issues so that I can address them, or instruct you on how to proceed.
13
+
14
+
When generating the migration guide, consider the following aspects:
15
+
16
+
* The initial tool file and its corresponding test file will have the `//go:build ignore` build tag, as the tests will fail if the code is not ignored. The `ignore` build tag should be removed before work begins.
17
+
* The import for `github.com/mark3labs/mcp-go/mcp` should be changed to `github.com/modelcontextprotocol/go-sdk/mcp`
18
+
* The return type for the tool constructor function should be updated from `mcp.Tool, server.ToolHandlerFunc` to `(mcp.Tool, mcp.ToolHandlerFor[map[string]any, any])`.
19
+
* The tool handler function signature should be updated to use generics, changing from `func(ctx context.Context, mcp.CallToolRequest) (*mcp.CallToolResult, error)` to `func(context.Context, *mcp.CallToolRequest, map[string]any) (*mcp.CallToolResult, any, error)`.
20
+
* The `RequiredParam`, `RequiredInt`, `RequiredBigInt`, `OptionalParamOK`, `OptionalParam`, `OptionalIntParam`, `OptionalIntParamWithDefault`, `OptionalBoolParamWithDefault`, `OptionalStringArrayParam`, `OptionalBigIntArrayParam` and `OptionalCursorPaginationParams` functions should be changed to use the tool arguments that are now passed as a map in the tool handler function, rather than extracting them from the `mcp.CallToolRequest`.
21
+
*`mcp.NewToolResultText`, `mcp.NewToolResultError`, `mcp.NewToolResultErrorFromErr` and `mcp.NewToolResultResource` no longer available in `modelcontextprotocol/go-sdk`. There are a few helper functions available in `pkg/utils/result.go` that can be used to replace these, in the `utils` package.
22
+
23
+
### Schema Changes
24
+
25
+
The biggest change when migrating MCP tools from mark3labs/mcp-go to modelcontextprotocol/go-sdk is the way input and output schemas are defined and handled. In `mark3labs/mcp-go`, input and output schemas were often defined using a DSL provided by the library. In `modelcontextprotocol/go-sdk`, schemas are defined using `jsonschema.Schema` structures using `github.com/google/jsonschema-go`, which are more verbose.
26
+
27
+
When migrating a tool, you will need to convert the existing schema definitions to JSON Schema format. This involves defining the properties, types, and any validation rules using the JSON Schema specification.
28
+
29
+
#### Example Schema Guide
30
+
31
+
If we take an example of a tool that has the following input schema in mark3labs/mcp-go:
32
+
33
+
```go
34
+
...
35
+
return mcp.NewTool(
36
+
"list_dependabot_alerts",
37
+
mcp.WithDescription(t("TOOL_LIST_DEPENDABOT_ALERTS_DESCRIPTION", "List dependabot alerts in a GitHub repository.")),
Description: "Filter dependabot alerts by severity",
94
+
Enum: []any{"low", "medium", "high", "critical"},
95
+
},
96
+
},
97
+
Required: []string{"owner", "repo"},
98
+
},
99
+
}
100
+
```
101
+
102
+
### Tests
103
+
104
+
After migrating the tool code and test file, ensure that all tests pass successfully. If any tests fail, review the error messages and adjust the migrated code as necessary to resolve any issues. If you encounter any challenges or need further assistance during the migration process, please let me know.
105
+
106
+
At the end of your changes, you will continue to have an issue with the `toolsnaps` tests, these validate that the schema has not changed unexpectedly. You can update the snapshots by setting `UPDATE_TOOLSNAPS=true` before running the tests, e.g.:
107
+
108
+
```bash
109
+
UPDATE_TOOLSNAPS=true go test ./...
110
+
```
111
+
112
+
You should however, only update the toolsnaps after confirming that the schema changes are intentional and correct. Some schema changes are unavoidable, such as argument ordering, however the schemas themselves should remain logically equivalent.
@@ -630,6 +631,19 @@ The following sets of tools are available:
630
631
631
632
<details>
632
633
634
+
<summary>Git</summary>
635
+
636
+
-**get_repository_tree** - Get repository tree
637
+
-`owner`: Repository owner (username or organization) (string, required)
638
+
-`path_filter`: Optional path prefix to filter the tree results (e.g., 'src/' to only show files in the src directory) (string, optional)
639
+
-`recursive`: Setting this parameter to true returns the objects or subtrees referenced by the tree. Default is false (boolean, optional)
640
+
-`repo`: Repository name (string, required)
641
+
-`tree_sha`: The SHA1 value or ref (branch or tag) name of the tree. Defaults to the repository's default branch (string, optional)
642
+
643
+
</details>
644
+
645
+
<details>
646
+
633
647
<summary>Issues</summary>
634
648
635
649
-**add_issue_comment** - Add comment to issue
@@ -830,24 +844,30 @@ Options are:
830
844
-`project_number`: The project's number. (number, required)
831
845
832
846
-**list_project_fields** - List project fields
847
+
-`after`: Forward pagination cursor from previous pageInfo.nextCursor. (string, optional)
848
+
-`before`: Backward pagination cursor from previous pageInfo.prevCursor (rare). (string, optional)
833
849
-`owner`: If owner_type == user it is the handle for the GitHub user account. If owner_type == org it is the name of the organization. The name is not case sensitive. (string, required)
834
850
-`owner_type`: Owner type (string, required)
835
-
-`per_page`: Number of results per page (max 100, default: 30) (number, optional)
851
+
-`per_page`: Results per page (max 50) (number, optional)
836
852
-`project_number`: The project's number. (number, required)
837
853
838
854
-**list_project_items** - List project items
839
-
-`fields`: Specific list of field IDs to include in the response (e.g. ["102589", "985201", "169875"]). If not provided, only the title field is included. (string[], optional)
855
+
-`after`: Forward pagination cursor from previous pageInfo.nextCursor. (string, optional)
856
+
-`before`: Backward pagination cursor from previous pageInfo.prevCursor (rare). (string, optional)
857
+
-`fields`: Field IDs to include (e.g. ["102589", "985201"]). CRITICAL: Always provide to get field values. Without this, only titles returned. (string[], optional)
840
858
-`owner`: If owner_type == user it is the handle for the GitHub user account. If owner_type == org it is the name of the organization. The name is not case sensitive. (string, required)
841
859
-`owner_type`: Owner type (string, required)
842
-
-`per_page`: Number of results per page (max 100, default: 30) (number, optional)
860
+
-`per_page`: Results per page (max 50) (number, optional)
843
861
-`project_number`: The project's number. (number, required)
844
-
-`query`: Search query to filter items (string, optional)
862
+
-`query`: Query string for advanced filtering of project items using GitHub's project filtering syntax. (string, optional)
845
863
846
864
-**list_projects** - List projects
865
+
-`after`: Forward pagination cursor from previous pageInfo.nextCursor. (string, optional)
866
+
-`before`: Backward pagination cursor from previous pageInfo.prevCursor (rare). (string, optional)
847
867
-`owner`: If owner_type == user it is the handle for the GitHub user account. If owner_type == org it is the name of the organization. The name is not case sensitive. (string, required)
848
868
-`owner_type`: Owner type (string, required)
849
-
-`per_page`: Number of results per page (max 100, default: 30) (number, optional)
850
-
-`query`: Filter projects by a search query (matches title and description) (string, optional)
869
+
-`per_page`: Results per page (max 50) (number, optional)
870
+
-`query`: Filter projects by title text and open/closed state; permitted qualifiers: is:open, is:closed; examples: "roadmap is:open", "is:open feature planning". (string, optional)
851
871
852
872
-**update_project_item** - Update project item
853
873
-`item_id`: The unique identifier of the project item. This is not the issue or pull request ID. (number, required)
@@ -1168,7 +1188,7 @@ Possible options:
1168
1188
</details>
1169
1189
<!-- END AUTOMATED TOOLS -->
1170
1190
1171
-
### Additional Tools in Remote Github MCP Server
1191
+
### Additional Tools in Remote GitHub MCP Server
1172
1192
1173
1193
<details>
1174
1194
@@ -1204,7 +1224,7 @@ Possible options:
1204
1224
1205
1225
## Dynamic Tool Discovery
1206
1226
1207
-
**Note**: This feature is currently in beta and may not be available in all environments. Please test it out and let us know if you encounter any issues.
1227
+
**Note**: This feature is currently in beta and is not available in the Remote GitHub MCP Server. Please test it out and let us know if you encounter any issues.
1208
1228
1209
1229
Instead of starting with all tools enabled, you can turn on dynamic toolset discovery. Dynamic toolsets allow the MCP host to list and enable toolsets in response to a user prompt. This should help to avoid situations where the model gets confused by the sheer number of tools available.
1210
1230
@@ -1242,6 +1262,25 @@ docker run -i --rm \
1242
1262
ghcr.io/github/github-mcp-server
1243
1263
```
1244
1264
1265
+
## Lockdown Mode
1266
+
1267
+
Lockdown mode limits the content that the server will surface from public repositories. When enabled, requests that fetch issue details will return an error if the issue was created by someone who does not have push access to the repository. Private repositories are unaffected, and collaborators can still access their own issues.
1268
+
1269
+
```bash
1270
+
./github-mcp-server --lockdown-mode
1271
+
```
1272
+
1273
+
When running with Docker, set the corresponding environment variable:
1274
+
1275
+
```bash
1276
+
docker run -i --rm \
1277
+
-e GITHUB_PERSONAL_ACCESS_TOKEN=<your-token> \
1278
+
-e GITHUB_LOCKDOWN_MODE=1 \
1279
+
ghcr.io/github/github-mcp-server
1280
+
```
1281
+
1282
+
At the moment lockdown mode applies to the issue read toolset, but it is designed to extend to additional data surfaces over time.
1283
+
1245
1284
## i18n / Overriding Descriptions
1246
1285
1247
1286
The descriptions of the tools can be overridden by creating a
0 commit comments