feat(mcp): notification and self-service read tools - #7718
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7718 +/- ##
==========================================
+ Coverage 75.94% 75.96% +0.01%
==========================================
Files 445 446 +1
Lines 23990 24002 +12
Branches 6404 6404
==========================================
+ Hits 18220 18232 +12
Misses 5770 5770
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
179b11c to
73b4713
Compare
8bfb22e to
9742987
Compare
73b4713 to
e6e47ac
Compare
e6e47ac to
0438f64
Compare
103f9ae to
5773bdb
Compare
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
eae081f to
e04360f
Compare
Add read-only MCP tools for the current user profile, own notifications and own team invitations, and allow-list their scopes for the expert-mcp platform token.
0438f64 to
65cb66e
Compare
| Lists the authenticated user's own notifications, with pagination. | ||
| Use this to check for unread alerts or recent activity addressed to the current user.`, | ||
| annotations: { readOnlyHint: true, destructiveHint: false }, | ||
| inputSchema: { ...basePagination }, |
There was a problem hiding this comment.
this endpoint does not support pagination
There was a problem hiding this comment.
GET /api/v1/user/notifications does paginate. It runs through getNotifications in forge/services/notifications.js, which calls app.getPaginationOptions(request) and passes it to Notification.forUser, and the response carries meta and count. Confirmed against a running instance: platform_list_notifications { limit: 1 } returned 1 of 4 notifications with meta.next_cursor set, and passing that cursor back returned the next entry. So cursor and limit are correct on this tool.
| Use this to check whether the current user has any pending invitations to join a team. | ||
| No parameters or body required.`, | ||
| annotations: { readOnlyHint: true, destructiveHint: false }, | ||
| inputSchema: {}, |
There was a problem hiding this comment.
GET /api/v1/user/invitations does not paginate. It calls Invitation.forUser(request.session.User) with no pagination options and always returns meta: {} (that line carries a // For future pagination note in forge/routes/api/userInvitations.js), returning every invitation. Confirmed against a running instance: with two pending invitations, platform_list_own_invitations { limit: 1 } still returned both, and { limit: 1, cursor: "bogus" } returned the same two with no error. So the params have no effect, which is why this tool has no pagination params; we can add them if the endpoint gains real pagination later.
|
Verified the pagination behavior by invoking the tools against a local instance.
Conclusion: notifications supports |
…cations-read # Conflicts: # forge/routes/auth/permissions.js
Summary
Adds Phase 1 read-only MCP tools for user self-service #7702 .
Tool file:
forge/ee/lib/mcp/tools/user.jsTools added:
platform_get_current_user-GET /api/v1/userplatform_list_notifications-GET /api/v1/user/notifications(paginated)platform_list_own_invitations-GET /api/v1/user/invitationsAll three are tagged
readOnlyHint: true, destructiveHint: false.Permissions:
#8185 removed the hardcoded
user:expert-mcpscope allow-list, so expert MCP tokens now inherit the user's permissions gated by team role and no allow-list entries are needed.Write, delete, and admin-only endpoints from the parent issue #7703 #7704 are out of scope for this PR, as are the excluded sensitive self-service routes (change_password, account deletion, MFA, tokens).
Closes #7702
Test plan
eslintclean on changed files