-
Notifications
You must be signed in to change notification settings - Fork 87
LCORE-1414 Fix MCP authorization loss during model_dump() serialization #1275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tisnik
merged 5 commits into
lightspeed-core:main
from
max-svistunov:lcore-1414-fix-mcp-authorization-serialization
Mar 5, 2026
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a522084
Fix MCP authorization loss during model_dump() serialization
max-svistunov 8b2759b
Guard model_dump() auth re-injection against tool list shape mismatch
max-svistunov 45e49d5
Add e2e test for file-based MCP authorization
max-svistunov febd252
Add body assertion and library-mode config for MCP file auth e2e
max-svistunov 41a7a58
Skip MCP file auth e2e in library mode, use directive query
max-svistunov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
26 changes: 26 additions & 0 deletions
26
tests/e2e/configuration/server-mode/lightspeed-stack-mcp-file-auth.yaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| name: Lightspeed Core Service (LCS) | ||
| service: | ||
| host: 0.0.0.0 | ||
| port: 8080 | ||
| auth_enabled: false | ||
| workers: 1 | ||
| color_log: true | ||
| access_log: true | ||
| llama_stack: | ||
| # Server mode - connects to separate llama-stack service | ||
| use_as_library_client: false | ||
| url: http://llama-stack:8321 | ||
| api_key: xyzzy | ||
| user_data_collection: | ||
| feedback_enabled: true | ||
| feedback_storage: "/tmp/data/feedback" | ||
| transcripts_enabled: true | ||
| transcripts_storage: "/tmp/data/transcripts" | ||
| authentication: | ||
| module: "noop" | ||
| mcp_servers: | ||
| - name: "mcp-file-auth" | ||
| provider_id: "model-context-protocol" | ||
| url: "http://mock-mcp:3001" | ||
| authorization_headers: | ||
| Authorization: "/tmp/mcp-secret-token" |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| @MCPFileAuth | ||
| Feature: MCP file-based authorization tests | ||
|
|
||
| Regression tests for LCORE-1414: MCP authorization tokens configured via | ||
| file-based authorization_headers must survive model_dump() serialization | ||
| and reach the MCP server as a valid Bearer token. | ||
|
|
||
| Background: | ||
| Given The service is started locally | ||
| And REST API service prefix is /v1 | ||
|
|
||
| Scenario: Query succeeds with file-based MCP authorization | ||
| Given The system is in default state | ||
| When I use "query" to ask question | ||
| """ | ||
| {"query": "Say hello", "model": "{MODEL}", "provider": "{PROVIDER}"} | ||
| """ | ||
| Then The status code of the response is 200 | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| test-secret-token |
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid stacked config swaps when multiple feature tags are present.
Lines 390–394 and 429–432 use the same independent
ifpattern as other config tags. If a feature ends up with multiple config-switch tags, hooks can run multiple backup/switch/restore cycles against the samecontext.default_config_backup, leading to brittle restore behavior. Consider consolidating to a single selected config tag per feature (or enforcing mutual exclusivity) inbefore_feature/after_feature.Also applies to: 429-432
🤖 Prompt for AI Agents