Skip to content

feat(mcp): broker read tools - #7723

Open
andypalmi wants to merge 3 commits into
mainfrom
feat/mcp-tools-broker-read
Open

feat(mcp): broker read tools#7723
andypalmi wants to merge 3 commits into
mainfrom
feat/mcp-tools-broker-read

Conversation

@andypalmi

Copy link
Copy Markdown
Contributor

Summary

Adds read-only MCP tools for the team broker (built-in MQTT broker) and 3rd-party broker surface in forge/ee/lib/mcp/tools/broker.js:

  • platform_list_broker_clients - GET /api/v1/teams/:teamId/broker/clients
  • platform_get_broker_client - GET /api/v1/teams/:teamId/broker/client/:username
  • platform_list_brokers - GET /api/v1/teams/:teamId/brokers
  • platform_get_broker - GET /api/v1/teams/:teamId/brokers/:brokerId
  • platform_list_broker_topics - GET /api/v1/teams/:teamId/brokers/:brokerId/topics
  • platform_get_broker_schema - GET /api/v1/teams/:teamId/broker/:brokerId/schema

All six tools carry readOnlyHint: true / destructiveHint: false and none of them return raw broker credentials.

Allow-lists the backing scopes in IMPLICIT_TOKEN_SCOPES['user:expert-mcp'] (forge/routes/auth/permissions.js):

  • broker:clients:list
  • broker:credentials:list
  • broker:topics:list

This scope is under special review (credential-sensitive category), so only these read tools are proposed here. The credential-issuing endpoints (broker client create/link, client password update, 3rd-party broker registration, raw credential fetch) and the non-credential write/delete surface (topic CRUD, lifecycle, delete client) are intentionally out of scope for this PR.

Closes #7711

Test plan

  • eslint clean on forge/ee/lib/mcp/tools/broker.js and forge/routes/auth/permissions.js
  • Endpoint URLs verified against the route definitions in forge/ee/routes/teamBroker/index.js, forge/ee/routes/teamBroker/3rdPartyBroker.js, and forge/ee/routes/teamBroker/schema.js

@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.20%. Comparing base (a8f760b) to head (b5b32f5).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7723      +/-   ##
==========================================
+ Coverage   76.17%   76.20%   +0.02%     
==========================================
  Files         440      441       +1     
  Lines       23604    23627      +23     
  Branches     6285     6285              
==========================================
+ Hits        17981    18004      +23     
  Misses       5623     5623              
Flag Coverage Δ
backend 76.20% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@andypalmi
andypalmi force-pushed the feat/mcp-tools-broker-read branch from de587bd to c72a379 Compare July 4, 2026 13:33
@andypalmi andypalmi linked an issue Jul 6, 2026 that may be closed by this pull request
@andypalmi
andypalmi force-pushed the feat/mcp-tools-shared-schemas branch from 8bfb22e to 9742987 Compare July 6, 2026 13:13
@andypalmi
andypalmi force-pushed the feat/mcp-tools-broker-read branch from c72a379 to 4b1fa96 Compare July 6, 2026 16:38
@andypalmi
andypalmi force-pushed the feat/mcp-tools-broker-read branch from 4b1fa96 to cb1cf5c Compare July 6, 2026 22:01
@andypalmi
andypalmi marked this pull request as draft July 30, 2026 08:21
@andypalmi
andypalmi force-pushed the feat/mcp-tools-shared-schemas branch from 103f9ae to 5773bdb Compare August 3, 2026 13:19
Add forge/ee/lib/mcp/schemas.js, a shared module of composable zod
fragments the platform read tools import instead of redefining entity-id
and pagination/search/sort/audit-log query fields in each tool file.

- entity-id params: teamId, applicationId, hostedInstanceId (UUID),
  remoteInstanceId, snapshotId
- query fragments composed per route by spreading only the params the
  backing finder honors: cursorParam/limitParam (basePagination),
  pageParam, searchQuery, sortParams, auditLogFilters
- appendQuery serialises a tool's supported params onto the request URL

The module lives one level above tools/ so the tool loader does not
register it as a tool module.

Closes #7669
@andypalmi
andypalmi force-pushed the feat/mcp-tools-shared-schemas branch from eae081f to e04360f Compare August 3, 2026 14:13
Expose read-only team broker tools: list/get clients, list/get brokers, list topics and get the AsyncAPI schema.
@andypalmi
andypalmi force-pushed the feat/mcp-tools-broker-read branch from cb1cf5c to ae8469b Compare August 3, 2026 15:28
@andypalmi
andypalmi requested a review from cstns August 4, 2026 12:00
@andypalmi andypalmi self-assigned this Aug 4, 2026
@andypalmi
andypalmi marked this pull request as ready for review August 4, 2026 12:34
Base automatically changed from feat/mcp-tools-shared-schemas to main August 5, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5.13-a Read tools (phase 1)

2 participants