Repository navigation
feat(mcp): add scoped read-only agent access - #779
Merged
Merged
Conversation
Add a stateless Streamable HTTP endpoint with dedicated hashed read tokens, explicit project scopes, live membership checks, transactional lifecycle audit and shared per-token/organization rate limits. Keep MCP off by default and refuse access when ingest scrubbing is disabled. Expose five privacy-minimized read tools, token settings, Copy for agent, client setup docs and protocol, security, UI and database integration tests.
This was referenced Oct 12, 2026
Merged
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.
Change
Coding agents can read selected Telemetry Tracker projects through one stateless
Streamable HTTP
POST /mcpendpoint. Five tools expose minimized telemetry;Settings → Agent access creates/revokes dedicated expiring tokens, and issue
details offer a server-sanitized Copy for agent action. Adds an additive migration
and setup examples for all seven requested clients.
Security and design
tt_read_<publicId>_<256-bit secret>; SHA-256 digest at rest, timing-safeverification, one-time disclosure, 90-day default / 365-day maximum expiry.
Read tokens are rejected everywhere except
/mcp; ingest keys and dashboardsessions cannot authenticate MCP. No OAuth or write tools.
Every request intersects scope with active projects and creator's current org
membership (TT grants project access through org membership). No auth cache.
canCreateApiKey(OWNER/EDITOR integration permission);VIEWER cannot create. Creator may revoke their own token; OWNER may revoke any
in the org. Create/revoke/observed-expiry audit and mutations commit together.
Expiry audit is recorded once at first authenticated observation after expiry.
Persistent last-used, total request count and last-tool fields contain no secrets.
readOnlyHint: true. Output uses explicit fields, countsrather than identities, no context/properties/source maps, read-time scrubbing,
query removal, labelled untrusted strings, truncation and control/invisible
character stripping. API/dashboard Sentry filters also redact read tokens.
DB-backed atomic token/org minute buckets are shared across replicas: Free
30/120, paid 120/600. Browser-origin requests are refused.
TELEMETRY_MCP_ENABLED=true; also refused when ingest scrubbing isdisabled. Migration must be applied before enablement.
Proxy finding / release gate
Fastify has no
trustProxyconfiguration and existing Fastify rate-limit scopesuse the default IP key. If Railway exposes a proxy source IP, existing clients may
share buckets. This is supported by code, not verified against production traffic.
MCP quotas are independent of IP. Unconditional proxy trust is unsafe without the
trusted-hop boundary, so existing behavior is documented for operator follow-up.
Do not release until this concern is resolved and database CI passes.
No merge, deploy, release PR or production access occurred. Runner publishes this
feature PR only.
origin/developand the starting HEAD are4dc79e9; localdevelopis stale.origin/mainandorigin/develophave identical trees; theonly develop-only commit is reviewed sync PR #777. Refresh that assessment before
any eventual release.
Validation
pnpm lint: pass, zero warnings.pnpm test: 1,551 passed; 163 DB integration tests skipped (includes 17 new MCPDB tests). API 1,103; dashboard 300; core 67; Vite 14; Node 27; Next 15; React
Native 8; publishing guards 17. No test failures.
contains 5 read-only tools; each tool OK; privacy, scope and write denial OK.
Also adds a real-DB running-endpoint SDK test for CI.
pnpm build: pass across all workspaces (includes production TS validation).tsc --noEmit -p apps/api/tsconfig.build.json: pass.tsc --noEmit -p tsconfig.json: 106 existing diagnostics in unchangedtest files. Dashboard
tsc --noEmit: 6 existing diagnostics in unchangedgoogle-analytics/marketing-seo-head tests. No diagnostics in new MCP/UI files.
Tests and type settings were not weakened.
tests are pending outside sandbox: local
initdbfailed withshmget: Operation not permitted. CI already runs migrations and DB integration tests.git diff --check: pass; reviewed both tracked diff and new files. Incidentalgenerated version / React Native dist changes from build were restored.
Legal review needed
TODO(legal) in setup docs and deployment docs: review customer-selected AI export
wording and any required privacy-policy/DPA changes. Neutral wording only; no
claim of existing policy/DPA coverage or EU-only processing.
/privacyunchanged.Follow-ups / limits
Verify Railway proxy trust and existing IP limiter behavior before release. Run
all DB integration tests and the migration on the CI database; wait for required
CI checks. Legal review remains pending. Offset pagination is bounded to 10,000
and may shift during ingest. Pattern-based scrubbing cannot guarantee removal of
all identifying free text; no arbitrary context is returned. Expiry audit is lazy;
usage is cumulative rather than a per-day ledger. Hard-deleted token/org bucket
rows can be cleaned by an operator. Zed docs do not establish env expansion in
remote headers: its env-only example uses the third-party mcp-remote bridge;
review/pin it under dependency policy, or use an external agent's native config.