Conversation
- AddCache() extension on IThargaMcpBuilder registers both providers. - CacheResourceProvider exposes four System-scope resources: cache://types, cache://items, cache://health, cache://queue. - CacheToolProvider exposes two System-scope tools: cache.clear_stale and cache.clear_all. - Persist type names are surfaced with the leading 'I' stripped (Memory/Redis/MongoDB/File) to match the Blazor UI convention.
10 tests covering: - Resource provider: lists 4 descriptors; each resource read returns well-formed JSON (types, items, health, queue); unknown URI returns explanatory text. - Tool provider: lists 2 tools; clear_stale and clear_all delegate to ICacheMonitor; unknown tool returns IsError=true. Tharga.Cache.Tests now references Tharga.Cache.Mcp directly to keep the MCP tests alongside the rest of the unit tests.
The sample now exposes the cache via MCP at /mcp:
- AddThargaMcp(mcp => { mcp.Options.RequireAuth = false; mcp.AddCache(); })
- app.UseThargaMcp()
RequireAuth is set to false so the sample is reachable without auth
middleware. Production consumers leave it true and wire their own
authorization.
Per the updated shared-instructions, completed features live in the project's Plan directory ($DOC_ROOT/Tharga/plans/Toolkit/Cache/done/), not inside the repo's .claude/. Moved all 9 archived feature files out and deleted the now-empty .claude/features-done/ folder.
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
New package
Tharga.Cache.Mcpthat plugs into Tharga.Mcp and exposes the cache to MCP-aware AI clients.Closes the cross-project request "MCP Provider for Cache monitoring" (Quilt4Net Server / PlutusWave / Florida / Eplicta).
Registration
The naming follows the established
AddMongoDB/AddPlatform/AddCommunicationpattern onIThargaMcpBuilder(the request mentionedAddMcpCache()but consistency wins).Resources
cache://typesStaleWhileRevalidate,ReturnDefaultOnFirstLoadcache://itemscache://healthICacheMonitor.GetHealthTypes())cache://queueTools
cache.clear_staleICacheMonitor.ClearStale()cache.clear_allICacheMonitor.ClearAll()Deferred (out of scope for v1)
cache.evict— would need a new method onICacheMonitor(e.g.EvictAsync(Type, Key)) or a reflective hack viaIEternalCache.DropAsync<T>(key). Add when a consumer asks.CacheItemInfoonly tracksAccessCount(total reads). True hit/miss tracking requires new instrumentation inCacheBase/CacheMonitor. Separate change.Other changes
Tharga.Cache.Mcp/(net8/9/10), README, added to solution./mcp(RequireAuth=false for the demo).Tharga.Cache.Mcpin both stable and pre-release Pack steps.Tharga.Cache.Tests.Test plan
/mcpwith an MCP client, verify the four resources read and both tools execute.Tharga.Cache.Mcpv0.5.x publishes to NuGet alongside the other packages.