Skip to content

feat: accept an optional projectKey argument on project-scoped MCP tools - #589

Merged
jonathannorris merged 1 commit into
mainfrom
feat/stateless-project-key
Sep 24, 2026
Merged

jonathannorris merged 1 commit into
mainfrom
feat/stateless-project-key

Conversation

@jonathannorris

Copy link
Copy Markdown
Member

Summary

  • Adds an optional projectKey argument to all 18 project-scoped MCP tools, so a tool call can target a project without a prior select_project call.
  • Project resolution is now the projectKey argument first, then the session's selected project. select_project behaviour is unchanged when the argument is omitted.
  • Needed for MCP hosts that start a new session per request. The remote worker keys its McpAgent Durable Object state by MCP session id, so a select_project from an earlier request is not visible to the next one.

@jonathannorris
jonathannorris requested review from kaushalkapasi and a balanced review from Copilot September 24, 2026 15:38
@jonathannorris
jonathannorris marked this pull request as ready for review September 24, 2026 15:38
@jonathannorris
jonathannorris requested a review from a team as a code owner September 24, 2026 15:38
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
devcycle-mcp-server 79d18e4 Sep 24 2026, 03:42 PM

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Local MCP initialization still rejects missing project configuration before callers can provide the new per-call argument.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds per-call project targeting to project-scoped MCP tools, supporting stateless MCP hosts.

Changes:

  • Adds optional projectKey schemas and precedence over session state.
  • Removes projectKey before forwarding API payloads and queries.
  • Adds shared errors, documentation, and resolution tests.
File Description
src/​mcp/​utils/​api.ts Resolves project overrides and strips route-only arguments.
src/​mcp/​utils/​api.test.ts Tests project resolution and argument omission.
src/​mcp/​types.ts Adds shared projectKey schemas to scoped tools.
src/​mcp/​tools/​variableTools.ts Supports overrides in variable tools.
src/​mcp/​tools/​selfTargetingTools.ts Supports overrides in self-targeting tools.
src/​mcp/​tools/​resultsTools.ts Supports overrides in evaluation tools.
src/​mcp/​tools/​projectTools.ts Adds override support to project retrieval.
src/​mcp/​tools/​localProjectTools.ts Documents session-scoped selection behavior.
src/​mcp/​tools/​featureTools.ts Supports overrides in feature tools.
mcp-worker/​src/​projectSelectionTools.ts Documents stateless worker usage.
mcp-worker/​src/​apiClient.ts Resolves worker project overrides before session state.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/mcp/utils/api.ts
@jonathannorris
jonathannorris merged commit 0016da5 into main Sep 24, 2026
8 checks passed
@jonathannorris
jonathannorris deleted the feat/stateless-project-key branch September 24, 2026 16:38
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