Skip to content

bug: mcp --project-ref is parsed but never used to find the project #5139

Open

Description

@pvorona

trigger.dev mcp --project-ref <ref> started in a directory without a trigger.config.ts (for example a monorepo root whose config is in apps/<app>/) still answers "No project ref found. Please provide a projectRef." from tools such as list_runs. The tools' projectRef description says the ref is detected when you pass the --project-ref option to the MCP server.

Cause: toMcpContextOptions (packages/cli-v3/src/mcp/contextOptions.ts) forwards projectRef into the context options, but McpContext.getProjectRef (packages/cli-v3/src/mcp/context.ts) checks only the tool call's projectRef and then a trigger.config.ts loaded from the call's configPath or the client's first root. It never reads this.options.projectRef. getProjectRef is unchanged from 4.5.11, and both files are the same in 4.8.6 as on main (context.ts last changed in c8ee9e3).

To reproduce (seen with 4.5.11, Node 24, macOS, with a stdio MCP client that supports roots and reports an empty directory as its root):

  1. In an empty directory, start npx trigger.dev@4.5.11 mcp --project-ref <your project ref>.
  2. Call list_runs with environment: "dev" and no projectRef.
  3. Expected: a run list (possibly empty). Actual: "No project ref found. Please provide a projectRef."

Passing projectRef in the call works.

Suggested fix: in getProjectRef, use this.options.projectRef when the call passes none.

Activity

  1. Raph1710 commented on Nov 19, 2026

    @Raph1710

    I've opened a fix for this in #5141.

    Summary

    The PR updates McpContext.getProjectRef() in packages/cli-v3/src/mcp/context.ts to check this.options.projectRef (passed via the --project-ref flag) before falling back to local trigger.config.ts discovery.

    Added unit tests in context.test.ts to enforce the precedence (per-call argument > server option > local config file) and verified end-to-end from an empty directory.

  2. self-assigned this
    on Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions