Skip to content

[MCP] Accept can_read in a file-defined access grant - #2030

Merged
wwidergoldpimcore merged 1 commit into
feature/mcp-1309-server-config-managementfrom
fix/mcp-1309-config-can-read
Sep 8, 2026
Merged

[MCP] Accept can_read in a file-defined access grant#2030
wwidergoldpimcore merged 1 commit into
feature/mcp-1309-server-config-managementfrom
fix/mcp-1309-config-can-read

Conversation

@fashxp

@fashxp fashxp commented Sep 3, 2026

Copy link
Copy Markdown
Member

A file-defined MCP server cannot express can_read, so defining one in YAML fails:

Unrecognized option "can_read" under
"pimcore_studio_backend.studio_mcp_servers.foo3.access.shared_users.0".
Available options are "can_access", "can_edit", "name".

0bf234f7 introduced the capability across the DTOs, hydrator, schema and access resolver, but not in the
configuration tree. McpServerAccessEntry::fromMixed() reads can_read and toArray() emits it, so the
settings-store form round-trips a grant the YAML equivalent then rejects. The two config locations disagree
about the same grant shape.

What this changes

Adds can_read to mcpAccessGrantListNode(), defaulting to true rather than false like the other two.
That matches McpServerAccessEntry::fromMixed(), where the flag defaults to true and a bare string name is a
read-only grant: naming someone without saying more lets them see the server. Defaulting it to false would
silently strip visibility from every existing file-defined grant.

The stale docblock describing the grid as {name, can_access, can_edit} is corrected too.

Verified

Unit suite green (889 tests), PHPStan clean. The existing testSharedUsersAndRolesAcceptTheCapabilityGrid
encoded the old two-capability shape and is updated to the three-capability one, including the defaulting
behaviour for a grant that names someone and nothing else.

Checked against a running instance: a YAML-defined server with can_read on its grants now validates, and
debug:config shows all three capabilities normalised per grant.

🤖 Generated with Claude Code

Copilot AI balanced review requested due to automatic review settings September 3, 2026 21:59
@fashxp fashxp added this to the 2026.3.0 milestone Sep 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The change appears correct, but authorization-sensitive defaults warrant final maintainer review.

Pull request overview

Fixes YAML-defined MCP access grants so they support can_read, matching stored grants.

Changes:

  • Adds can_read with a backward-compatible true default.
  • Updates configuration tests and documentation.
  • Covers both user and role grants through the shared configuration node.

The fix addresses the root cause at the configuration boundary, preserves existing behavior, and adds focused regression coverage.

File summaries
File Description
src/DependencyInjection/Configuration.php Adds and documents can_read.
tests/Unit/DependencyInjection/McpServersConfigurationTest.php Verifies explicit and default read grants.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

The capability was added to the DTOs, hydrator and resolver but not to the config
tree, so a YAML-defined server rejected the key its own settings-store form emits.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ej6YARj6HakERFuERFuDF9
@wwidergoldpimcore
wwidergoldpimcore force-pushed the fix/mcp-1309-config-can-read branch from 8187101 to 09c18a4 Compare September 8, 2026 12:11
@sonarqubecloud

sonarqubecloud Bot commented Sep 8, 2026

Copy link
Copy Markdown

@wwidergoldpimcore
wwidergoldpimcore merged commit 2966641 into feature/mcp-1309-server-config-management Sep 8, 2026
20 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 8, 2026
@wwidergoldpimcore
wwidergoldpimcore deleted the fix/mcp-1309-config-can-read branch September 8, 2026 13:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants