Repository navigation
[Official SDK Migration] Make the official go-sdk server the default - #582
Shweta-Deshpande wants to merge 4 commits into
Conversation
| - name: Start server | ||
| env: | ||
| ENABLE_TF_OPERATIONS: true | ||
| TF_MCP_ENDPOINT: http://localhost:8080/mcp |
There was a problem hiding this comment.
nitpick: The test step still references the removed matrix.endpoint, so both jobs end up connecting to http://localhost:8080 instead of /mcp. It also doesn't receive TF_X_OFFICIAL_SDK_ENABLED, which causes officialEndpoint() to classify the legacy matrix entry as official.
Could we set both environment variables on the Run tests against HCPT step?
There was a problem hiding this comment.
Ah good catch. Done.
| // CORS checks use the legacy endpoint because the raw initializer is | ||
| // currently compatible with that endpoint only. |
There was a problem hiding this comment.
The CORS test now runs against the official SDK, but its direct HTTP requests are missing the required Accept header. This makes the server return HTTP 400 and is causing CI to fail.
Could we add Accept: application/json, text/event-stream to both the initialization request and the follow-up tool request?
Inside initializeMCPSession, near line 262, add the header after Content-Type:
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Accept", "application/json, text/event-stream")then, inside testCORSMode, near line 173, add the same header:
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Accept", "application/json, text/event-stream")Also the outdated comment about using only the legacy endpoint should also be updated to something:
// Run the CORS checks against the server selected for this test run.
There was a problem hiding this comment.
Done. Also added checks to read JSON payload of a response that is either plain JSON (mark3labs) or a single SSE message with a "data:" line (go-sdk)
What
The server now runs on the official MCP Go SDK by default, for both stdio and
streamable HTTP. The old mark3labs server is still there as a fallback.
Why
This is the "Default server to the new SDK implementation" step of the SDK
migration. It has to land before the mark3labs code can be removed.
Changes
mcpofficial.Enabled(). The SDK server is used unlessTF_X_OFFICIAL_SDK_ENABLEDis set tofalse. Unset, empty or misspelledvalues keep the SDK server, so a typo can't silently pick the old one.
/mcp. The old/mcp/officialpath still works as an alias.terraform-mcp-server, same as the old one.tools/listwhen therequest has no token, same as the old server. Calling one still returns the
normal "no token" error.
server as the second matrix entry. Makefile:
test-e2e-legacyreplacestest-e2e-official-public-registry.Rollback
Set
TF_X_OFFICIAL_SDK_ENABLED=falseand restart. The server logs a warningat startup when the fallback is active. The fallback is temporary.
What users may notice
Accept: application/json, text/event-stream.list_stackswith no match returns an empty list, not an error.PCI review checklist
I have documented a clear reason for, and description of, the change I am making.
If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.
If applicable, I've documented the impact of any changes to security controls.
Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.