Skip to content

Make MCP resource listing dynamic for authentication purposes#1072

Merged
jviotti merged 3 commits into
mainfrom
dynamic-mcp-resources-list
Jun 19, 2026
Merged

Make MCP resource listing dynamic for authentication purposes#1072
jviotti merged 3 commits into
mainfrom
dynamic-mcp-resources-list

Conversation

@jviotti

@jviotti jviotti commented Jun 18, 2026

Copy link
Copy Markdown
Member

Signed-off-by: Juan Cruz Viotti jv@jviotti.com

Review in cubic

@github-actions github-actions Bot 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.

Benchmark Index (community)

Details
Benchmark suite Current: bb9ef6d Previous: 8ad8503 Ratio
Add one schema (0 existing) 383 ms 385 ms 0.99
Add one schema (100 existing) 28 ms 32 ms 0.88
Add one schema (1000 existing) 81 ms 89 ms 0.91
Add one schema (10000 existing) 643 ms 721 ms 0.89
Update one schema (1 existing) 23 ms 24 ms 0.96
Update one schema (101 existing) 29 ms 32 ms 0.91
Update one schema (1001 existing) 86 ms 91 ms 0.95
Update one schema (10001 existing) 668 ms 731 ms 0.91
Cached rebuild (1 existing) 6 ms 7 ms 0.86
Cached rebuild (101 existing) 8 ms 10 ms 0.80
Cached rebuild (1001 existing) 29 ms 33 ms 0.88
Cached rebuild (10001 existing) 247 ms 279 ms 0.89
Index 100 schemas 588 ms 630 ms 0.93
Index 1000 schemas 1536 ms 1490 ms 1.03
Index 10000 schemas 13721 ms 13554 ms 1.01
Index 10000 schemas (custom meta-schema) 16245 ms 16027 ms 1.01
Index 10000 schemas ($ref fan-out) 16561 ms 16282 ms 1.02

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions github-actions Bot 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.

Benchmark Index (enterprise)

Details
Benchmark suite Current: bb9ef6d Previous: 8ad8503 Ratio
Add one schema (0 existing) 378 ms 377 ms 1.00
Add one schema (100 existing) 33 ms 32 ms 1.03
Add one schema (1000 existing) 89 ms 87 ms 1.02
Add one schema (10000 existing) 720 ms 750 ms 0.96
Update one schema (1 existing) 25 ms 26 ms 0.96
Update one schema (101 existing) 33 ms 33 ms 1
Update one schema (1001 existing) 91 ms 88 ms 1.03
Update one schema (10001 existing) 740 ms 733 ms 1.01
Cached rebuild (1 existing) 8 ms 8 ms 1
Cached rebuild (101 existing) 11 ms 10 ms 1.10
Cached rebuild (1001 existing) 34 ms 32 ms 1.06
Cached rebuild (10001 existing) 288 ms 253 ms 1.14
Index 100 schemas 721 ms 684 ms 1.05
Index 1000 schemas 1504 ms 1665 ms 0.90
Index 10000 schemas 13976 ms 14244 ms 0.98
Index 10000 schemas (custom meta-schema) 16660 ms 17195 ms 0.97
Index 10000 schemas ($ref fan-out) 16489 ms 17536 ms 0.94

This comment was automatically generated by workflow using github-action-benchmark.

@jviotti jviotti force-pushed the dynamic-mcp-resources-list branch 2 times, most recently from a08ac04 to b49993b Compare June 19, 2026 13:22
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
@jviotti jviotti force-pushed the dynamic-mcp-resources-list branch from b49993b to 82e0e10 Compare June 19, 2026 13:29
@jviotti jviotti marked this pull request as ready for review June 19, 2026 13:29

@cubic-dev-ai cubic-dev-ai Bot 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.

2 issues found across 6 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread enterprise/server/action_mcp_v1.cc Outdated
Comment thread enterprise/server/action_mcp_v1.cc Outdated
@augmentcode

augmentcode Bot commented Jun 19, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: Makes MCP resources/list dynamic and credential-aware (enterprise), so the resource catalog is filtered at request time for authentication.

Changes:

  • Remove precomputed MCP resource pages from index-generation metadata (generate_mcp_resources and the mcp explorer artifact).
  • Implement ActionMCP_v1::on_resources_list to build pages on demand by iterating the search index (SearchView) and filtering with Authentication::admits.
  • Add fixed-size paging (50 items) with validation of the cursor and computation of nextCursor based on the admitted resource set.
  • Add an end-to-end Hurl test that asserts anonymous vs authenticated callers see the expected resource sets (and ordering) across pages.

Technical Notes: The listing now derives from explorer/%/search.metapack, aligning ordering/metadata with the search surface while preventing protected schemas from being enumerable by unauthorized callers.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot 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.

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

const auto &authentication{this->dispatcher().authentication()};
auto resources{sourcemeta::core::JSON::make_array()};
std::size_t admitted{0};
this->search_view_.for_each(

@augmentcode augmentcode Bot Jun 19, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

enterprise/server/action_mcp_v1.cc:68: cursor values that are not a multiple of MCP_RESOURCES_PAGE_SIZE are only rejected after walking the full search_view_, so malformed cursors can still trigger a full scan. Consider validating the modulo constraint before the for_each to fail fast.

Severity: low

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>

@cubic-dev-ai cubic-dev-ai Bot 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.

1 issue found across 2 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread enterprise/e2e/auth/hurl/mcp-resources.all.hurl
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
@jviotti jviotti merged commit df873c2 into main Jun 19, 2026
5 checks passed
@jviotti jviotti deleted the dynamic-mcp-resources-list branch June 19, 2026 14:18
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.

1 participant