Skip to content

mcp: skip auto-route when role lacks USAGE on the data product's cluster#36731

Open
bobbyiliev wants to merge 4 commits into
MaterializeInc:mainfrom
bobbyiliev:mcp-read-data-product-skip-auto-route-without-usage
Open

mcp: skip auto-route when role lacks USAGE on the data product's cluster#36731
bobbyiliev wants to merge 4 commits into
MaterializeInc:mainfrom
bobbyiliev:mcp-read-data-product-skip-auto-route-without-usage

Conversation

@bobbyiliev
Copy link
Copy Markdown
Contributor

@bobbyiliev bobbyiliev commented May 26, 2026

Follow-up to #36619 (comment)

@bobbyiliev bobbyiliev requested a review from a team as a code owner May 26, 2026 12:04
@bobbyiliev bobbyiliev marked this pull request as draft May 26, 2026 12:04
@bobbyiliev bobbyiliev marked this pull request as ready for review May 26, 2026 15:10
@bobbyiliev bobbyiliev requested review from def- and ggevay May 26, 2026 15:11
Comment thread src/environmentd/src/http/mcp.rs Outdated
// cluster only when the role has `USAGE` on it; without `USAGE` the
// `SET CLUSTER` would succeed but the subsequent `SELECT` would fail
// with a `permission denied`, so we leave the read on the session
// default — slower (no index) but correct.
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.

so we leave the read on the session
// default — slower (no index) but correct

I'm a bit worried that this implicit fallback would lead to silent RBAC problems, where the symptom is just slow queries, but people (and agents) wouldn't realize that there is an RBAC problem. So, maybe we'd want to fail the call in this case? And then if an agent really wants to execute on a cluster that has no index, then it could still do it with an explicit override.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call @ggevay, done. It now fails with a clear ClusterPrivilegeMissing error naming the cluster, and the agent can pass an explicit cluster override to read elsewhere if it really wants to.

Copy link
Copy Markdown
Contributor

@def- def- left a comment

Choose a reason for hiding this comment

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

Thanks Bobby, test change looks reasonable

@bobbyiliev bobbyiliev requested review from ggevay and jubrad May 27, 2026 13:17
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