Add an MCP initialize readiness check - #6374
Open
Whxuan0701 wants to merge 2 commits into
Open
Conversation
Expose a protocol-level preflight for Agent harnesses and CI. The check performs only transport setup and the MCP initialize handshake, then reports negotiated metadata without enumerating or invoking capabilities. Signed-off-by: XD <xd@XDdeMacBook-Pro.local>
Whxuan0701
requested review from
ChrisJBurns,
JAORMX,
amirejaz,
aponcedeleonch,
blkt,
jhrozek,
rdimitrov and
reyortiz3
as code owners
August 19, 2026 06:13
Keep mcp check flags isolated from sibling commands and route text and JSON results through Cobra output writers. Add real initialize-only and CLI regression coverage, then regenerate the command documentation. Signed-off-by: XD <xd@XDdeMacBook-Pro.local>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Agent harnesses and CI need a protocol-level readiness signal, but
thv mcp listperforms capability enumeration after initialize and is unsuitable for servers that intentionally expose no tools, resources, or prompts. A lightweight preflight should validate the MCP session handshake itself.thv mcp checkwithauto, SSE, and streamable HTTP transport support.initialize, and connection close.Type of change
Test plan
task -t Taskfile.focused.yml test, using the repository's-raceand linker settings for./pkg/mcp/clientand./cmd/thv/app)task test-e2e)task lint-fix)Regenerated all CLI, Swagger, and Helm documentation with
task docs, then verified the CLI documentation byte-for-byte against a freshgo run cmd/help/main.gooutput directory.API Compatibility
v1beta1API.Changes
pkg/mcp/client/client.goProbeAPI that returns initialize metadata and the selected transport without enumerating capabilities.pkg/mcp/client/client_test.gocmd/thv/app/mcp_check.gocmd/thv/app/mcp_check_test.gocmd/thv/app/mcp.godocs/cli/thv_mcp_check.mddocs/cli/thv_mcp.mdDoes this introduce a user-facing change?
Yes. Users can now use
thv mcp check --server ... --format jsonas an MCP-native readiness gate for CI, GitOps, and Agent harnesses.Special notes for reviewers
The new probe intentionally does not call
tools/list,resources/list,prompts/list, or any tool. ExistingConnectcallers retain their behavior and API.