-
Notifications
You must be signed in to change notification settings - Fork 8.2k
feat: create env variable flag for mcp streamable-http stateless mode #11098
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
base: main
Are you sure you want to change the base?
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughIntroduces a settings-based configuration flag ( Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~35 minutes
Pre-merge checks and finishing touchesImportant Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (2 warnings, 2 inconclusive)
✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11098 +/- ##
=======================================
Coverage 33.22% 33.22%
=======================================
Files 1391 1391
Lines 65849 65854 +5
Branches 9745 9745
=======================================
+ Hits 21877 21883 +6
+ Misses 42850 42849 -1
Partials 1122 1122
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
bdcd801 to
4379fee
Compare
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.
Actionable comments posted: 3
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/backend/base/langflow/api/v1/mcp.py(4 hunks)src/backend/base/langflow/api/v1/mcp_projects.py(2 hunks)src/lfx/src/lfx/services/settings/base.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
src/backend/**/*.py
📄 CodeRabbit inference engine (.cursor/rules/backend_development.mdc)
src/backend/**/*.py: Use FastAPI async patterns withawaitfor async operations in component execution methods
Useasyncio.create_task()for background tasks and implement proper cleanup with try/except forasyncio.CancelledError
Usequeue.put_nowait()for non-blocking queue operations andasyncio.wait_for()with timeouts for controlled get operations
Files:
src/backend/base/langflow/api/v1/mcp.pysrc/backend/base/langflow/api/v1/mcp_projects.py
src/backend/base/langflow/api/**/*.py
📄 CodeRabbit inference engine (.cursor/rules/backend_development.mdc)
Backend API endpoints should be organized by version (v1/, v2/) under
src/backend/base/langflow/api/with specific modules for features (chat.py, flows.py, users.py, etc.)
Files:
src/backend/base/langflow/api/v1/mcp.pysrc/backend/base/langflow/api/v1/mcp_projects.py
🧠 Learnings (2)
📓 Common learnings
Learnt from: deon-sanchez
Repo: langflow-ai/langflow PR: 9158
File: src/backend/base/langflow/api/v1/mcp_projects.py:404-404
Timestamp: 2025-07-23T21:19:22.567Z
Learning: In langflow MCP projects configuration, prefer using dynamically computed URLs (like the `sse_url` variable) over hardcoded localhost URLs to ensure compatibility across different deployment environments.
📚 Learning: 2025-10-29T03:55:50.216Z
Learnt from: ricofurtado
Repo: langflow-ai/langflow PR: 10430
File: src/backend/base/langflow/api/v2/registration.py:0-0
Timestamp: 2025-10-29T03:55:50.216Z
Learning: In the langflow project, user registration endpoints in API v2 (`src/backend/base/langflow/api/v2/registration.py`) are intentionally designed to be unauthenticated to support Desktop application initialization and onboarding flows.
Applied to files:
src/backend/base/langflow/api/v1/mcp_projects.py
🧬 Code graph analysis (1)
src/backend/base/langflow/api/v1/mcp.py (3)
src/lfx/src/lfx/services/interfaces.py (1)
settings(55-57)src/lfx/src/lfx/services/mcp_composer/service.py (1)
start(450-460)src/backend/tests/unit/base/mcp/test_mcp_util.py (1)
session_manager(28-33)
🪛 GitHub Actions: Ruff Style Check
src/backend/base/langflow/api/v1/mcp_projects.py
[error] 72-72: Ruff lint error (F811): Redefinition of unused 'get_settings_service' from line 23 in src/backend/base/langflow/api/v1/mcp_projects.py.
🪛 GitHub Check: Ruff Style Check (3.13)
src/backend/base/langflow/api/v1/mcp_projects.py
[failure] 72-72: Ruff (F811)
src/backend/base/langflow/api/v1/mcp_projects.py:72:49: F811 Redefinition of unused get_settings_service from line 23
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (17)
- GitHub Check: Test Docker Images / Test docker images
- GitHub Check: Lint Backend / Run Mypy (3.13)
- GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 3
- GitHub Check: Lint Backend / Run Mypy (3.10)
- GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 1
- GitHub Check: Run Backend Tests / LFX Tests - Python 3.10
- GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 2
- GitHub Check: Lint Backend / Run Mypy (3.12)
- GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 4
- GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 5
- GitHub Check: Lint Backend / Run Mypy (3.11)
- GitHub Check: Run Backend Tests / Integration Tests - Python 3.10
- GitHub Check: Test Starter Templates
- GitHub Check: Run Frontend Tests / Determine Test Suites and Shard Distribution
- GitHub Check: Update Starter Projects
- GitHub Check: Update Component Index
- GitHub Check: Optimize new Python code in this PR
🔇 Additional comments (5)
src/lfx/src/lfx/services/settings/base.py (1)
310-311: LGTM!The new
mcp_streamable_http_statelesssetting follows the existing patterns for MCP-related configuration fields. The default value ofTrueand the clear docstring explaining its purpose are appropriate.src/backend/base/langflow/api/v1/mcp.py (2)
191-211: LGTM on the start method structure.The simplified signature and the internal logic are well-structured. The lock prevents race conditions, the event-based synchronization with
_mgr_readyensures proper startup sequencing, and exceptions are properly surfaced viaawait self._mgr_task.
246-247: LGTM!Removing the
statelessparameter from the public API in favor of settings-driven configuration simplifies the interface and ensures consistent behavior based on environment configuration.src/backend/base/langflow/api/v1/mcp_projects.py (2)
1254-1267: LGTM on session manager initialization.The double-checked locking pattern (
if started: return; async with lock: if started: return) correctly prevents race conditions while minimizing lock contention. The integration withProjectTaskGroupfor centralized lifecycle management is a clean design.
1295-1358: LGTM on ProjectTaskGroup lifecycle management.The design correctly ensures that the
TaskGroup's__aenter__and__aexit__occur within the same coroutine, which is required by anyio/asyncio. The cancellation handling viacancel_scope.cancel()followed by awaiting the task is the correct pattern for graceful shutdown.
d2bc35e to
f6f5a2a
Compare
introduce an environment variable to expose and set the streamable-http session manager's stateless flag in langflow's mcp server implementation
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.