test(mcp-integrations): add MCP plugin and backend integration tests#3232
test(mcp-integrations): add MCP plugin and backend integration tests#3232HusneShabbir wants to merge 2 commits into
Conversation
Missing ChangesetsThe following package(s) are changed by this PR but do not have a changeset:
See CONTRIBUTING.md for more information about how to add changesets. Changed Packages
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3232 +/- ##
==========================================
+ Coverage 60.97% 61.00% +0.03%
==========================================
Files 2098 2098
Lines 65140 65150 +10
Branches 17029 17029
==========================================
+ Hits 39721 39747 +26
+ Misses 25180 25164 -16
Partials 239 239
*This pull request uses carry forward flags. Click here to find out more. Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
4921c97 to
f1a9e17
Compare
Add integration tests for action registration and MCP tools/list/call coverage, including auth and pluginSources filtering. Mark read-only actions with MCP attributes and configure backend test runner to exit cleanly after integration runs. Co-authored-by: Cursor <cursoragent@cursor.com>
f1a9e17 to
827b7fe
Compare
Remove MCP readOnly attributes on actions not covered by hint assertions. Consolidate backend integration tests, tighten 401 auth checks, and add test:unit/test:integration scripts with --watch=false for clean local exits. Co-authored-by: Cursor <cursoragent@cursor.com>
|



Summary
Adds integration tests for MCP overlay plugins: lightweight plugin wiring checks (action registration) and a backend HTTP suite against
/api/mcp-actions/v1(tools/list,tools/call, auth).Also adds
test:unit/test:integrationscripts (--watch=falseso local runs exit instead of staying in Backstage’s default Jest watch mode) and backend test dependencies for the MCP client.Test file structure
Total: 4 files · 11 integration tests (included in CI via
yarn test:all)Plugin tests — “does the plugin register the right actions?”
Each file starts
startTestBackend, capturesactionsRegistry.register(), and asserts action names and count.software-catalog-mcp-extras/.../plugin.integration.test.tsquery-catalog-entities(1)techdocs-mcp-extras/.../plugin.integration.test.tsfetch-techdocs,analyze-techdocs-coverage,retrieve-techdocs-content(3)scaffolder-mcp-extras/.../plugin.integration.test.tsexecute-template,fetch-template-metadata,get-scaffolder-task-logs,list-scaffolder-actions,list-scaffolder-tasks,validate-scaffolder(6)Backend test — “does the MCP server work over HTTP?”
packages/backend/src/mcp-tools.integration.test.ts— Streamable HTTP MCP client against a real test backend (shared backend for fullpluginSources; MCP session teardown viaterminateSession+client.close).inputSchema, read-only/destructive MCP hints (actions that declareattributesonly)query-catalog-entities→{ entities: [] }analyze-techdocs-coverage→ zero coverage statsfetch-template-metadata→{ templates: [] }query-catalog-entitiestool401with expected error messagetools/listsucceedsSupporting changes
attributesonfetch-techdocsandretrieve-techdocs-content(read-only MCP hints covered by the backend test; scaffolder read-only/destructive tools already hadattributesonmain)devDependencies:@backstage/backend-test-utils,@modelcontextprotocol/sdk,@backstage/backend-plugin-api,@backstage/errors,@backstage/plugin-catalog-nodetest:unit/test:integration; backendtest:integrationfor the HTTP suite;--watch=falseon integration scripts so they exit locally (CI already setsCI=true)CI
When
workspaces/mcp-integrationschanges, Test changed packages runsyarn test:all, which includes these integration tests alongside existing unit tests (no separate job required).