fix(mcp): get_page honors per-call source_id parameter#1394
Open
Valentin32 wants to merge 1 commit into
Open
Conversation
Prior to this commit, get_page ignored the per-call source_id
parameter entirely — only OperationContext.sourceId was respected.
MCP clients with a default-source bearer (e.g. hermes-write with
source_id=default) could not get_page pages in non-default sources,
even when federated_read access was granted. Symptom: page_not_found
errors despite the page existing in the DB and being visible via
the query-tool.
The query-tool already supported per-call source_id via the
--source-id flag (v0.34). This brings get_page into symmetry.
Change:
- Add `source_id` to params schema (optional, string)
- effectiveSourceId = p.source_id ?? ctx.sourceId
- Threads through both the initial getPage lookup and the
fuzzy-resolved follow-up.
Regression test: test/get-page-source-id-param.test.ts (5 cases).
Repro (pre-PR):
# Bearer's ctx.sourceId = default; page lives in priv-karriere-entities
curl -X POST /mcp -H "Authorization: Bearer <default>" \
-d '{"method":"tools/call","params":{"name":"get_page",
"arguments":{"slug":"X","source_id":"priv-karriere-entities"}}}'
# Pre-PR: {"error":"page_not_found"}
# Post-PR: returns the page
Backwards compatible: when source_id is unset, behavior matches
v0.31.8 (D20).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prior to this commit, get_page ignored the per-call source_id parameter entirely — only OperationContext.sourceId was respected. MCP clients with a default-source bearer (e.g. hermes-write with source_id=default) could not get_page pages in non-default sources, even when federated_read access was granted. Symptom: page_not_found errors despite the page existing in the DB and being visible via the query-tool.
The query-tool already supported per-call source_id via the --source-id flag (v0.34). This brings get_page into symmetry.
Change:
source_idto params schema (optional, string)Regression test: test/get-page-source-id-param.test.ts (5 cases).
Repro (pre-PR):
Bearer's ctx.sourceId = default; page lives in priv-karriere-entities
curl -X POST /mcp -H "Authorization: Bearer "
-d '{"method":"tools/call","params":{"name":"get_page", "arguments":{"slug":"X","source_id":"priv-karriere-entities"}}}' # Pre-PR: {"error":"page_not_found"} # Post-PR: returns the page
Backwards compatible: when source_id is unset, behavior matches v0.31.8 (D20).