test(scorecard): add MCP integration coverage for scorecard tools#3664
test(scorecard): add MCP integration coverage for scorecard tools#3664HusneShabbir wants to merge 3 commits into
Conversation
Add backend-level MCP integration tests for list-metrics and get-entity-metrics, including visibility, permission, validation, and error-path checks. Co-authored-by: Cursor <cursoragent@cursor.com>
Changed Packages
|
|
🤖 Finished Review · ✅ Success · Started 8:53 AM UTC · Completed 9:06 AM UTC |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3664 +/- ##
==========================================
- Coverage 54.31% 54.09% -0.23%
==========================================
Files 2349 2340 -9
Lines 89701 89309 -392
Branches 25127 24958 -169
==========================================
- Hits 48722 48312 -410
- Misses 40685 40709 +24
+ Partials 294 288 -6
*This pull request uses carry forward flags. Click here to find out more. Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
ReviewFindingsMedium
Low
|
Move MCP test-only packages back to devDependencies and switch CallToolResult to z.infer from the SDK schema to match the reference implementation. Co-authored-by: Cursor <cursoragent@cursor.com>
|
yangcao77
left a comment
There was a problem hiding this comment.
generally looks good.
The only thing is the zod/v4 import. it should be zod to match the workspace and the reference test. Everything else is good to go.
| import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'; | ||
| import { CallToolResultSchema } from '@modelcontextprotocol/sdk/types.js'; | ||
| import type { Server } from 'node:http'; | ||
| import type { z } from 'zod/v4'; |
There was a problem hiding this comment.
The scorecard codebase uses from zod, and the mcp-integrations reference test also uses from zod. The zod/v4 subpath is a zod 4.x feature; this workspace is on zod 3.x.



Summary
Adds MCP integration coverage for Scorecard backend tools with a reusable test helper.
Resolves:
https://redhat.atlassian.net/browse/RHIDP-14592
Test Coverage
scorecard.list-metricstools/listreadOnlyHint,destructiveHintshape)scorecardis excluded frombackend.actions.pluginSourcesscorecard.get-entity-metricsentityRefis missingentityReftype is invalidTest Infrastructure
packages/backend/src/__fixtures__/mcpTestUtils.tstest:integrationVerification
yarn --cwd workspaces/scorecard/packages/backend run test src/mcp-tools.integration.test.ts --watch=false