feat: MCP user-scope and team-scope resource providers#68
Merged
Conversation
Extends the Tharga.Platform.Mcp bridge beyond the system slice with two always-on resource providers that surface the authenticated caller's own Platform data. - PlatformUserResourceProvider (McpScope.User) — platform://me with the caller's IUser + memberships across teams. - PlatformTeamResourceProvider (McpScope.Team) — platform://team, platform://team/members, platform://team/apikeys rooted at the caller's current team via the TeamKey claim. ApiKey raw values are redacted. - New ITeamService.GetMembersAsync(teamKey) returning IAsyncEnumerable<ITeamMember>, with a default TeamServiceBase implementation that reuses the existing reflection helper. The AuditingTeamServiceDecorator forwards the call through. Both providers register automatically in AddPlatform(); they self-gate on principal claims, so anonymous and system-only callers see nothing. 17 new tests, 313 / 313 passing. Cross-tenant team listing (system slice platform://teams) remains deferred — needs ITeamService.GetAllTeamsAsync.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
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.
Summary
Extends the
Tharga.Platform.Mcpbridge beyond the system slice (PR #51) with two always-on resource providers that surface the authenticated caller's own Platform data. Closes most of the deferred work tracked inRequests.md→ "Tharga.Platform — MCP / MCP Provider for Team/User data".PlatformUserResourceProvider(McpScope.User) —platform://mereturns the caller'sIUserplus amembershipsarray (teamKey, teamName, accessLevel, state).PlatformTeamResourceProvider(McpScope.Team) —platform://team,platform://team/members,platform://team/apikeysrooted at the caller's current team via theTeamKeyclaim. RawApiKeyvalues are redacted (theapiKeyproperty is omitted entirely).ITeamService.GetMembersAsync(teamKey)returningIAsyncEnumerable<ITeamMember>so providers can enumerate members without knowing the consumer-specificTMembertype. DefaultTeamServiceBaseimplementation reuses the existing reflection helper;AuditingTeamServiceDecoratorforwards.Both providers register automatically in
AddPlatform()— no new opt-in option. They self-gate on principal claims, so anonymous and system-only callers see no resources.Behaviour change for consumers
AddPlatform()now registers two additionalIMcpResourceProviderinstances. Consumers don't need to touch their wiring.ITeamServiceaddsGetMembersAsync. Consumers subclassingTeamServiceBase(the common path) get the default automatically. Consumers implementingITeamServicedirectly (rare) need to add the method.Out of scope (deferred)
platform://teamslisting in System scope — requires a newITeamService.GetAllTeamsAsync(). TheRequests.mdMCP entry stays open for this last piece.IMcpToolProvider) — read-only resources only in this feature; mutating operations are not exposed.Test plan
Documentation