Skip to content

feat(tracking): tag agent-connected requests with client=mcp#56

Merged
tonychang04 merged 1 commit into
masterfrom
track-agent-source-client
Apr 26, 2026
Merged

feat(tracking): tag agent-connected requests with client=mcp#56
tonychang04 merged 1 commit into
masterfrom
track-agent-source-client

Conversation

@tonychang04

Copy link
Copy Markdown
Member

Summary

  • UsageTracker.reportAgentConnected() now sends client: 'mcp' in the request body to /tracking/v1/agent-connected.
  • Adds an assertion in usage-tracker.test.ts to lock in the new behavior.

Why

Pairs with insforge-cloud-backend#472, which adds an optional client field on the cloud endpoint so PostHog/Mixpanel can break down agent-connected events by source. Without this MCP-side change, every MCP session reports as client: 'unknown' and is indistinguishable from CLI traffic.

Test plan

  • Connect any MCP client (Claude Code, Cursor, etc.) to a project, watch the /tracking/v1/agent-connected request body — should include "client":"mcp"
  • Verify cloud-side event in PostHog shows client=mcp property
  • npm test passes

🤖 Generated with Claude Code

Pairs with cloud-backend support for a `client` field on
/tracking/v1/agent-connected so PostHog/Mixpanel can tell MCP
connections apart from CLI. Without this, both sources POST
identical bodies and the cloud cannot distinguish first-CLI-user
from first-MCP-user adoption.
@coderabbitai

coderabbitai Bot commented Apr 25, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@tonychang04 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 31 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 6 minutes and 31 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9606df8e-c0f9-4689-a212-6857baa8837c

📥 Commits

Reviewing files that changed from the base of the PR and between 0ae2fa4 and 9f1c962.

📒 Files selected for processing (2)
  • src/shared/usage-tracker.test.ts
  • src/shared/usage-tracker.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch track-agent-source-client

Comment @coderabbitai help to get the list of available commands and usage tips.

@tonychang04
tonychang04 requested a review from jwfing April 25, 2026 06:31
@tonychang04
tonychang04 merged commit 649b586 into master Apr 26, 2026
2 checks passed
@tonychang04 tonychang04 mentioned this pull request May 1, 2026
4 tasks
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.

2 participants