P12-T1: Add MCP Client Identification#51
Merged
Conversation
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.
Description
Detects the MCP client identity from the
initializehandshake and surfaces it in the dashboard. TheclientInfofield (name,version) is extracted from the initialize request params, stored in both in-memory metrics and the SQLite shared store, and displayed in a new "Active Client" KPI card on the dashboard.Changes:
schemas.py: AddedMCPClientInfo,MCPInitializeParamsmodels; addedclientInfofield toMCPParams; addedMCPRequest.get_client_info()method__main__.py: Inon_request(), captureclientInfofrominitializemethod; callmetrics.set_client_info()(defaults to"unknown"if absent)webui/metrics.py: Addedset_client_info(),client_name/client_versioninget_summary(), reset clears to"unknown"webui/shared_metrics.py: Addedclient_infotable (single-row upsert),set_client_info(), client fields inget_summary(),reset()clears client infowebui/static/index.html: Added "Active Client" KPI card (kpi-client)webui/static/dashboard.js:updateKPIs()rendersclient_name + " " + client_versionType of Change
Quality Gates
make test- All tests pass with ≥90% coverage (413 passed, 5 skipped; 96.04% coverage)make lint- No linting errors (ruff check src/clean)make format- Code is properly formattedmake typecheck- Type checking passes (mypy src/clean, 13 files)make doccheck- Documentation is synced with DocC (if docs changed)Documentation Sync
Testing
test_main.py,test_metrics.py,test_shared_metrics.pyNew tests cover:
test_main_captures_client_info_from_initialize— clientInfo extracted and forwarded to metricstest_main_defaults_unknown_when_no_client_info— missing clientInfo defaults to "unknown"TestMetricsCollectorClientInfo(4 tests) — set/overwrite/reset behavior in MetricsCollectorTestSharedMetricsStoreClientInfo(4 tests) — set/upsert/reset in SQLite SharedMetricsStoreValidation report:
SPECS/ARCHIVE/P12-T1_Add_MCP_Client_Identification/P12-T1_Validation_Report.mdChecklist