Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
386fa99
migrate mcp transport to http streamable
HzaRashid Nov 26, 2025
945d3ff
clean up v2/mcp
HzaRashid Nov 27, 2025
9afc891
ruff (mcp)
HzaRashid Nov 27, 2025
98235f4
add back ensure_session_mgr_running handler
HzaRashid Nov 27, 2025
5d4a5f3
refactor mcp server and set default mcp settings on project creation
HzaRashid Nov 28, 2025
07909c4
fix mcp auto install tests
HzaRashid Nov 28, 2025
9295f06
[autofix.ci] apply automated fixes
autofix-ci[bot] Nov 28, 2025
9583ee7
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] Nov 28, 2025
c3e0f0a
migrate mcp transport to http streamable
HzaRashid Nov 26, 2025
6a7c5e9
clean up v2/mcp
HzaRashid Nov 27, 2025
c73c033
ruff (mcp)
HzaRashid Nov 27, 2025
d25e2fb
add back ensure_session_mgr_running handler
HzaRashid Nov 27, 2025
d9c5a2b
refactor mcp server and set default mcp settings on project creation
HzaRashid Nov 28, 2025
dcc4a23
fix mcp auto install tests
HzaRashid Nov 28, 2025
1a515c2
misc
HzaRashid Nov 28, 2025
592923c
refactor mcp and mcp_projects
HzaRashid Nov 28, 2025
a6ac93a
fix mcp ctx mgmt in main.py
HzaRashid Nov 29, 2025
023b007
use global exit stack mcp project servers
HzaRashid Nov 29, 2025
e44bf85
use global exit stack mcp project servers
HzaRashid Nov 29, 2025
953e260
return noop response in streamable dispatcher
HzaRashid Nov 30, 2025
dca3f83
docs
HzaRashid Nov 30, 2025
fb77727
docs (main.py)
HzaRashid Nov 30, 2025
4228eb1
use classes for http mgrs
HzaRashid Dec 1, 2025
cf8cd4c
use asyncio tg for mcp projects session mgrs mgmt
HzaRashid Dec 1, 2025
e3b717f
docs
HzaRashid Dec 1, 2025
edbdf19
clean up project tasks class
HzaRashid Dec 1, 2025
bc5df6a
recover original behaviour for /{project_id} endpoint
HzaRashid Dec 1, 2025
1554c3a
[autofix.ci] apply automated fixes
autofix-ci[bot] Dec 1, 2025
6f873b6
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] Dec 1, 2025
49db8c5
[autofix.ci] apply automated fixes (attempt 3/3)
autofix-ci[bot] Dec 1, 2025
e44d9b9
Merge branch 'feat/http-stream-mcp' of https://github.com/langflow-ai…
HimavarshaVS Dec 1, 2025
e69f395
fix for backwards compatilibility for sse requests
HimavarshaVS Dec 1, 2025
dbe619b
[autofix.ci] apply automated fixes
autofix-ci[bot] Dec 1, 2025
8b599f2
migrate mcp transport to http streamable
HzaRashid Nov 26, 2025
625499d
clean up v2/mcp
HzaRashid Nov 27, 2025
3edd952
ruff (mcp)
HzaRashid Nov 27, 2025
716207f
add back ensure_session_mgr_running handler
HzaRashid Nov 27, 2025
1b7146b
refactor mcp server and set default mcp settings on project creation
HzaRashid Nov 28, 2025
88d1f2a
fix mcp auto install tests
HzaRashid Nov 28, 2025
cb3d1a6
misc
HzaRashid Nov 28, 2025
78faaf7
refactor mcp and mcp_projects
HzaRashid Nov 28, 2025
6baa7dd
fix mcp ctx mgmt in main.py
HzaRashid Nov 29, 2025
fc2e11b
use global exit stack mcp project servers
HzaRashid Nov 29, 2025
d93ccf7
use global exit stack mcp project servers
HzaRashid Nov 29, 2025
c261a29
return noop response in streamable dispatcher
HzaRashid Nov 30, 2025
66e449e
docs
HzaRashid Nov 30, 2025
a9ecfc3
docs (main.py)
HzaRashid Nov 30, 2025
6624dc0
use classes for http mgrs
HzaRashid Dec 1, 2025
c1a7618
use asyncio tg for mcp projects session mgrs mgmt
HzaRashid Dec 1, 2025
e96266a
docs
HzaRashid Dec 1, 2025
719b7e6
clean up project tasks class
HzaRashid Dec 1, 2025
84e48e9
recover original behaviour for /{project_id} endpoint
HzaRashid Dec 1, 2025
565ae37
implement asyncio.TaskGroup backport for python 3.10
HzaRashid Dec 1, 2025
c8a9352
remove unused const
HzaRashid Dec 1, 2025
9cfeca4
[autofix.ci] apply automated fixes
autofix-ci[bot] Dec 1, 2025
981f85e
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] Dec 1, 2025
6fb668f
[autofix.ci] apply automated fixes (attempt 3/3)
autofix-ci[bot] Dec 1, 2025
e310825
Merge branch 'feat/http-stream-mcp' of https://github.com/langflow-ai…
HimavarshaVS Dec 2, 2025
2941572
replace asyncio with anyio
HzaRashid Dec 2, 2025
f7e574f
touch ups
HzaRashid Dec 2, 2025
7402173
[autofix.ci] apply automated fixes
autofix-ci[bot] Dec 2, 2025
f892748
Merge branch 'main' into feat/http-stream-mcp
HimavarshaVS Dec 3, 2025
c0ebc4f
[autofix.ci] apply automated fixes
autofix-ci[bot] Dec 3, 2025
d0f0489
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] Dec 3, 2025
f2146eb
Merge branch 'feat/http-stream-mcp' of https://github.com/langflow-ai…
HimavarshaVS Dec 3, 2025
4c2d301
Merge branch 'feat/http-stream-mcp' of https://github.com/langflow-ai…
HimavarshaVS Dec 3, 2025
bbc3584
handle shutdown properly
HimavarshaVS Dec 3, 2025
71513e4
Merge branch 'main' into feat/http-stream-mcp
HimavarshaVS Dec 3, 2025
40df8e2
Update test_mcp_projects.py
erichare Dec 3, 2025
d606968
Fix mypy errors
erichare Dec 3, 2025
f06a9ed
rollback start manager changes
HimavarshaVS Dec 3, 2025
04914c5
Merge branch 'feat/http-stream-mcp' of https://github.com/langflow-ai…
HimavarshaVS Dec 3, 2025
75ade96
use global exit stack mcp project servers
HzaRashid Nov 29, 2025
ae02720
return noop response in streamable dispatcher
HzaRashid Nov 30, 2025
b91ace6
docs
HzaRashid Nov 30, 2025
06d40b5
docs (main.py)
HzaRashid Nov 30, 2025
4a4920e
use classes for http mgrs
HzaRashid Dec 1, 2025
379a487
use asyncio tg for mcp projects session mgrs mgmt
HzaRashid Dec 1, 2025
ca4fe98
docs
HzaRashid Dec 1, 2025
c05de69
clean up project tasks class
HzaRashid Dec 1, 2025
d1c39e4
recover original behaviour for /{project_id} endpoint
HzaRashid Dec 1, 2025
f5441c0
[autofix.ci] apply automated fixes
autofix-ci[bot] Dec 1, 2025
1a1b2ce
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] Dec 1, 2025
60da51d
[autofix.ci] apply automated fixes (attempt 3/3)
autofix-ci[bot] Dec 1, 2025
64b35d8
fix for backwards compatilibility for sse requests
HimavarshaVS Dec 1, 2025
8117663
[autofix.ci] apply automated fixes
autofix-ci[bot] Dec 1, 2025
27f8ab5
migrate mcp transport to http streamable
HzaRashid Nov 26, 2025
2cc0fec
clean up v2/mcp
HzaRashid Nov 27, 2025
23c6046
ruff (mcp)
HzaRashid Nov 27, 2025
b37b6fe
add back ensure_session_mgr_running handler
HzaRashid Nov 27, 2025
e49e5fe
refactor mcp server and set default mcp settings on project creation
HzaRashid Nov 28, 2025
144bd01
migrate mcp transport to http streamable
HzaRashid Nov 26, 2025
7a83a76
clean up v2/mcp
HzaRashid Nov 27, 2025
3a493b1
ruff (mcp)
HzaRashid Nov 27, 2025
c2ee46b
add back ensure_session_mgr_running handler
HzaRashid Nov 27, 2025
04bd598
refactor mcp server and set default mcp settings on project creation
HzaRashid Nov 28, 2025
3966682
fix mcp auto install tests
HzaRashid Nov 28, 2025
3b59b7e
[autofix.ci] apply automated fixes
autofix-ci[bot] Nov 28, 2025
dfd52ff
refactor mcp and mcp_projects
HzaRashid Nov 28, 2025
bbc5daf
fix mcp ctx mgmt in main.py
HzaRashid Nov 29, 2025
77d0804
use global exit stack mcp project servers
HzaRashid Nov 29, 2025
2a7edeb
fix mcp auto install tests
HzaRashid Nov 28, 2025
d47c259
misc
HzaRashid Nov 28, 2025
873916f
refactor mcp and mcp_projects
HzaRashid Nov 28, 2025
e4059fc
fix mcp ctx mgmt in main.py
HzaRashid Nov 29, 2025
07a8666
use global exit stack mcp project servers
HzaRashid Nov 29, 2025
6a9a3b2
use global exit stack mcp project servers
HzaRashid Nov 29, 2025
aca1ece
return noop response in streamable dispatcher
HzaRashid Nov 30, 2025
166d974
docs
HzaRashid Nov 30, 2025
c76cfb1
docs (main.py)
HzaRashid Nov 30, 2025
0f0257d
use classes for http mgrs
HzaRashid Dec 1, 2025
3d7ff92
use asyncio tg for mcp projects session mgrs mgmt
HzaRashid Dec 1, 2025
323258f
docs
HzaRashid Dec 1, 2025
6add199
clean up project tasks class
HzaRashid Dec 1, 2025
58d621f
recover original behaviour for /{project_id} endpoint
HzaRashid Dec 1, 2025
c52fbd5
implement asyncio.TaskGroup backport for python 3.10
HzaRashid Dec 1, 2025
c5c8fcd
remove unused const
HzaRashid Dec 1, 2025
13deb16
[autofix.ci] apply automated fixes
autofix-ci[bot] Dec 1, 2025
2321075
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] Dec 1, 2025
eefbc02
[autofix.ci] apply automated fixes (attempt 3/3)
autofix-ci[bot] Dec 1, 2025
78885b6
replace asyncio with anyio
HzaRashid Dec 2, 2025
52142dd
touch ups
HzaRashid Dec 2, 2025
81c847d
[autofix.ci] apply automated fixes
autofix-ci[bot] Dec 3, 2025
924f59a
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] Dec 3, 2025
a0663e5
handle shutdown properly
HimavarshaVS Dec 3, 2025
040ca64
rollback start manager changes
HimavarshaVS Dec 3, 2025
c206c0a
Update test_mcp_projects.py
erichare Dec 3, 2025
8935e53
Fix mypy errors
erichare Dec 3, 2025
1694e3b
graceful termination of mcp projects /streamable endpoint
HzaRashid Dec 3, 2025
5654ceb
delete removed file
HzaRashid Dec 3, 2025
9f7014d
[autofix.ci] apply automated fixes
autofix-ci[bot] Dec 3, 2025
6d75e3b
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] Nov 28, 2025
fad1b43
migrate mcp transport to http streamable
HzaRashid Nov 26, 2025
ca2941f
clean up v2/mcp
HzaRashid Nov 27, 2025
44ed389
ruff (mcp)
HzaRashid Nov 27, 2025
8b191e0
add back ensure_session_mgr_running handler
HzaRashid Nov 27, 2025
245e3c9
refactor mcp server and set default mcp settings on project creation
HzaRashid Nov 28, 2025
bb5faba
misc
HzaRashid Nov 28, 2025
02d5319
Merge branch 'main' into feat/http-stream-mcp
HimavarshaVS Dec 4, 2025
44b185f
[autofix.ci] apply automated fixes
autofix-ci[bot] Dec 4, 2025
2aa111e
Merge branch 'feat/http-stream-mcp' of https://github.com/langflow-ai…
HimavarshaVS Dec 4, 2025
3b4c4bd
build component index
HimavarshaVS Dec 4, 2025
173a2d1
Merge remote-tracking branch 'origin' into feat/http-stream-mcp
HimavarshaVS Dec 4, 2025
3d3def6
[autofix.ci] apply automated fixes
autofix-ci[bot] Dec 4, 2025
aea5f78
[autofix.ci] apply automated fixes (attempt 3/3)
autofix-ci[bot] Dec 1, 2025
510cc65
add health check endpoint for streamable
HzaRashid Dec 4, 2025
99705e0
sync starter projects with main
HzaRashid Dec 4, 2025
1c2f734
remove unused delete method from sse transport
HzaRashid Dec 4, 2025
eea4849
Merge remote-tracking branch 'upstream/main' into feat/http-stream-mcp
HzaRashid Dec 5, 2025
269dd1e
get user-level files in handle_list_resources
HzaRashid Dec 7, 2025
0c709b3
Merge remote-tracking branch 'upstream/main' into feat/http-stream-mcp
HzaRashid Dec 8, 2025
b943b6e
add backwards compat tests for sse transport
HzaRashid Dec 8, 2025
d0925df
merge with main
HzaRashid Dec 8, 2025
d458fc2
fix frontend tests
HzaRashid Dec 8, 2025
b973b41
fix lfx test
HzaRashid Dec 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[autofix.ci] apply automated fixes
  • Loading branch information
autofix-ci[bot] authored Nov 28, 2025
commit 9295f06b41023f85dc908081f95ef29ab4f22aaf
3 changes: 3 additions & 0 deletions src/backend/base/langflow/api/v1/mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ async def handle_global_call_tool(name: str, arguments: dict) -> list[types.Text
# TODO: create environment variable for stateless flag
streamable_http_manager = StreamableHTTPSessionManager(server, stateless=True)


def find_validation_error(exc):
"""Searches for a pydantic.ValidationError in the exception chain."""
while exc:
Expand Down Expand Up @@ -157,6 +158,8 @@ async def _dispatch_streamable_http(


streamable_http_methods = ["GET", "POST", "DELETE"]


@router.api_route("/streamable", methods=streamable_http_methods)
@router.api_route("/streamable/", methods=streamable_http_methods)
async def handle_streamable_http(request: Request, current_user: CurrentActiveMCPUser):
Expand Down
14 changes: 8 additions & 6 deletions src/backend/base/langflow/api/v1/mcp_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
)



async def verify_project_auth(
db: AsyncSession,
project_id: UUID,
Expand Down Expand Up @@ -212,7 +211,6 @@ def get_project_sse(project_id: UUID | None) -> SseServerTransport:
return project_sse_transports[project_id_str]



async def _build_project_tools_response(
project_id: UUID,
current_user: CurrentActiveMCPUser,
Expand Down Expand Up @@ -319,7 +317,7 @@ async def im_alive(project_id: str): # noqa: ARG001


@router.head("/{project_id}/streamable", include_in_schema=False)
async def streamable_health(project_id: UUID): # noqa: ARG001
async def streamable_health(project_id: UUID): # noqa: ARG001
return Response()


Expand All @@ -344,9 +342,7 @@ async def _dispatch_project_streamable_http(
except HTTPException:
raise
except Exception as exc:
await logger.aexception(
f"Error handling Streamable HTTP request for project {project_id}: {exc!s}"
)
await logger.aexception(f"Error handling Streamable HTTP request for project {project_id}: {exc!s}")
raise HTTPException(status_code=500, detail="Internal server error in project MCP transport") from exc
finally:
current_request_variables_ctx.reset(request_vars_token)
Expand Down Expand Up @@ -432,8 +428,11 @@ async def _handle_project_sse_messages(
current_project_ctx.reset(project_token)
current_request_variables_ctx.reset(req_vars_token)


# legacy SSE transport
project_messages_methods = ["POST", "DELETE"]


@router.api_route("/{project_id}", methods=project_messages_methods)
@router.api_route("/{project_id}/", methods=project_messages_methods)
async def handle_project_messages(
Expand All @@ -444,8 +443,11 @@ async def handle_project_messages(
"""Handle POST/DELETE messages for a project-specific MCP server."""
return await _handle_project_sse_messages(project_id, request, current_user)


# Streamable HTTP transport
streamable_http_methods = ["GET", "POST", "DELETE"]


@router.api_route("/{project_id}/streamable", methods=streamable_http_methods)
@router.api_route("/{project_id}/streamable/", methods=streamable_http_methods)
async def handle_project_streamable_http(
Expand Down
3 changes: 2 additions & 1 deletion src/backend/base/langflow/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,9 @@ async def delayed_init_mcp_servers():
mcp_init_task = asyncio.create_task(delayed_init_mcp_servers())

# Start streamable-http transport session manager for MCP server
from contextlib import AsyncExitStack # noqa: I001
from contextlib import AsyncExitStack # noqa: I001
from langflow.api.v1.mcp import streamable_http_manager

await logger.adebug("Starting MCP Server Streamable HTTP session manager")
async with AsyncExitStack() as stack:
await stack.enter_async_context(streamable_http_manager.run())
Expand Down
5 changes: 1 addition & 4 deletions src/backend/tests/integration/test_projects_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@


@pytest.mark.asyncio
async def test_project_authentication_settings(
client: AsyncClient,
logged_in_headers
):
async def test_project_authentication_settings(client: AsyncClient, logged_in_headers):
"""Integration test: Project authentication settings configuration."""
# Scenario 1: AUTO_LOGIN disabled -> API key auth
with patch("langflow.api.v1.projects.get_settings_service") as mock_get_settings:
Expand Down
4 changes: 4 additions & 0 deletions src/backend/tests/unit/api/v1/test_mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ async def test_find_validation_error_with_pydantic_error():
# Create a pydantic ValidationError by catching it
validation_error = None
try:

class TestModel(pydantic.BaseModel):
required_field: str

Expand Down Expand Up @@ -226,6 +227,7 @@ async def test_find_validation_error_with_context():
# Create a pydantic ValidationError by catching it
validation_error = None
try:

class TestModel(pydantic.BaseModel):
required_field: str

Expand Down Expand Up @@ -263,8 +265,10 @@ async def test_mcp_sse_validation_error_logged():
# Verify the function exists and works
validation_error = None
try:

class TestModel(pydantic.BaseModel):
required_field: str

TestModel()
except pydantic.ValidationError as e:
validation_error = e
Expand Down
1 change: 1 addition & 0 deletions src/backend/tests/unit/api/v1/test_mcp_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,13 +601,14 @@
config_path = tmp_path / filename
config_path.parent.mkdir(parents=True, exist_ok=True)

monkeypatch.setattr("langflow.api.v1.mcp_projects.get_client_ip", lambda request: "127.0.0.1")

Check failure on line 604 in src/backend/tests/unit/api/v1/test_mcp_projects.py

View workflow job for this annotation

GitHub Actions / Ruff Style Check (3.13)

Ruff (ARG005)

src/backend/tests/unit/api/v1/test_mcp_projects.py:604:78: ARG005 Unused lambda argument: `request`

async def fake_get_config_path(client_name):

Check failure on line 606 in src/backend/tests/unit/api/v1/test_mcp_projects.py

View workflow job for this annotation

GitHub Actions / Ruff Style Check (3.13)

Ruff (ARG001)

src/backend/tests/unit/api/v1/test_mcp_projects.py:606:36: ARG001 Unused function argument: `client_name`
return config_path

monkeypatch.setattr("langflow.api.v1.mcp_projects.get_config_path", fake_get_config_path)
monkeypatch.setattr("langflow.api.v1.mcp_projects.platform.system", lambda: "Linux")
monkeypatch.setattr("langflow.api.v1.mcp_projects.should_use_mcp_composer", lambda project: False)

Check failure on line 611 in src/backend/tests/unit/api/v1/test_mcp_projects.py

View workflow job for this annotation

GitHub Actions / Ruff Style Check (3.13)

Ruff (ARG005)

src/backend/tests/unit/api/v1/test_mcp_projects.py:611:88: ARG005 Unused lambda argument: `project`

async def fake_streamable(project_id):
return f"https://langflow.local/api/v1/mcp/project/{project_id}/streamable"
Expand Down
8 changes: 4 additions & 4 deletions src/lfx/src/lfx/services/mcp_composer/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ class MCPComposerService(Service):

def __init__(self):
super().__init__()
self.project_composers: dict[str, dict] = {} # project_id -> {process, host, port, streamable_http_url, auth_config}
self.project_composers: dict[
str, dict
] = {} # project_id -> {process, host, port, streamable_http_url, auth_config}
self._start_locks: dict[
str, asyncio.Lock
] = {} # Lock to prevent concurrent start operations for the same project
Expand Down Expand Up @@ -1045,9 +1047,7 @@ async def _do_start_project_composer(

project_host = auth_config.get("oauth_host") if auth_config else "unknown"
project_port = auth_config.get("oauth_port") if auth_config else "unknown"
await logger.adebug(
f"Starting MCP Composer for project {project_id} on {project_host}:{project_port}"
)
await logger.adebug(f"Starting MCP Composer for project {project_id} on {project_host}:{project_port}")

# Use a per-project lock to prevent race conditions
if project_id not in self._start_locks:
Expand Down
8 changes: 4 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading