You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "CodePrometheus (via GitHub)" <gi...@apache.org> on 2026/08/12 12:01:19 UTC
[PR] feat: migrate to the official MCP Go SDK with 2026-07-28 protocol support [skywalking-mcp]
CodePrometheus opened a new pull request, #44:
URL: https://github.com/apache/skywalking-mcp/pull/44
When skywalking-mcp was created a year ago there was no official MCP Go SDK, so it was built on the relatively mature `mark3labs/mcp-go`.
The official `modelcontextprotocol/go-sdk` has since matured and implements the latest protocol revision, 2026-07-28: https://modelcontextprotocol.io/specification/2026-07-28
This PR migrates the server to the official SDK. Main changes:
- MCP protocol `2026-07-28` support, staying backward compatible with clients on earlier protocol revisions.
- Tool input schemas are now inferred from the Go request structs and can no longer drift from the code; required parameters are enforced.
- Removed the MQE documentation resources: they were rarely read by clients, and the metrics list they exposed remains available through the `list_mqe_metrics` tool.
- `--log-command` now uses the SDK's JSON-RPC message log, in a different output format; sensitive-field redaction is preserved.
- Requires Go 1.26; golangci-lint upgraded to v2.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: migrate to the official MCP Go SDK with 2026-07-28 protocol support [skywalking-mcp]
Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng merged PR #44:
URL: https://github.com/apache/skywalking-mcp/pull/44
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: migrate to the official MCP Go SDK with 2026-07-28 protocol support [skywalking-mcp]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #44:
URL: https://github.com/apache/skywalking-mcp/pull/44#discussion_r3766251532
##########
internal/swmcp/streamable.go:
##########
@@ -67,29 +67,36 @@ func NewStreamable() *cobra.Command {
func runStreamableServer(cfg *config.StreamableServerConfig) error {
allowedOrigins := parseAllowedOrigins(viper.GetString("allowed-origins"))
- // httpServer is assigned after NewStreamableHTTPServer so the CORS handler
- // closure can forward to it via the captured pointer variable.
- var httpServerRef *server.StreamableHTTPServer
- customSrv := &http.Server{
- Handler: corsMiddleware(allowedOrigins, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- httpServerRef.ServeHTTP(w, r)
- })),
- ReadHeaderTimeout: 10 * time.Second,
+ // Stateless is required for protocol version 2026-07-28, which carries
+ // identity and capabilities per request instead of in a session.
+ srv := newMCPServer()
+ handler := mcp.NewStreamableHTTPHandler(
+ func(*http.Request) *mcp.Server { return srv },
+ &mcp.StreamableHTTPOptions{Stateless: true},
+ )
+
+ endpointPath := normalizeHTTPPath(cfg.EndpointPath)
+ if endpointPath == "" {
+ endpointPath = "/"
+ }
+ wrapped := corsMiddleware(allowedOrigins, handler)
Review Comment:
The 2026-07-28 handler requires `Mcp-Protocol-Version`, `Mcp-Method`, and `Mcp-Name` request headers, but the CORS wrapper only permits `Content-Type, Authorization, Accept` (`internal/swmcp/cors.go:38`). A browser client therefore fails preflight before any new-protocol request reaches this handler. Please add the MCP headers (and legacy `Mcp-Session-Id` for the advertised backward compatibility) to `Access-Control-Allow-Headers`, with a transport-level preflight test.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: migrate to the official MCP Go SDK with 2026-07-28 protocol support [skywalking-mcp]
Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng commented on PR #44:
URL: https://github.com/apache/skywalking-mcp/pull/44#issuecomment-5268919506
Confirmed against the exact pre-PR `main` base: with the backend listening on `127.0.0.1`, an allowed external `Origin`, and a preserved public `Host`, the previous server returned `200 OK`, while this PR returns `403 Forbidden: invalid Host header`.
This is limited to same-host reverse proxies that preserve the public `Host`; proxies that rewrite `Host` to localhost, or connect to a non-loopback backend, are unaffected.
Overall, this PR looks good. The SDK migration is solid, the unit and race tests pass, and CI is green. This proxy edge case is my only concern and could be addressed through configuration or documentation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: migrate to the official MCP Go SDK with 2026-07-28 protocol support [skywalking-mcp]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #44:
URL: https://github.com/apache/skywalking-mcp/pull/44#discussion_r3766406924
##########
Makefile:
##########
@@ -60,7 +60,7 @@ test-cover: ## Run unit tests with coverage output in coverage.txt.
go test $(GO_TEST_FLAGS) -coverprofile=coverage.txt $(GO_TEST_PKGS)
$(GO_LINT):
- @$(GO_LINT) version > /dev/null 2>&1 || go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.0
+ @$(GO_LINT) version > /dev/null 2>&1 || go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.2
Review Comment:
This only checks whether any `golangci-lint` is executable. Developers who already have v1 installed will skip the v2 install and then run that v1 binary against the new `version: "2"` configuration, so `make lint` fails instead of performing the advertised upgrade. Check the installed major version before deciding to skip installation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: migrate to the official MCP Go SDK with 2026-07-28 protocol support [skywalking-mcp]
Posted by "CodePrometheus (via GitHub)" <gi...@apache.org>.
CodePrometheus commented on PR #44:
URL: https://github.com/apache/skywalking-mcp/pull/44#issuecomment-5278715652
> Confirmed against the exact pre-PR `main` base: with the backend listening on `127.0.0.1`, an allowed external `Origin`, and a preserved public `Host`, the previous server returned `200 OK`, while this PR returns `403 Forbidden: invalid Host header`.
>
> This is limited to same-host reverse proxies that preserve the public `Host`; proxies that rewrite `Host` to localhost, or connect to a non-loopback backend, are unaffected.
>
> Overall, this PR looks good. The SDK migration is solid, the unit and race tests pass, and CI is green. This proxy edge case is my only concern and could be addressed through configuration or documentation.
Fixed, added `--disable-localhost-protection` for proxied deployments, defaulting to off so the protection stays on everywhere else.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org