Langflow is a powerful tool for building and deploying AI-powered agents and workflows.
feat: Add global variable support for MCP server headers (#11300)
* feat: Add global variable support for MCP server headers
- Add IOKeyPairInputWithVariables component for header inputs with global variable dropdown
- Integrate global variable selection in MCP Server modal
- Add variable resolution in MCP server headers (_resolve_global_variables_in_headers)
- Add variable loading and decryption in MCP API endpoint and component
- Add unit tests for variable resolution utility function
* test: Add comprehensive unit tests for IOKeyPairInputWithVariables component
- Add 15 test cases covering rendering, user interactions, and edge cases
- Test global variable dropdown functionality and selection
- Test row addition/removal and input validation
- Test duplicate key detection and error handling
- Test initialization from existing values with variable badges
- Addresses CodeRabbit review feedback for frontend test coverage
* [autofix.ci] apply automated fixes
* test: fix frontend Jest tests for IOKeyPairInputWithVariables component
- Added proper mocks for IconComponent, InputComponent, and Input
- Used explicit TypeScript types instead of 'any' for mock props
- Fixed test assertions to match actual component structure (Type key.../Type a value... placeholders)
- All 8 tests now pass without console warnings
- Tests cover: rendering, onChange callbacks, add/delete buttons, global variables toggle
* fix: restore session_scope import to module level for test mocking
The session_scope import was moved inside _process_headers method, which broke
unit tests that mock it at the module level. Restored it to module-level imports
with noqa comment to prevent ruff from removing it, and removed the duplicate
import from inside the method.
Fixes: test_database_config_used_when_no_value_config
* chore: trigger CI rebuild to test for flaky Playwright test
* Update component index
* chore: update Nvidia Remix starter project with session_scope import fix
* perf(mcp): optimize global variable loading to prevent timeouts
Only load global variables from database when headers are actually present
in the MCP server config. This avoids unnecessary database queries for
servers without headers, significantly improving performance and preventing
timeouts in tests that repeatedly connect to MCP servers.
The optimization adds a conditional check before the database query:
- has_headers = server_config.get('headers') and len(server_config.get('headers', {})) > 0
- Only queries database if has_headers is True
This resolves the cumulative delay issue where each MCP connection retry
was performing an expensive database query even when no headers were configured.
* [autofix.ci] apply automated fixes
* fix(test): update Playwright test for new header input component structure
Update MCP server Playwright test to work with the new KeyPairInputWithVariables
component that uses InputComponent with global variable support for header values.
Changes:
- Use getByPlaceholder() instead of getByTestId() for header value fields
- Header value fields now use InputComponent which doesn't expose data-testid
The new component structure wraps the value input in InputComponent to provide
global variable dropdown functionality, requiring a different selector strategy.
* chore: update Nvidia Remix starter project
Update starter project file that was modified by the automated build pipeline.
* Update component index
* fix: replace jose with jwt (#11285)
* replace jose with jwt
* [autofix.ci] apply automated fixes
* [autofix.ci] apply automated fixes (attempt 2/3)
* [autofix.ci] apply automated fixes (attempt 3/3)
* pin to lower pyjwt
* pyjwt version
* [autofix.ci] apply automated fixes
* [autofix.ci] apply automated fixes (attempt 2/3)
* [autofix.ci] apply automated fixes (attempt 3/3)
* [autofix.ci] apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* Update component index
* Update component index
* [autofix.ci] apply automated fixes
* Update component index
* chore: trigger CI rebuild
* [autofix.ci] apply automated fixes
* refactor: remove langflow imports from lfx MCP component
Separate lfx from langflow by using the service layer pattern:
Changes:
1. Extended VariableServiceProtocol in lfx with get_all_decrypted_variables()
2. Implemented the method in langflow's DatabaseVariableService
3. Updated MCP component to use get_variable_service() instead of direct imports
4. Added comprehensive unit tests for the new service method
Benefits:
- Clean separation between lfx and langflow packages
- Uses existing service architecture pattern
- Maintains performance optimization (only loads variables when needed)
- No breaking changes to functionality
Removed direct langflow imports from mcp_component.py (auth utils, Variable model, settings service, and sqlmodel select).
Files modified:
- src/lfx/src/lfx/services/interfaces.py
- src/backend/base/langflow/services/variable/service.py
- src/lfx/src/lfx/components/models_and_agents/mcp_component.py
- src/backend/tests/unit/services/variable/test_service.py (added 3 new tests)
* fix: Handle global variables correctly for components
- Fix UUID type conversion in variable service to prevent SQLAlchemy errors
- Add type-based decryption: only decrypt CREDENTIAL variables, not GENERIC
- Improve error handling in decrypt_api_key to prevent crashes on second attempt
- Resolves 'str object has no attribute hex' error when loading global variables
This fixes issues with watsonx.ai and MCP components when using global variables.
* [autofix.ci] apply automated fixes
* Update component index
* Consider other failed decryption cases
* fix(variable-service): Fix UUID conversion and type-based variable decryption
- Convert string to UUID in get_all_decrypted_variables() to prevent SQLAlchemy errors
- Implement type-based decryption: only decrypt CREDENTIAL variables, not GENERIC
- Simplify get_all() to return stored values directly for both variable types
- Fixes watsonx component update error (400 status) when editing values
Resolves issue where editing watsonx.ai component values caused:
'Error while updating the Component' with 400 client error
* [autofix.ci] apply automated fixes
* chore: update starter project files
* fix: remove explicit value assignment to allow credential redaction
* fix: handle credential redaction in frontend and fix Playwright test hangs
- Update GlobalVariableModal to handle None credential values
- Allow credential updates without re-entering value
- Fix userSettings test by using dispatchEvent for clicks
- Add waitForTimeout after clicks to prevent hangs
- Use .first() for Fields selectors to avoid strict mode violations
* [autofix.ci] apply automated fixes
* Update component index
* [autofix.ci] apply automated fixes
* fix: improve error handling and logging for variable decryption
Address code review feedback:
1. Increase log level from debug to warning when decryption fails in
auth/utils.py. Returning empty string silently could cause issues,
so warning level makes failures more visible.
2. Follow established pattern in mcp.py for variable decryption:
- Only decrypt CREDENTIAL type variables (encrypted in storage)
- Use GENERIC type variables as-is (stored as plaintext)
- Change from silent fallback (adebug) to explicit error (aerror)
- This matches the pattern in get_all_decrypted_variables()
These changes make error handling more explicit and consistent across
the codebase.
* Update component index
* Update component index
* [autofix.ci] apply automated fixes
* chore: trigger CI rebuild
* [autofix.ci] apply automated fixes
* Updates to ensure backwards compatibility for encrypted generic variables
* Skip failed decryption
* Fix test
* ruff
* update starter projects
* ruff
* [autofix.ci] apply automated fixes
* [autofix.ci] apply automated fixes (attempt 2/3)
* comp index
* [autofix.ci] apply automated fixes
* remove unnecessary step in pandas series conversion
---------
Co-authored-by: Steve Haertel <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Himavarsha <[email protected]>
Co-authored-by: Jordan Frazier <[email protected]> S
Steve Haertel committed
b3df3a7c354563b27dc2b4ec4b8bf4e48b0fa16b
Parent: 50bab0a
Committed by GitHub <[email protected]>
on 1/20/2026, 7:03:30 PM