Skip to content

feat: PlatformSystemResourceProvider (system-scope MCP resources)#51

Merged
poxet merged 3 commits into
masterfrom
feature/mcp-platform-data
Apr 20, 2026
Merged

feat: PlatformSystemResourceProvider (system-scope MCP resources)#51
poxet merged 3 commits into
masterfrom
feature/mcp-platform-data

Conversation

@poxet
Copy link
Copy Markdown
Contributor

@poxet poxet commented Apr 20, 2026

Summary

Phase 5 MCP work, system-scope slice. Exposes read-only diagnostic data under platform://system/* for Developer callers.

What's new

PlatformSystemResourceProvider in Tharga.Platform.Mcp — opt-in via McpPlatformOptions.ExposeSystemResources (default false).

Resources (listed only when the matching dependency is registered):

URI Source
platform://system/apikeys IApiKeyAdministrationService.GetSystemKeysAsync() — raw values / hashes redacted
platform://system/roles ITenantRoleRegistry.All
platform://system/audit CompositeAuditLogger.QueryAsync — last 7 days, top 100

Non-Developer callers get an empty ListResourcesAsync and UnauthorizedAccessException from ReadResourceAsync.

Sample wiring

Tharga.Platform.Sample now registers the MCP bridge:

builder.Services.AddThargaMcp(mcp => mcp.AddMcpPlatform());
// ...
app.UseThargaMcp();

Deferred

Cross-tenant team listing (platform://system/teams) and per-team API-key listing require a new ITeamService.GetAllTeamsAsync() method and matching base-class / repository implementation. Tracked as a follow-up.

A related cross-project request was filed under Tharga.Mcp to have UseThargaMcp() auto-apply .RequireAuthorization() when ThargaMcpOptions.RequireAuth == true. Once that lands, MapMcpPlatform() in this package becomes redundant.

Tests

11 new (9 provider + 2 registration). Full suite: 235 passing.

Test plan

  • Build + security checks pass
  • Sample runs; MCP endpoint at /mcp responds
  • With ExposeSystemResources = true, Developer sees the three resources; non-Developer sees none

poxet added 3 commits April 20, 2026 21:03
Phase 5 (system slice). Opt-in via ExposeSystemResources on
McpPlatformOptions. Read-only resources for Developer callers:

- platform://system/apikeys — system API keys (raw values redacted)
- platform://system/roles   — registered tenant roles
- platform://system/audit   — recent audit entries (last 7 days, top 100)

Non-developer callers get empty ListResourcesAsync and
UnauthorizedAccessException from ReadResourceAsync. Each resource is
listed only when its underlying dependency is registered.

Cross-tenant team/member listings deferred — require a new
ITeamService surface.

11 new tests, 235 total passing.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 20, 2026

Codecov Report

❌ Patch coverage is 91.58879% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...rga.Platform.Mcp/PlatformSystemResourceProvider.cs 91.34% 3 Missing and 6 partials ⚠️

📢 Thoughts on this report? Let us know!

@poxet poxet merged commit 01fe5e9 into master Apr 20, 2026
5 of 6 checks passed
@poxet poxet deleted the feature/mcp-platform-data branch April 20, 2026 20:09
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.

1 participant