@cantinasecurity/apex-cli 0.1.27 → 0.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,9 +11,11 @@ This skill is bundled with Apex CLI and can be installed into the current reposi
11
11
 
12
12
  ## Instructions
13
13
 
14
- Use Apex through the MCP server when the `apex-*` tools are available.
14
+ Use Apex through the MCP server when the `apex-*` tools are available. The tools installed by `apex setup` use the local stdio server and device login.
15
15
 
16
- For serverless, cron, or other HTTP-only integrations, use the hosted Apex REST API instead of CLI or stdio MCP. Its scan trigger, status, and findings contract is documented at https://ai.cantina.xyz/docs/apex-api.
16
+ For a production MCP client that does not need local filesystem access, use the hosted Streamable HTTP endpoint at `https://ai.cantina.xyz/mcp`. Read the organization service key from `APEX_SERVICE_KEY` and supply it only as `Authorization: Bearer <TOKEN>`; never put the raw key in a tool argument, result, prompt, source file, or log. The hosted tools are `apex-credits`, `apex-workspaces`, `apex-scan`, `apex-status`, `apex-cancel-scan`, `apex-findings`, and `apex-workspace-findings`.
17
+
18
+ For serverless, cron, or other explicit HTTP/JSON integrations, use the hosted Apex REST API instead of CLI or local stdio MCP. The hosted MCP and REST contract is documented at https://ai.cantina.xyz/docs/apex-api.
17
19
 
18
20
  For on-prem or other non-default Apex hosts, make sure the CLI or MCP server runs with `APEX_BASE_URL` set to the external HTTPS Bedrock origin before auth or provider connection flows.
19
21
 
@@ -55,11 +57,12 @@ If the Apex MCP server is not configured, fall back to the local CLI:
55
57
  - `apex-trial-status` is MCP-only; do not invoke it as a CLI command. In a CLI-only flow, use the `claimDeadline` returned by `apex redeem <code> --json` without repeating or persisting the secret code.
56
58
  - After a guest scan, tell the user to run `apex claim` on the same machine before that returned claim deadline. If the deadline is unavailable or uncertain, do not guess or start a replacement login; run `apex claim` and let the server validate the proof.
57
59
  - Claim moves the guest workspace, scans, and findings into the currently selected Cantina workspace when the account can run scans there. Personal workspace owners receive the trial in their existing workspace instead of a duplicate. If the selected workspace cannot run scans, tell the user to switch to one that can and retry before the claim deadline.
58
- - Service-key management has no MCP tools. Never ask a user to paste a service key into a prompt, and never place one in an MCP call, tool result, source file, or log.
60
+ - Service-key creation, listing, and revocation have no MCP tools. Never ask a user to paste a service key into a prompt, and never place one in a tool argument, tool result, source file, or log. Hosted MCP clients may read it from a secret-backed environment variable for the HTTP Authorization header.
59
61
  - If a user explicitly needs a new service key, tell them to run `apex login` if needed, then run `apex service-key create --name <name> --scope <scope[,scope]>` directly in their own terminal. Use only the required scopes: `scans:create` to query credit availability or trigger, `scans:read` to poll status, and `findings:read` to retrieve findings. A P1-only adapter can use `--scope scans:read,findings:read`; omitting `--scope` grants all three. The CLI automatically selects the company when only one is available and prompts when there are several; use `--company <id-or-handle>` to skip that prompt or resolve a non-interactive command. Service-key commands never initiate login, and the secret is shown once.
60
- - For a headless HTTP adapter, read the service key from the secret-backed `APEX_SERVICE_KEY` environment variable, send it as a bearer token to `/api/apex/v1`, and redact it from errors and logs. A service key does not authenticate CLI or MCP commands; those use device login. Do not shell out to `apex` or launch MCP from the adapter.
62
+ - For a hosted MCP client, connect to `https://ai.cantina.xyz/mcp` and send `APEX_SERVICE_KEY` as a Bearer header. The service key authenticates hosted MCP, but not the local CLI or stdio MCP; those use device login.
63
+ - For a headless REST adapter, read the service key from the secret-backed `APEX_SERVICE_KEY` environment variable, send it as a bearer token to `/api/apex/v1`, and redact it from errors and logs. Do not shell out to `apex` or launch local MCP from the adapter.
61
64
  - Hosted API integrations can call `GET /api/apex/v1/credits` with `scans:create` scope to inspect the organization's current standard, audit, and Lite balances and effective scan-type availability. Treat the response as a point-in-time snapshot; scan creation remains authoritative.
62
- - Hosted API v1 remote-repository scans require the GitHub repository to be linked to an active Apex workspace and do not create or mutate workspaces; use optional `workspaceId` to disambiguate matches and treat zero or ambiguous matches as HTTP `409` setup errors. Local or non-Git scans use the documented source-upload flow, which can create or reuse a workspace; send `generateThreatModel: true` for the first scan of a newly created local workspace.
65
+ - Hosted remote-repository scans require the GitHub repository to be connected to the service key's Apex organization. They reuse a linked active workspace or create and link one when no match exists; use optional `workspaceId` to disambiguate multiple matches and treat explicit workspace/repository mismatches as HTTP `409` setup errors. Local or non-Git REST scans use the documented source-upload flow; send `generateThreatModel: true` for the first scan of a newly created local workspace.
63
66
  - Hosted scan triggers require `Idempotency-Key`. Reuse one stable key only for an identical transport/timeout/5xx retry. After correcting a definitive 4xx response, or for any new intended scan, use a new key.
64
67
  - Use `--non-interactive` and `--no-open` for automation-friendly CLI calls.
65
68
  - Use `--json` whenever structured output is helpful.
@@ -86,6 +89,7 @@ If the Apex MCP server is not configured, fall back to the local CLI:
86
89
 
87
90
  ## Examples
88
91
 
92
+ - Connect a production MCP client: configure `https://ai.cantina.xyz/mcp` as a Streamable HTTP server and source its Bearer token from `APEX_SERVICE_KEY`, then verify `apex-credits` without printing the credential.
89
93
  - Redeem a supplied trial code: run `apex redeem <code> --json` in a terminal, continue with MCP only after a `redeemed` or `idempotent` outcome, then check `apex-trial-status` and remind the user about `apex claim` after findings only while `claimAvailable` remains true.
90
94
  - Start a scan for the current repository or directory: run `apex-doctor`, bind a workspace if needed, then call `apex-scan`.
91
95
  - Start a Lite scan: call `apex-scan` with `mode: "lite"` after confirming beta access and provider-backed sources.
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Cantina agent plugins for security review workflows.",
9
- "version": "0.1.27"
9
+ "version": "0.1.28"
10
10
  },
11
11
  "plugins": [
12
12
  {
@@ -14,10 +14,10 @@
14
14
  "source": {
15
15
  "source": "npm",
16
16
  "package": "@cantinasecurity/apex-cli",
17
- "version": "0.1.27"
17
+ "version": "0.1.28"
18
18
  },
19
19
  "description": "Run Apex security scans and review findings from Claude Code.",
20
- "version": "0.1.27",
20
+ "version": "0.1.28",
21
21
  "author": {
22
22
  "name": "Cantina",
23
23
  "email": "support@cantina.xyz"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apex-cli",
3
- "version": "0.1.27",
3
+ "version": "0.1.28",
4
4
  "description": "Run Apex security scans and review findings from Claude Code.",
5
5
  "author": {
6
6
  "name": "Cantina",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apex-cli",
3
- "version": "0.1.27",
3
+ "version": "0.1.28",
4
4
  "description": "Run Apex security scans and review findings from Codex.",
5
5
  "author": {
6
6
  "name": "Cantina",
package/.mcp.claude.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "args": [
6
6
  "-y",
7
7
  "-p",
8
- "@cantinasecurity/apex-cli@0.1.27",
8
+ "@cantinasecurity/apex-cli@0.1.28",
9
9
  "apex-mcp"
10
10
  ],
11
11
  "env": {
package/.mcp.codex.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "args": [
5
5
  "-y",
6
6
  "-p",
7
- "@cantinasecurity/apex-cli@0.1.27",
7
+ "@cantinasecurity/apex-cli@0.1.28",
8
8
  "apex-mcp"
9
9
  ],
10
10
  "env": {
package/MARKETPLACE.md CHANGED
@@ -13,7 +13,7 @@ This package is prepared as both a Claude Code plugin and a Codex plugin. The pu
13
13
  The plugin MCP configs launch the pinned npm CLI package with:
14
14
 
15
15
  ```bash
16
- npx -y -p @cantinasecurity/apex-cli@0.1.27 apex-mcp
16
+ npx -y -p @cantinasecurity/apex-cli@0.1.28 apex-mcp
17
17
  ```
18
18
 
19
19
  That keeps marketplace installs independent of a user's global `apex` install.
package/README.md CHANGED
@@ -152,30 +152,30 @@ unclaimed local trial proof so `apex claim` can still use it.
152
152
  Agent-safe copy/paste prompt (substitute the issued code):
153
153
 
154
154
  ```text
155
- Install and run Cantina Apex CLI 0.1.27 to start one free standard security scan of this repository immediately.
155
+ Install and run Cantina Apex CLI 0.1.28 to start one free standard security scan of this repository immediately.
156
156
 
157
157
  Use this trial code only where <TRIAL_CODE> appears below: SPBT-DEVREL-XXXXXXXX
158
158
 
159
159
  Run the commands yourself from the repository root; do not stop after setup or only explain the steps. Use terminal CLI commands only. Do not use an Apex MCP tool or run `apex setup`, `apex mcp`, `apex login`, `apex-auth-start`, or `apex-auth-wait`. Never use `--replace` or `--force`.
160
160
 
161
161
  Use this exact command prefix for every Apex command:
162
- npx -y -p @cantinasecurity/apex-cli@0.1.27 apex
162
+ npx -y -p @cantinasecurity/apex-cli@0.1.28 apex
163
163
 
164
164
  1. Before redeeming, confirm every command will use the same persistent, user-accessible machine or container, HOME, filesystem, and repository root. Confirm Node.js 20+ and npx are available. If `APEX_BASE_URL` is set, continue only when its origin is `https://ai.cantina.xyz`. Run the exact prefix with `--help` and continue only if help lists both `redeem` and `claim`. If any check fails, STOP before sending the code; do not install system packages.
165
165
  2. Redeem, with at most one response-loss recovery retry:
166
- npx -y -p @cantinasecurity/apex-cli@0.1.27 apex redeem <TRIAL_CODE> --json
166
+ npx -y -p @cantinasecurity/apex-cli@0.1.28 apex redeem <TRIAL_CODE> --json
167
167
  This terminal command is the only allowed tool call containing the code. Never echo or restate the code, store it in a file or environment variable, put it in a URL or MCP call, or include it in your response. Parse the JSON from stdout only; do not merge stderr into stdout, because npm may write warnings to stderr. Continue when the command exits 0 and stdout is JSON with `redeemed: true` and `outcome` equal to `redeemed` or `idempotent`. `idempotent` means the existing guest session resumed and it may already own a workspace. If and only if the first attempt ends with an ambiguous transport/connection failure or an interrupted/missing response and no typed server error code, retry this exact same command once on the same machine, HOME, and repository root. Never retry a typed server rejection and never make more than one recovery retry. If the allowed retry does not return a successful JSON outcome, STOP.
168
168
  3. Immediately start exactly one scan; do not wait for another instruction:
169
- npx -y -p @cantinasecurity/apex-cli@0.1.27 apex scan --mode standard --non-interactive --no-open --json
169
+ npx -y -p @cantinasecurity/apex-cli@0.1.28 apex scan --mode standard --non-interactive --no-open --json
170
170
  The CLI validates the complete guest local archive before it reserves a workspace. An unbound renamed checkout may recover only the sole empty guest workspace when no explicit workspace name was supplied. On any error or nonzero exit, STOP. After a successful scan JSON response, inspect `localPersistence.workspaceBindingSaved`. If it is `false`, the server scan already started: capture and report `binding.lastScanId`, then STOP; do not run status or findings until local repository permissions are repaired. Otherwise capture `binding.lastScanId` from the JSON as <SCAN_ID>; if it is absent, STOP.
171
171
  4. About every 60 seconds, poll that exact scan:
172
- npx -y -p @cantinasecurity/apex-cli@0.1.27 apex status --scan <SCAN_ID> --json
172
+ npx -y -p @cantinasecurity/apex-cli@0.1.28 apex status --scan <SCAN_ID> --json
173
173
  Read `progress.progress.status`. Wait while it is `created`, `pending`, `queued`, `starting`, `running`, `in_progress`, or `processing`. Continue on `completed`. STOP on `failed`, `cancelled`, a missing or unknown status, or a command failure.
174
174
  5. Fetch that exact scan's findings:
175
- npx -y -p @cantinasecurity/apex-cli@0.1.27 apex findings --scan <SCAN_ID> --json
175
+ npx -y -p @cantinasecurity/apex-cli@0.1.28 apex findings --scan <SCAN_ID> --json
176
176
  On success, summarize findings by severity, most severe first, including identifier, title, status, and confidence. This command does not return file locations, so do not invent them. On failure, STOP.
177
177
  6. Do not claim automatically. Tell me the claim deadline from step 2 and remind me to run this exact command myself from the same repository root, machine, and HOME:
178
- npx -y -p @cantinasecurity/apex-cli@0.1.27 apex claim
178
+ npx -y -p @cantinasecurity/apex-cli@0.1.28 apex claim
179
179
  It may open a browser so I can create or sign in to a Cantina account and keep the results. Claim moves the trial into the currently selected Cantina workspace when I can run scans there, or into my existing personal workspace. If the selected workspace cannot run scans, tell me to switch to one that can and retry before the claim deadline.
180
180
 
181
181
  Never paste raw command transcripts. For any failure, report only the step, exit code, and sanitized error. Redact the trial code and every `apex_at_`, `apex_rt_`, or `apex_ct_` value from all reports.
@@ -279,9 +279,9 @@ Helpful workspace flags:
279
279
 
280
280
  `apex credits` shows standard, audit, fix review, and Lite scan entitlements when the server returns them.
281
281
 
282
- ## Service Keys And The Hosted API
282
+ ## Service Keys, Hosted MCP, And The REST API
283
283
 
284
- Use the hosted Apex API for HTTP-only, headless integrations such as serverless functions, cron jobs, and internal audit hubs. Use the CLI or stdio MCP server for local and interactive agent workflows. The full HTTP contract is in the [Apex API documentation](https://ai.cantina.xyz/docs/apex-api).
284
+ Use hosted MCP for production agents that need a normal HTTPS endpoint. Use the REST API for explicit HTTP/JSON integrations such as serverless functions, cron jobs, and internal audit hubs. Use the CLI or local stdio MCP server when an agent needs direct access to a repository checkout or local archive. The complete hosted integration contract is in the [Apex API documentation](https://ai.cantina.xyz/docs/apex-api).
285
285
 
286
286
  An organization manager can create a service key with an existing Apex device-login session. Service-key commands never start device login implicitly, so run `apex login` first if needed:
287
287
 
@@ -309,7 +309,40 @@ apex service-key revoke <key-id>
309
309
 
310
310
  Service-key management is intentionally available only through the scripted CLI. It is not exposed as an MCP tool or interactive-shell command, which keeps raw secrets out of model tool results and transcripts. The CLI requires an existing device-login bearer session, never initiates login from these commands, and never stores a created service key locally.
311
311
 
312
- `APEX_SERVICE_KEY` authenticates the hosted REST API only; it does not authenticate CLI commands or replace `apex login`. When `apex doctor` finds a service key but no active device-login session, it reports that split before starting a login flow. `APEX_API_KEY` is also recognized for this diagnostic so older integrations receive migration guidance, but `APEX_SERVICE_KEY` is the documented REST variable.
312
+ `APEX_SERVICE_KEY` authenticates hosted MCP and REST requests; it does not authenticate the local CLI or stdio MCP and does not replace `apex login` there. When `apex doctor` finds a service key but no active local device-login session, it reports that split before starting a login flow. `APEX_API_KEY` is also recognized for this diagnostic so older integrations receive migration guidance, but `APEX_SERVICE_KEY` is the documented hosted-integration variable.
313
+
314
+ ### Hosted HTTPS MCP
315
+
316
+ Point any Streamable HTTP MCP client at `https://ai.cantina.xyz/mcp` and send the service key as `Authorization: Bearer <TOKEN>`. No local `apex-mcp` process, browser, TTY, or device-login session is required.
317
+
318
+ Keep the key in the environment. For Codex:
319
+
320
+ ```bash
321
+ export APEX_SERVICE_KEY='<service-key>'
322
+ codex mcp add apex \
323
+ --url https://ai.cantina.xyz/mcp \
324
+ --bearer-token-env-var APEX_SERVICE_KEY
325
+ ```
326
+
327
+ Claude Code can expand the same environment variable from `.mcp.json`:
328
+
329
+ ```json
330
+ {
331
+ "mcpServers": {
332
+ "apex": {
333
+ "type": "http",
334
+ "url": "https://ai.cantina.xyz/mcp",
335
+ "headers": {
336
+ "Authorization": "Bearer ${APEX_SERVICE_KEY}"
337
+ }
338
+ }
339
+ }
340
+ }
341
+ ```
342
+
343
+ The hosted server exposes `apex-credits`, `apex-workspaces`, `apex-scan`, `apex-status`, `apex-cancel-scan`, `apex-findings`, and `apex-workspace-findings`. It operates only on repositories and workspaces available to the service key's organization. Use local stdio MCP for device auth, local filesystem/archive access, provider connection, setup, comments, feedback, fix reviews, and trial flows.
344
+
345
+ ### Hosted REST API
313
346
 
314
347
  Use the service key as a bearer token with the hosted scan lifecycle:
315
348
 
@@ -337,7 +370,7 @@ curl \
337
370
  https://ai.cantina.xyz/api/apex/v1/scans/$SCAN_ID/findings
338
371
  ```
339
372
 
340
- For a remote GitHub scan, the repository must already be linked to an active Apex workspace. This remote-repository flow never creates, binds, or mutates workspaces. Apex selects the workspace automatically when exactly one active workspace matches the repository; pass the optional `workspaceId` to disambiguate multiple matches. Zero matches, or multiple matches without a valid `workspaceId`, return HTTP `409`.
373
+ For a remote GitHub scan, the repository must be connected to the service key's Apex organization. Apex reuses an active linked workspace when one exists; if none exists, the request creates and links a workspace named after the canonical repository before the scan starts. Pass `workspaceId` to disambiguate multiple matches. An explicit workspace/repository mismatch returns HTTP `409` instead of silently rewriting that workspace.
341
374
 
342
375
  For a local or non-Git checkout, use the service API's source-upload flow instead. It can create or reuse a workspace, uploads a `tar.gz` archive, and starts the scan with a `local_archive` source. A newly created local workspace has no threat model to reuse, so its first scan must send `generateThreatModel: true`. See the [Apex service API guide](https://ai.cantina.xyz/docs/apex-api) for the current request schemas and limits.
343
376
 
@@ -347,11 +380,11 @@ Every trigger request requires an `Idempotency-Key`. Generate one stable key for
347
380
 
348
381
  Example prompt for Claude Code:
349
382
 
350
- > Build an Apex adapter for our serverless audit hub using the hosted HTTP API, not the Apex CLI or MCP server. Assume the GitHub repository is already linked to an active Apex workspace; this API must not create or mutate workspaces. Read `APEX_SERVICE_KEY` from the environment, generate one stable `Idempotency-Key` per intended scan, and reuse it with the identical request body only after a transport error, timeout, or `5xx`; after correcting a definitive `4xx`, use a new key. POST the repository URL and exact commit to `/api/apex/v1/scans`, include `workspaceId` when needed to disambiguate matches, and handle a `409` workspace-resolution response. Treat optional `paths` as non-binding focus hints, not a security boundary. Poll `/api/apex/v1/scans/{scanId}` until terminal, then fetch `/api/apex/v1/scans/{scanId}/findings`. Preserve the raw GitLab SAST payload, including drafts, and deduplicate findings by stable ID. Never print or log the service key.
383
+ > Build an Apex adapter for our serverless audit hub using the hosted REST API, not the Apex CLI or local stdio MCP server. Read `APEX_SERVICE_KEY` from the environment, generate one stable `Idempotency-Key` per intended scan, and reuse it with the identical request body only after a transport error, timeout, or `5xx`; after correcting a definitive `4xx`, use a new key. POST the connected GitHub repository URL and exact commit to `/api/apex/v1/scans`, include `workspaceId` when needed to disambiguate matches, and handle a `409` workspace-resolution response. Treat optional `paths` as non-binding focus hints, not a security boundary. Poll `/api/apex/v1/scans/{scanId}` until terminal, then fetch `/api/apex/v1/scans/{scanId}/findings`. Preserve the raw GitLab SAST payload, including drafts, and deduplicate findings by stable ID. Never print or log the service key.
351
384
 
352
385
  Example prompt for Codex:
353
386
 
354
- > Add Apex to this headless auditor integration using the hosted REST API. Use bearer auth from `APEX_SERVICE_KEY`; do not shell out to `apex` or start MCP. The GitHub repository must already belong to an active Apex workspace, and the adapter must not create or mutate workspaces. Implement scan trigger, `409` workspace-resolution handling, status polling with bounded backoff, terminal failure handling, and findings retrieval. Send `repoUrl`, `commit`, optional `paths`, and optional `workspaceId`; treat `paths` as non-binding focus hints rather than a hard security boundary. Generate a stable `Idempotency-Key` for each intended scan. Preserve it only for an identical transport/timeout/`5xx` retry; after correcting a definitive `4xx`, submit with a new key. Keep the returned `scanId`, and store the unmodified findings payload, including drafts, alongside normalized findings. Add tests with mocked HTTP responses and ensure credentials are redacted from errors and logs.
387
+ > Add Apex to this headless auditor integration using the hosted REST API. Use bearer auth from `APEX_SERVICE_KEY`; do not shell out to `apex` or start a local stdio MCP process. Implement scan trigger, `409` workspace-resolution handling, status polling with bounded backoff, terminal failure handling, and findings retrieval. Send the connected GitHub `repoUrl`, exact `commit`, optional `paths`, and optional `workspaceId`; treat `paths` as non-binding focus hints rather than a hard security boundary. Generate a stable `Idempotency-Key` for each intended scan. Preserve it only for an identical transport/timeout/`5xx` retry; after correcting a definitive `4xx`, submit with a new key. Keep the returned `scanId`, and store the unmodified findings payload, including drafts, alongside normalized findings. Add tests with mocked HTTP responses and ensure credentials are redacted from errors and logs.
355
388
 
356
389
  For a P1-only integration where scans are started in the Apex UI:
357
390
 
@@ -416,7 +449,12 @@ PR scans require exactly one provider-backed GitHub repository. If the current d
416
449
 
417
450
  ## LLM / MCP Usage
418
451
 
419
- The CLI now ships an MCP server so LLM clients can drive Apex directly over stdio.
452
+ Apex has two MCP transports:
453
+
454
+ - Hosted Streamable HTTP at `https://ai.cantina.xyz/mcp`, authenticated with an organization service key, for production agents that do not need the caller's filesystem.
455
+ - The `apex-mcp` stdio server shipped by this package, authenticated with device login, for repository-local and interactive agent workflows.
456
+
457
+ See [Hosted HTTPS MCP](#hosted-https-mcp) for the production URL and Bearer-token configuration. The rest of this section configures the local stdio server.
420
458
 
421
459
  If Apex is installed globally, prefer:
422
460
 
@@ -511,7 +549,7 @@ If you need to launch through `pnpm`, use `--silent`:
511
549
 
512
550
  Do not point an MCP client at plain `pnpm mcp`. `pnpm` writes its script banner to `stdout` before the protocol stream, which can break the `initialize` handshake.
513
551
 
514
- The MCP server exposes Apex-specific tools for:
552
+ The local stdio MCP server exposes Apex-specific tools for:
515
553
 
516
554
  - auth status and device login
517
555
  - local guest-session deadlines through `apex-trial-status` (never the code or claim token)
@@ -524,7 +562,7 @@ The MCP server exposes Apex-specific tools for:
524
562
  - finding comments and valid/invalid feedback with `apex-finding-comment` and `apex-finding-feedback`
525
563
  - Fix PR and current-repository fix review scans with `apex-finding-fix-review`, optionally after `apex-finding-feedback`
526
564
 
527
- The MCP server does not expose trial redemption, trial claim, or service-key creation, listing, or revocation. When a user supplies a Cantina trial code, run `apex redeem <code>` in a terminal instead of starting device login or putting the code in an MCP call. For HTTP-only serverless and cron integrations, use the [hosted Apex API](https://ai.cantina.xyz/docs/apex-api) directly instead of launching the stdio MCP server.
565
+ Neither MCP surface exposes trial redemption, trial claim, or service-key creation, listing, or revocation as tools. When a user supplies a Cantina trial code, run `apex redeem <code>` in a terminal instead of starting device login or putting the code in an MCP call. Production MCP clients should connect to `https://ai.cantina.xyz/mcp`; HTTP applications can use the [hosted Apex REST API](https://ai.cantina.xyz/docs/apex-api) directly. Do not launch the local stdio server as an HTTP adapter.
528
566
 
529
567
  For repository-scoped operations, pass `cwd` explicitly so the server can resolve the right `.apex/workspace.json` binding and repository roots.
530
568
 
@@ -586,7 +624,7 @@ Telemetry event posts do not include bearer tokens. The telemetry endpoint is `P
586
624
  {
587
625
  "schemaVersion": 1,
588
626
  "event": "apex.invocation.completed",
589
- "cliVersion": "0.1.27",
627
+ "cliVersion": "0.1.28",
590
628
  "invocation": {
591
629
  "surface": "mcp",
592
630
  "command": "apex-scan",
@@ -617,7 +655,7 @@ The npm package also includes marketplace-ready plugin artifacts:
617
655
  - `.claude-plugin/plugin.json` and `.mcp.claude.json` for Claude Code plugin installs
618
656
  - `.claude-plugin/marketplace.json` for a Claude marketplace entry backed by the public npm package
619
657
 
620
- These plugin installs launch the pinned npm package with `npx -y -p @cantinasecurity/apex-cli@0.1.27 apex-mcp`, so users do not need to install `apex` globally before enabling the plugin.
658
+ These plugin installs launch the pinned npm package with `npx -y -p @cantinasecurity/apex-cli@0.1.28 apex-mcp`, so users do not need to install `apex` globally before enabling the plugin.
621
659
 
622
660
  The repository also includes `.agents/plugins/marketplace.json` for local Codex marketplace testing from a checkout.
623
661
 
package/dist/help.js CHANGED
@@ -90,7 +90,7 @@ Tips:
90
90
  After a guest scan, run apex claim on the same machine within the displayed claim deadline to keep the results.
91
91
  Claim moves trial results into the selected Cantina workspace when you can run scans there, or into your existing personal workspace.
92
92
  Service-key commands require an existing login; run apex login first when needed.
93
- APEX_SERVICE_KEY authenticates the hosted REST API only; it does not replace apex login for CLI commands.
93
+ APEX_SERVICE_KEY authenticates https://ai.cantina.xyz/mcp and hosted REST; it does not replace apex login for local CLI or stdio MCP commands.
94
94
  Apex automatically selects your company when only one is available. With multiple companies, choose one interactively or pass --company.
95
95
  Service-key creation also requires --name and reveals the secret only once; omit --scope to grant all hosted API scopes.
96
96
  Service-key management is available only in the scripted CLI, not the interactive shell or MCP server.
package/dist/mcp.js CHANGED
@@ -28,8 +28,8 @@ Notes:
28
28
  - Pass cwd explicitly for repository-specific operations.
29
29
  - Tool calls are always non-interactive and never auto-open a browser.
30
30
  - Finding write tools use the same Apex device-login credentials as read tools. Never ask for browser cookies or CANTINA_AUTH_TOKEN. An error requiring CANTINA_AUTH_TOKEN proves the MCP server is outdated; update Apex CLI, re-run apex setup for this client, restart it, and retry.
31
- - Organization service-key creation, listing, and revocation are intentionally scripted-CLI-only and are not exposed as MCP tools. Never ask a user to paste a service key into an MCP prompt or tool call.
32
- - HTTP-only serverless and cron integrations should use the hosted API documented at https://ai.cantina.xyz/docs/apex-api instead of launching this stdio server.
31
+ - Organization service-key creation, listing, and revocation are intentionally scripted-CLI-only and are not exposed as MCP tools. Never ask a user to paste a service key into a prompt or tool argument. A hosted MCP client supplies it only as the HTTP Authorization header.
32
+ - Production agents that do not need local filesystem access can connect to https://ai.cantina.xyz/mcp over Streamable HTTP with Authorization: Bearer <service-key>. Serverless and cron applications can instead use the REST API documented at https://ai.cantina.xyz/docs/apex-api. This local stdio server continues to use device login.
33
33
  - Use mode "audit" for audit scans; "ultra" remains accepted as a legacy alias. Use mode "lite" only for beta-enabled provider-backed Lite scans, and mode "pr" for GitHub pull request scans.
34
34
  - Starting a PR scan may run alongside active workspace scans and does not require force. Starting any non-PR scan still treats every active scan, including a PR scan, as a blocker; use force only when the user explicitly wants that overlap.
35
35
  - Doctor is read-only for guest sessions and reports the local snapshot plan without reserving a workspace.
@@ -14,9 +14,9 @@ export function getServiceKeyCliAuthGuidance(env = process.env) {
14
14
  return null;
15
15
  }
16
16
  const legacyVariableGuidance = variableName === "APEX_API_KEY"
17
- ? " For REST API examples, rename APEX_API_KEY to APEX_SERVICE_KEY."
17
+ ? " For hosted MCP and REST examples, rename APEX_API_KEY to APEX_SERVICE_KEY."
18
18
  : "";
19
- return (`Apex service key detected in ${variableName}, but service keys authenticate the hosted REST API, not the Apex CLI. ` +
20
- "Use `apex login` for CLI device authentication, or use the REST API for a headless/service-account integration: https://ai.cantina.xyz/docs/apex-api." +
19
+ return (`Apex service key detected in ${variableName}, but service keys authenticate the hosted MCP and REST endpoints, not the local Apex CLI. ` +
20
+ "Use `apex login` for local CLI device authentication, or use https://ai.cantina.xyz/mcp or the REST API for a headless/service-account integration: https://ai.cantina.xyz/docs/apex-api." +
21
21
  legacyVariableGuidance);
22
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cantinasecurity/apex-cli",
3
- "version": "0.1.27",
3
+ "version": "0.1.28",
4
4
  "description": "Standalone CLI and MCP server for Apex.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -7,9 +7,11 @@ description: Use when a user wants to start Apex scans, inspect findings, bind w
7
7
 
8
8
  This skill is bundled with Apex CLI and can be installed into Codex with `apex setup codex` or GitHub Copilot CLI with `apex setup copilot`.
9
9
 
10
- Prefer the Apex MCP tools over running `apex` in the shell when the server is available.
10
+ Prefer the Apex MCP tools over running `apex` in the shell when the server is available. The tools installed by `apex setup` use the local stdio server and device login.
11
11
 
12
- For serverless, cron, or other HTTP-only integrations, use the hosted Apex REST API instead of CLI or stdio MCP. Its scan trigger, status, and findings contract is documented at https://ai.cantina.xyz/docs/apex-api.
12
+ For a production MCP client that does not need local filesystem access, use the hosted Streamable HTTP endpoint at `https://ai.cantina.xyz/mcp`. Read the organization service key from `APEX_SERVICE_KEY` and supply it only as `Authorization: Bearer <TOKEN>`; never put the raw key in a tool argument, result, prompt, source file, or log. The hosted tools are `apex-credits`, `apex-workspaces`, `apex-scan`, `apex-status`, `apex-cancel-scan`, `apex-findings`, and `apex-workspace-findings`.
13
+
14
+ For serverless, cron, or other explicit HTTP/JSON integrations, use the hosted Apex REST API instead of CLI or local stdio MCP. The hosted MCP and REST contract is documented at https://ai.cantina.xyz/docs/apex-api.
13
15
 
14
16
  `apex setup codex` configures the MCP server with client attribution so Apex can distinguish Codex MCP usage from direct CLI usage. Users can inspect or disable anonymous local usage telemetry with `apex telemetry status` and `apex telemetry disable`.
15
17
 
@@ -60,11 +62,12 @@ Guidelines:
60
62
  - Do not rely on interactive CLI prompts. The MCP tools are intentionally non-interactive.
61
63
  - The MCP-only `apex-trial-status` tool may report local guest and claim deadlines, but it must never return a trial code or claim token. `claimAvailable` becomes false at a known passed deadline; missing or invalid local deadline metadata remains conservative and server-authoritative. There is intentionally no MCP redemption or claim tool.
62
64
  - When MCP remains available after a guest scan, remind the user to run `apex claim` on the same machine while `claimAvailable` is true; after a known passed deadline, continue with normal account login.
63
- - Service-key management has no MCP tools. Never ask a user to paste a service key into a prompt, and never place one in an MCP call, tool result, source file, or log.
65
+ - Service-key creation, listing, and revocation have no MCP tools. Never ask a user to paste a service key into a prompt, and never place one in a tool argument, tool result, source file, or log. Hosted MCP clients may read it from a secret-backed environment variable for the HTTP Authorization header.
64
66
  - If a user explicitly needs a new service key, tell them to run `apex login` if needed, then run `apex service-key create --name <name> --scope <scope[,scope]>` directly in their own terminal. Use only the required scopes: `scans:create` to query credit availability or trigger, `scans:read` to poll status, and `findings:read` to retrieve findings. A P1-only adapter can use `--scope scans:read,findings:read`; omitting `--scope` grants all three. The CLI automatically selects the company when only one is available and prompts when there are several; use `--company <id-or-handle>` to skip that prompt or resolve a non-interactive command. Service-key commands never initiate login, and the secret is shown once.
65
- - For a headless HTTP adapter, read the service key from the secret-backed `APEX_SERVICE_KEY` environment variable, send it as a bearer token to `/api/apex/v1`, and redact it from errors and logs. A service key does not authenticate CLI or MCP commands; those use device login. Do not shell out to `apex` or launch MCP from the adapter.
67
+ - For a hosted MCP client, connect to `https://ai.cantina.xyz/mcp` and send `APEX_SERVICE_KEY` as a Bearer header. The service key authenticates hosted MCP, but not the local CLI or stdio MCP; those use device login.
68
+ - For a headless REST adapter, read the service key from the secret-backed `APEX_SERVICE_KEY` environment variable, send it as a bearer token to `/api/apex/v1`, and redact it from errors and logs. Do not shell out to `apex` or launch local MCP from the adapter.
66
69
  - Hosted API integrations can call `GET /api/apex/v1/credits` with `scans:create` scope to inspect the organization's current standard, audit, and Lite balances and effective scan-type availability. Treat the response as a point-in-time snapshot; scan creation remains authoritative.
67
- - Hosted API v1 remote-repository scans require the GitHub repository to be linked to an active Apex workspace and do not create or mutate workspaces; use optional `workspaceId` to disambiguate matches and treat zero or ambiguous matches as HTTP `409` setup errors. Local or non-Git scans use the documented source-upload flow, which can create or reuse a workspace; send `generateThreatModel: true` for the first scan of a newly created local workspace.
70
+ - Hosted remote-repository scans require the GitHub repository to be connected to the service key's Apex organization. They reuse a linked active workspace or create and link one when no match exists; use optional `workspaceId` to disambiguate multiple matches and treat explicit workspace/repository mismatches as HTTP `409` setup errors. Local or non-Git REST scans use the documented source-upload flow; send `generateThreatModel: true` for the first scan of a newly created local workspace.
68
71
  - Hosted scan triggers require `Idempotency-Key`. Reuse one stable key only for an identical transport/timeout/5xx retry. After correcting a definitive 4xx response, or for any new intended scan, use a new key.
69
72
  - `apex-credits` reports standard credits plus audit, fix review, and Lite scan entitlements when Bedrock returns those balances.
70
73
  - `apex-scan` scans the provided `cwd` by default; pass `repoPaths` only when the user asks to scan explicit alternate roots.
@@ -92,3 +95,7 @@ in a terminal, use MCP for scan/status/findings after redemption, then check the
92
95
  MCP-only `apex-trial-status` tool and remind the user to run `apex claim`
93
96
  locally while `claimAvailable` remains true. In a CLI-only flow, use the
94
97
  redeem response's `claimDeadline` instead.
98
+
99
+ Example hosted MCP flow: configure `https://ai.cantina.xyz/mcp` as a
100
+ Streamable HTTP server, source its Bearer token from `APEX_SERVICE_KEY`, and
101
+ verify `apex-credits` without printing the credential.