Skip to content

build: update mcp-go-sdk version to v1.4.0 - #64

Merged
xcoulon merged 2 commits into
codeready-toolchain:masterfrom
xcoulon:mcp-go-sdk-v1.4.0
Mar 24, 2026
Merged

xcoulon merged 2 commits into
codeready-toolchain:masterfrom
xcoulon:mcp-go-sdk-v1.4.0

Conversation

@xcoulon

@xcoulon xcoulon commented Mar 23, 2026 •

Copy link
Copy Markdown
Collaborator

we need to stick to the mcp/go-sdk version 1.4.0
because the latest version (v1.4.1) upgraded to
Go 1.25 which is not compatible with our Go version :/

Also, validate the schemas for the tools, panic via
log.Fatalf() in the init() functions.

See modelcontextprotocol/go-sdk#470 for more details
on why we need to register an schema for the metav1.Time type (which uses
the time.Time type as an embedded field)

Signed-off-by: Xavier Coulon xcoulon@redhat.com

Summary by CodeRabbit

  • Chores

    • Updated Go dependencies and toolchain directives for improved compatibility.
    • Adjusted a server HTTP transport option related to localhost protection.
  • Refactor

    • Moved JSON schema generation and tool initialization to startup-time initialization for more explicit setup and error handling.
  • Tests

    • Added schema validation tests to ensure correct JSON schema generation.
  • Chores

    • Removed a previously ignored vulnerability entry from the vulnerability config.

we need to stick to the mcp/go-sdk version 1.4.0
because the latest version (v1.4.1) upgraded to
Go 1.25 which is not compatible with our Go version :/

Also, validate the schemas for the tools, panic via
`log.Fatalf()` in the `init()` functions.

See modelcontextprotocol/go-sdk#470 for more details
on why we need to register an schema for the `metav1.Time` type (which uses
the `time.Time` type as an embedded field)

Signed-off-by: Xavier Coulon <xcoulon@redhat.com>
@coderabbitai

coderabbitai Bot commented Mar 23, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e7a1718b-3bb1-49bd-beed-11428d40adaf

📥 Commits

Reviewing files that changed from the base of the PR and between 42697fb and b790420.

📒 Files selected for processing (1)
  • .govulncheck.yaml
💤 Files with no reviewable changes (1)
  • .govulncheck.yaml

Walkthrough

The PR sets DisableLocalhostProtection on the MCP HTTP /mcp handler, updates Go module dependency versions, and refactors ArgoCD tool code to generate input/output JSON schemas in package init() with accompanying tests.

Changes

Cohort / File(s) Summary
HTTP Transport Configuration
cmd/start_server.go
Enable DisableLocalhostProtection: true in mcp.StreamableHTTPOptions for the /mcp HTTP handler (keeps Stateless setting).
Dependency Management
go.mod
Adjusted Go version/toolchain directives; bumped github.com/google/jsonschema-go, github.com/modelcontextprotocol/go-sdk, github.com/golang-jwt/jwt/v5, golang.org/x/sys; added indirect github.com/segmentio/... deps.
ArgoCD: Unhealthy Application Resources
internal/argocd/unhealthy_application_resources.go, internal/argocd/unhealthy_application_resources_test.go
Refactored tool to initialize UnhealthyApplicationResourcesTool and its input/output JSON schemas in init(); added UnhealthyApplicationResourcesInput type and a schema validation test; added explicit metav1.Time → string type mapping and startup logging.
ArgoCD: Unhealthy Applications
internal/argocd/unhealthy_applications.go, internal/argocd/unhealthy_applications_test.go
Applied same init-time schema generation pattern: UnhealthyApplicationsTool moved to init(), introduced UnhealthyApplicationsOutput type, created output schema in init(), added schema validation test and startup logging.
Vulnerability Config
.govulncheck.yaml
Removed one ignored vulnerability entry (GO-2026-4569) from the ignore list.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'build: update mcp-go-sdk version to v1.4.0' directly and clearly summarizes the primary change—upgrading the MCP Go SDK dependency to v1.4.0, which is the main theme throughout the PR (dependency upgrade in go.mod, removal of a vulnerability workaround, and schema validation changes required for the new version).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
internal/argocd/unhealthy_applications.go (1)

19-20: Remove redundant package-level schema generation.

Lines 19-20 generate schemas at package-level with ignored errors, but these are immediately overwritten in init() (lines 27-37) with proper error handling. This is redundant and inconsistent with unhealthy_application_resources.go, which only declares the variables at package level.

♻️ Proposed fix
-var UnhealthyApplicationsInputSchema, _ = jsonschema.For[UnhealthyApplicationsInput](&jsonschema.ForOptions{})
-var UnhealthyApplicationsOutputSchema, _ = jsonschema.For[UnhealthyApplicationsOutput](&jsonschema.ForOptions{})
+var UnhealthyApplicationsInputSchema *jsonschema.Schema
+var UnhealthyApplicationsOutputSchema *jsonschema.Schema
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/argocd/unhealthy_applications.go` around lines 19 - 20, Remove the
redundant package-level schema generation that creates
UnhealthyApplicationsInputSchema and UnhealthyApplicationsOutputSchema with
ignored errors; instead only declare those variables at package level and rely
on the init() function to populate them with proper error handling. Locate the
two var declarations for UnhealthyApplicationsInputSchema and
UnhealthyApplicationsOutputSchema and replace the schema creation expressions
with simple declarations (matching the pattern used in
unhealthy_application_resources.go), ensuring init() remains responsible for
calling jsonschema.For and handling errors.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@go.mod`:
- Line 14: The dependency line "github.com/modelcontextprotocol/go-sdk v1.4.0"
is flagged with two HIGH vulnerabilities; update go.mod by adding a clear
comment above that dependency noting the vulnerabilities (GHSA-89xv-2j6f-qhc8
and GHSA-q382-vc8q-7jhj), that v1.4.1 fixes them but requires Go 1.25, and that
upgrade is deferred until the toolchain is available; create a tracking issue
(reference the GHSA IDs and v1.4.1) to perform the upgrade when Go 1.25 is
adopted, and add a short note in the repo (README or SECURITY.md) listing
temporary mitigations to apply while pinned to v1.4.0 (e.g., enforce CSRF
protections, tighten auth/rate-limiting) so reviewers can find and act on these
items.

---

Nitpick comments:
In `@internal/argocd/unhealthy_applications.go`:
- Around line 19-20: Remove the redundant package-level schema generation that
creates UnhealthyApplicationsInputSchema and UnhealthyApplicationsOutputSchema
with ignored errors; instead only declare those variables at package level and
rely on the init() function to populate them with proper error handling. Locate
the two var declarations for UnhealthyApplicationsInputSchema and
UnhealthyApplicationsOutputSchema and replace the schema creation expressions
with simple declarations (matching the pattern used in
unhealthy_application_resources.go), ensuring init() remains responsible for
calling jsonschema.For and handling errors.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 782dae4f-c93d-469b-88fd-891b4cd45de5

📥 Commits

Reviewing files that changed from the base of the PR and between 5c04c99 and 42697fb.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (6)
  • cmd/start_server.go
  • go.mod
  • internal/argocd/unhealthy_application_resources.go
  • internal/argocd/unhealthy_application_resources_test.go
  • internal/argocd/unhealthy_applications.go
  • internal/argocd/unhealthy_applications_test.go

Comment thread go.mod
github.com/google/jsonschema-go v0.4.2
github.com/h2non/gock v1.2.0
github.com/modelcontextprotocol/go-sdk v1.2.0
github.com/modelcontextprotocol/go-sdk v1.4.0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Security: mcp-go-sdk v1.4.0 has known HIGH severity vulnerabilities.

The static analysis tools have flagged two HIGH severity vulnerabilities in github.com/modelcontextprotocol/go-sdk v1.4.0:

  1. GHSA-89xv-2j6f-qhc8 (CSRF): "The Go SDK's Streamable HTTP transport accepted browser-generated cross-site POST requests without validating the Origin header and without requiring …"

  2. GHSA-q382-vc8q-7jhj (JSON Key Collusion): "The Model Context Protocol (MCP) Go SDK, via its dependency on segmentio/encoding, is vulnerable to JSON Key Collusion. The JSON parser improperly handles null Unicode characters during struct field mapping, allowing attackers to smuggle overriding keys past security filters and manipulate backend application logic."

Both vulnerabilities are fixed in v1.4.1. While the PR description notes v1.4.1 requires Go 1.25, consider:

  • Adding a comment in go.mod documenting this known limitation
  • Creating a tracking issue to upgrade once Go 1.25 is available
  • Evaluating if additional mitigations (e.g., authentication, rate limiting) can reduce the risk while pinned to v1.4.0
🧰 Tools
🪛 OSV Scanner (2.3.3)

[HIGH] 14-14: github.com/modelcontextprotocol/go-sdk 1.4.0: Cross-Site Tool Execution for HTTP Servers without Authorizatrion in github.com/modelcontextprotocol/go-sdk

(GHSA-89xv-2j6f-qhc8)


[HIGH] 14-14: github.com/modelcontextprotocol/go-sdk 1.4.0: Improper handling of null Unicode character when parsing JSON in github.com/modelcontextprotocol/go-sdk

(GHSA-q382-vc8q-7jhj)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@go.mod` at line 14, The dependency line
"github.com/modelcontextprotocol/go-sdk v1.4.0" is flagged with two HIGH
vulnerabilities; update go.mod by adding a clear comment above that dependency
noting the vulnerabilities (GHSA-89xv-2j6f-qhc8 and GHSA-q382-vc8q-7jhj), that
v1.4.1 fixes them but requires Go 1.25, and that upgrade is deferred until the
toolchain is available; create a tracking issue (reference the GHSA IDs and
v1.4.1) to perform the upgrade when Go 1.25 is adopted, and add a short note in
the repo (README or SECURITY.md) listing temporary mitigations to apply while
pinned to v1.4.0 (e.g., enforce CSRF protections, tighten auth/rate-limiting) so
reviewers can find and act on these items.

Signed-off-by: Xavier Coulon <xcoulon@redhat.com>

@alexeykazakov alexeykazakov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. But afaik there is already 1.4.1 with some security bugs fixed.

Comment thread go.mod
github.com/google/jsonschema-go v0.4.2
github.com/h2non/gock v1.2.0
github.com/modelcontextprotocol/go-sdk v1.2.0
github.com/modelcontextprotocol/go-sdk v1.4.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
github.com/modelcontextprotocol/go-sdk v1.4.0
github.com/modelcontextprotocol/go-sdk v1.4.1

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, let me open another PR for to upgrade to github.com/modelcontextprotocol/go-sdk v1.4.1 and hence, to Go 1.25

@xcoulon
xcoulon merged commit f6cc5a5 into codeready-toolchain:master Mar 24, 2026
11 checks passed
@xcoulon
xcoulon deleted the mcp-go-sdk-v1.4.0 branch March 24, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants