Skip to content

feat(projects): add CLI and MCP install onboarding stages - #13717

Merged
eldadfux merged 4 commits into
mainfrom
cursor/onboarding-mcp-cli-install-ecf7
Sep 23, 2026
Merged

eldadfux merged 4 commits into
mainfrom
cursor/onboarding-mcp-cli-install-ecf7

Conversation

@eldadfux

@eldadfux eldadfux commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Adds CLI install (cli.install) and MCP install (mcp.install) as project onboarding stages.

There is no dedicated install API for these tools. First successful usage is detected from x-sdk-name (mcp, cli, command line) or x-sdk-language (cli / mcp), then written onto project.onboarding through the existing API shutdown persist path (same JSON, status, timestamp, actor type, and lock as other stages).

A request can complete more than one stage at once (for example CLI creating a function records both functions.create and cli.install).

Writes happen once per stage:

  • Requests without those SDK headers return before any onboarding work beyond the existing method-key check.
  • If the cached project already has the stage completed or skipped, the hook returns without taking the Redis lock or writing.
  • Under the lock, the project is re-read and the write is skipped when another request already recorded the stage, so later CLI/MCP traffic cannot rewrite at / actorType or clobber other keys.

Test Plan

  • List stages includes cli.install and mcp.install.
  • GET /v1/ping with x-sdk-name: mcp marks mcp.install completed on the project.
  • GET /v1/ping with x-sdk-name: cli or x-sdk-language: cli marks cli.install completed.
  • A second MCP ping authenticated with an API key leaves at and actorType unchanged.
  • Existing skip / pending update-stage behavior is unchanged.

E2E coverage is in tests/e2e/Services/Project/StagesBase.php.

Related PRs and Issues

  • Follows the onboarding stages work (project.onboarding) instead of a separate mcpLastAccessAt attribute.

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?
Open in Web Open in Cursor 

Track first successful CLI and MCP usage on the project onboarding
document using the existing shutdown persist path, keyed off x-sdk-name
and x-sdk-language rather than a dedicated API method.

Co-authored-by: Eldad A. Fux <[email protected]>
@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → cursor/onboarding-mcp-cli-install-ecf7 (after).

Metric Before After Change
🚀 Requests/sec 163.88 170.56 ⚪ +4.1%
⏱️ Latency P50 106.88 ms 99.94 ms 🟢 -6.5%
⏱️ Latency P95 247.19 ms 238.8 ms ⚪ -3.4%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 99.94 238.8 10,830 170.56 -8.39
Account 199.21 380.16 570 9.44 +7.99
TablesDB 96.06 180.29 5,890 95.53 -12.85
Storage 91.46 196.03 2,850 47.65 -18.26
Functions 146.58 291.67 1,520 26.1 -1.31

Top API waits (after)

API request Max wait (ms)
account.name.update 547.54
tablesdb.rows.delete 526.7
functions.create 518.28
tablesdb.rows.increment 502.04
storage.buckets.create 452.48

cursoragent and others added 3 commits September 16, 2026 08:11
Skip header matching when SDK headers are absent, skip the lock when
the cached project already has the stage, and re-read under the lock so
a later request never rewrites a completed row.

Co-authored-by: Eldad A. Fux <[email protected]>
Reuse the same x-sdk-name matching as Cloud SDK access tracking, keep the
existing onboarding shutdown write path, and drop the lock re-read layer.

Co-authored-by: Cursor <[email protected]>
@eldadfux
eldadfux marked this pull request as ready for review September 23, 2026 17:30
@greptile-apps

greptile-apps Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

The PR is not safe to merge until onboarding updates reread and merge current state while holding the lock and reliably handle contention.

Summary

This PR adds CLI and MCP installation milestones to project onboarding and detects their first successful API usage from SDK headers.

  • Adds cli.install and mcp.install to the configured onboarding-stage list.
  • Allows one successful request to complete both its SDK-method stage and its CLI/MCP installation stage.
  • Adds end-to-end coverage for stage listing, header-driven completion, and preserving an existing completion timestamp.
  • The persistence path does not currently uphold its concurrency guarantee because it writes a pre-lock snapshot without rereading or merging under the lock.

Reviews (1) · Last reviewed commit: "refactor(projects): simplify CLI/MCP onb..."

@greptile-apps

greptile-apps Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff

These findings sit on lines the diff does not cover, so they could not be posted inline. Each one leaves this list once its file changes.

  • P1 Concurrent completions are lost app/controllers/shared/api.php:1307 ▶

    When two first-use requests complete different onboarding stages concurrently, each builds the full onboarding value from its project snapshot before acquiring the lock. The lock callback then writes that stale array without rereading or merging the current project state. If the second request acquires the lock after the first, it can overwrite the first completion; if the lock is still held, tryWithKey skips the second write immediately. Either path can leave a successfully completed stage pending.

@eldadfux
eldadfux enabled auto-merge (squash) September 23, 2026 17:37
@eldadfux
eldadfux merged commit c3e1489 into main Sep 23, 2026
49 checks passed
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.

3 participants