feat(mcp): add live analytics tools backed by shared loaders#2046
feat(mcp): add live analytics tools backed by shared loaders#2046bohdansolovie wants to merge 1 commit into
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2046 +/- ##
==========================================
- Coverage 93.26% 93.12% -0.15%
==========================================
Files 48 49 +1
Lines 7755 7878 +123
Branches 2839 2899 +60
==========================================
+ Hits 7233 7336 +103
- Misses 92 94 +2
- Partials 430 448 +18
🚀 New features to boost your workflow:
|
c262e23 to
7c8d88c
Compare
Expose get_subnet_uptime, get_registry_leaderboards, compare_subnets, and get_global_incidents as MCP tools, backed by src/analytics-live.mjs loaders shared with the REST analytics routes. Closes JSONbored#1958.
7c8d88c to
9529df4
Compare
JSONbored
left a comment
There was a problem hiding this comment.
Closes #1958 (open, wanted). Four new MCP tools (get_subnet_uptime, get_registry_leaderboards, compare_subnets, get_global_incidents) backed by src/analytics-live.mjs. The new loaders are correct extractions of the REST-layer logic; the MCP tool definitions in src/mcp-server.mjs are well-formed. Substantively good.
Same block as #2032: the diff includes public/.well-known/mcp/server-card.json (committed under the old workflow) and also public/metagraph/operational-surfaces.json + public/metagraph/r2-manifest.json (generated build artifacts that should never be committed). #2055 deleted the server-card from git, causing a conflict. Closing. Resubmit with three files dropped from the diff entirely: public/.well-known/mcp/server-card.json, public/metagraph/operational-surfaces.json, public/metagraph/r2-manifest.json. The analytics-live module and the MCP tool additions are clean — I'll take them on a fresh branch.
Summary
src/analytics-live.mjswith shared live analytics loaders (loadSubnetUptime,loadRegistryLeaderboards,loadCompareSubnets,loadGlobalIncidents) for MCP tools.get_subnet_uptime→/api/v1/subnets/{netuid}/uptimeget_registry_leaderboards→/api/v1/registry/leaderboardscompare_subnets→/api/v1/compareget_global_incidents→/api/v1/incidentscomposeCompareDatafromworkers/request-handlers/analytics-routes.mjs(refactor(api): extract deferred analytics routes from api.mjs #1919) — noapi.mjshandler reversion, no logic duplication.Closes #1958
Resubmission of #1960: single commit by
bohdansolovie, rebased on latestmainafter #1919 landed.Test plan
npm test -- tests/analytics-live.test.mjs tests/compare.test.mjs tests/mcp-server.test.mjsnpm run lintnpm run build(derived artifacts fresh)