Repository navigation
feat(telemetry): count appwrite.io WebMCP tool calls - #171
Closed
ChiragAgg5k wants to merge 2 commits into
Closed
ChiragAgg5k wants to merge 2 commits into
ChiragAgg5k wants to merge 2 commits into
Conversation
appwrite.io registers WebMCP tools that browser agents call in the page, so the server never sees those calls. The page now reports each one to POST /webmcp/events as a text/plain beacon, and the server records mcp.webmcp.calls (tool, status, error code) and mcp.webmcp.duration for the MCP dashboard. Labels are allowlisted, so a caller cannot create new series.
🟢 Tier S · Ready to mergeAdds a public
📂 Walkthrough · 5
🔇 Filtered out · 1Findings Hansi considered but did not post.
Reviewed |
Preview, staging and local builds of the site run the same reporting code; their beacons are accepted but not counted, so the dashboard shows production traffic only.
Member
Author
|
Closing in favour of recording WebMCP calls as appwrite.io analytics events in the console (appwrite/appwrite#15560). The tools belong to the site, so their telemetry belongs there too, without a public write endpoint or a tool list duplicated here. |
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.
appwrite.io now exposes 8 WebMCP tools that browser agents call inside the page (appwrite/appwrite#15549). Those calls never reach this server, so the MCP dashboard can't see them. This adds a beacon endpoint for appwrite.io to report each call to, recorded with the existing telemetry pipeline.
Change
POST /webmcp/events(plusOPTIONS) takes{"tool", "status", "code"?, "durationMs"}. The page sends it withnavigator.sendBeacon, a text/plain body, so there is no CORS preflight. It answers204with the shared CORS headers,400for a malformed event and413for a body over 1 KiB.mcp.webmcp.calls, a counter withtool_name,statusanderror_codelabels (mcp_webmcp_calls_totalin Mimir).mcp.webmcp.duration, a histogram with atool_namelabel (mcp_webmcp_duration_seconds_bucketin Mimir).tool_name,statusanderror_codeare checked against allowlists inconstants.py, which mirrorapps/console/src/lib/webmcp/site/tools.ts. Anything else counts asother, so an anonymous caller can inflate counts but can't create new series. The page never sends tool inputs or any identifier.Originishttps://appwrite.io. Preview, staging and local builds run the same page code; their beacons get204but are not recorded.telemetry.py, this records nothing unless OTLP export is configured.The dashboard panels follow in appwrite-labs/monitoring, and the page-side beacon in appwrite/appwrite.
Tests
WebMcpEventsRouteintests/e2e/test_tools.py:other, and beacons from other origins (or with none) not being counted.400, oversized bodies413, and preflight204.ruff,black --checkandpyright(0 errors) are all clean.