Add QIT MCP server - #467
Open
zhongruige wants to merge 11 commits into
Open
Conversation
zhongruige
marked this pull request as ready for review
July 6, 2026 22:51
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
Refs QIT-974.
This adds a read-only QIT MCP server for stdio MCP clients such as Magellan. The MVP is focused on reporting and debugging context for existing QIT runs: what happened, why a run failed, and what to inspect next.
The server intentionally does not enqueue tests, mutate local environments, upload packages, or wrap arbitrary CLI commands.
New command
qit mcpstarts a stdio MCP server. MCP mode is detected early in CLI bootstrap so stdout is reserved for JSON-RPC protocol messages only. Normal CLI sync notices, tips, update notices, and Symfony human-readable errors are suppressed in this mode; diagnostics go to stderr or are returned as structured MCP tool errors.Example MCP client config:
{ "mcpServers": { "qit": { "command": "qit", "args": ["mcp"] } } }MCP tools
qit_get_run: returns normalized run metadata, status, product identifiers, report URL, timestamps, decoded result fields, and artifact hints.qit_get_results: returns CTRF results when available, otherwise legacy result JSON.qit_get_failures: summarizes failed/error tests, messages, traces/snippets, debug log signals, and next-step hints.qit_get_last_local_run_context: reads the local~/.qit/last-run.jsoncontext.qit_list_environments: returns known local QIT environments and status.qit_get_artifacts: returns known report URLs, local artifact paths, traces, screenshots, logs, and result files.Sensitive URLs and known secrets are redacted by default. Report URLs can be included with
include_sensitive_urls=true, while known secret values remain redacted.Testing instructions
Build the packaged CLI before manual MCP smoke testing:
Manual MCP protocol smoke test using the built binary:
Expected behavior: stdout contains only a single JSON-RPC initialize response, with no human-readable CLI notices mixed into the protocol stream.
Client smoke test against the built binary:
{ "mcpServers": { "qit-local": { "command": "/absolute/path/to/qit-cli/qit", "args": ["mcp"] } } }./qitbinary as the stdio MCP server command in the client config.tools/listincludes the six QIT tools above.qit_get_last_local_run_contextafter a local QIT run, or callqit_get_run/qit_get_failureswith a knowntest_run_id.Regression workflows worth verifying
These are the areas most likely to be affected by MCP bootstrap and reporting reuse:
RequestBuilderpath as existing CLI commands.qit_list_environmentsreads the same local monitor state used byenv:list.qit_get_last_local_run_contextandqit_get_artifactswith the local~/.qit/last-run.jsoncontext and expected report/artifact paths.Note: PHPUnit currently emits PHP 8.5 deprecation notices from existing test bootstrap paths, but the targeted tests pass.