feat: add one click install to mcp servers on specific clients (#8271)
* Added endpoint to add servers to local backend * Add install mcp query * Fixed mcp projects to receive body schema * Added patch install to mcp server tab * feat: adds new Edit Details popover, removes flow menu, fixes nav alignment, adds new Flow Status overlay (#8087) * Updated flow settings component size * Added FlowSettingsComponent to contain modal content * Removed unused imports * Changed Flow Settings Modal to use new component * Changed Flow Menu styling, removing Saved and context menu, and adding a direct click to edit flow info * Removed unused styling * Updated nav position and truncation * updated alert styling * Added z index to header * Added flow settings coming from the bottom * Changed flow settings to not crash when there is no flow * Removed unused imports * Implemented flow details using popover * Removed onClick * Changed canvas controls position and color * Changed panel tooltip side and classes * Added log canvas component * Added children to flow logs modal * Added log canvas component into page * Changed position and shadow of canvas controls * removed endpoint name from edit flow settings * added endpoint name change into tweaks modal * Added endpoint editing to tweaks * Implemented storing the error in the flowBuildStatus * Updated type * Added Flow Building Component * Added Flow Building Component implementation * Added red color * Added past build flow params * Implemented design of flowBuildingComponent * Implemented build error storing on flowStore * Implemented build error on flow store * Changed notifications test * Set build error as null when building * Reset build error when exiting flow * Changed from error to buildError * Changed flowStore to have buildInfo instead of buildError * Changed flowBuildingComponent to have buildInfo and display successful builds * Added handleDismissed instead of setting dismissed as true * Updated tests to current Update implementation * Updated tests to remove click on built successfully * Updated tests and data-testid to match new Flow Name editing behavior * fixed auto login test * Fixed edit-flow-name test and save changes on node * fixed tests * Changed Share to Publish and added test ids * added Rename Flow util for tests * Changed tests to use new RenameFlow * Fixed auto save off * Added data test id to flow building component * Removed pulsing from Name Invalid * Made name editable but not saveable when invalid * Added character name reached on description * Added transition on pencil * Modularized alert store to separate notification history and notifications * Added errors to notification history * Fixed flow building component position and update all components * Fixed animations * Fixed animation * Added same animation to Update All Components * Updated animations to make update only appear when flow building is not appearing * fix flow settings test * Fixed build status not being redefined * ✨ (UpdateAllComponents/index.tsx): Refactor containerVariants to CONTAINER_VARIANTS for consistency and readability 📝 (visual-variants.ts): Add visual variants for buttons and time in flowBuildingComponent ♻️ (flowBuildingComponent/index.tsx): Import visual variants from separate file for better organization and maintainability * Fixed offset width of time --------- Co-authored-by: cristhianzl <cristhian.lousa@gmail.com> * fix: fix regex on mcp server tab test (#8175) * Fixed MCP Server Tab Test * Fixed mcp server tab test * Added timeout to test * Added retry to mcp server tab test * docs: cookie-banner-link (#8179) cookie-banner-link * fix: removed fit view that caused duck duck go test to fail (#8178) fixed duck duck go test to not fail * feat: Enhance API request component (#8070) * update the api request component * [autofix.ci] apply automated fixes * update the component * Update test_api_request_component.py * [autofix.ci] apply automated fixes * remove MODE_CONFIG unused variable * [autofix.ci] apply automated fixes * use normalize function * Update template * Update test_api_request_component.py * UI test fix * selector fix --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Yuqi Tang <yuqi.tang@datastax.com> Co-authored-by: Mike Fortman <michael.fortman@datastax.com> * docs: system assist component (#8089) * sidebars * initial-content * more * update * trailing-spaces * example * standardize-naming * shorten-introduction-and-remove-client * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * Update docs/docs/Integrations/Nvidia/integrations-nvidia-system-assist.md --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * docs: deploy langflow with caddyfile and docker compose (#8120) * initial-content * not-json * clarify-public key * more-accessible-name-and-context * exit-session * fix: simplify GetStartedProgress percentage calculation logic (#8183) 🐛 (get-started-progress.tsx): fix calculation of totalPercentage to correctly display progress bar percentage 💡 (get-started-progress.tsx): refactor logic to calculate totalPercentage based on user opt-ins and flows * fix: set cursor to text in text fields (#8173) Fixed cursor being default in input fields * feat: add datastax components bundle (#8184) * feat: add datastax components bundle * Update __init__.py * Remove old astra assistants folder * Remove old tools * Update __init__.py * Update test_assistants_components.py --------- Co-authored-by: Edwin Jose <edwin.jose@datastax.com> * feat: updated components header styling (#8085) * Removed unused styles * Updated node icon to follow design * Updated node name to follow design and include Beta * Removed Beta from node status * Removed unused classes and parameters from GenericNode * Changed node description padding on input * Changed paddings and gaps * removed unused classes * Added accent purple foreground color to Experimental * Fixed classes and gaps in generic node * Fixed node name gaps * Fixed node status classes and styling * Removed unused classes and changed run-bg size * Changed test to use new test id * Changed Node Name to have beta tooltip * Changed Build Failed icon to be a circle alert * Changed Node Status gap and conditions to show spacings correctly * Changed padding to not change height of other components * Changed nodeStatus to show validation on small node * Changed classes to show correct spacing and overflow * Changed description size * Fixed description text size * Fixed input margin * Fixed description editing not appearing when no description is available * Fixed status not breaking words * Updated colors * Updated node output color * [autofix.ci] apply automated fixes * Changed duration style in chat * Re-added output color * Updated timeout on mcp server tab test * Added more timeout to mcp server tab test * fixed loop component test --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> * ref: SQL component (#8185) * update sql * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> * feat: Loop uplift dataframe input and output (#8177) * tests cases * update to loop * Update component.py * 📝 (LoopTemplate.json): update value of a configuration key from "OPENAI_API_KEY" to "ANTHROPIC_API_KEY" in order to reflect the correct API key being used * update json test loop * add dataframe support for the loop component * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * fix: starter project * update loop component and tests * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * update logic * Update loop_basic.py * Update Research Translation Loop.json * fix lint * format fix * [autofix.ci] apply automated fixes * reverting changes in component and vertex base * [autofix.ci] apply automated fixes * fix lint errors * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * update in the loop templates and component * [autofix.ci] apply automated fixes * Update Research Translation Loop.json * update tests * update the code and deprecate the old loop * [autofix.ci] apply automated fixes * Update loop_basic.py * WIP FIX Loop Tests * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes * ✨ (loop-component.spec.ts): Update test cases to use more descriptive names for components and actions for better clarity and understanding. * ✨ (loop-component.spec.ts): refactor loop component tests to improve readability and maintainability by updating test selectors and removing redundant test steps * update * Update loop-component.spec.ts * Update Research Translation Loop.json * Update Research Translation Loop.json * Update Research Translation Loop.json * Update Research Translation Loop.json * loop test fix --------- Co-authored-by: cristhianzl <cristhian.lousa@gmail.com> Co-authored-by: Rodrigo <rodrigosilvanader@gmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com> Co-authored-by: Mike Fortman <michael.fortman@datastax.com> * fix: fixes nightly tests (#8194) * fix: mcp test when there are a lot of flows (#8197) * Added cursor and claude in icons * Added one click install to cursor and claude * Changed design of mcp server tab page * Added function to get local platform * Added platform specific installer json on mcp server tab * Added FA icons for windows and linux * Added icons to tabs * Added endpoint to check for installed MCP servers * Added use get installed MCP servers * Changed to get installed * Use installed MCP servers on server * Correct instalation for windows and WSL * Fixed code not selecting * refactor: use session_scope for database session management in install_mcp_config * refactor: change logger level from info to debug for WSL and Windows detection in install_mcp_configg * refactor: replace subprocess with asyncio for WSL IP address retrieval in install_mcp_config * refactor: streamline project MCP server handling and improve SSE connection management in mcp_projects.py * refactor: remove unnecessary user dependency from project endpoints in mcp_projects.py * refactor: unify database session management using session_scope in mcp_projects.py * refactor: enhance project tool listing and logging in mcp_projects.py by using session_scope and changing logger level to debug * refactor: simplify WSL detection logic in install_mcp_config by removing unnecessary variable and streamlining conditions * Removed unused console.log * Implemented check if Langflow is running on local machine * Fixed backend to generate an error if trying to install from not local * Added error handling to frontend and changed loading * Fix check of macos * Refactored mcp server tab test to work with new changes * Fixed test to pass with Windows selected and check the status of Linux too * [autofix.ci] apply automated fixes * Changed wait for timeout for wait for selector * Fixed path.open * Refactor test_update_project_mcp_settings to use session_scope for database service mock * Refactor tests in test_mcp_projects.py to utilize session_scope for database session management, improving consistency and readability. * Updated wsl to uvx --------- Co-authored-by: cristhianzl <cristhian.lousa@gmail.com> Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com> Co-authored-by: Edwin Jose <edwin.jose@datastax.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Yuqi Tang <yuqi.tang@datastax.com> Co-authored-by: Mike Fortman <michael.fortman@datastax.com> Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> Co-authored-by: Eric Hare <ericrhare@gmail.com> Co-authored-by: Rodrigo <rodrigosilvanader@gmail.com> Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com> Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
parent
21af370e5b
commit
d3d06be8e5
14 changed files with 894 additions and 275 deletions
|
|
@ -15,8 +15,7 @@ from langflow.services.auth.utils import get_password_hash
|
|||
from langflow.services.database.models.flow import Flow
|
||||
from langflow.services.database.models.folder import Folder
|
||||
from langflow.services.database.models.user import User
|
||||
from langflow.services.database.utils import session_getter
|
||||
from langflow.services.deps import get_db_service
|
||||
from langflow.services.deps import session_scope
|
||||
from mcp.server.sse import SseServerTransport
|
||||
|
||||
# Mark all tests in this module as asyncio
|
||||
|
|
@ -100,8 +99,7 @@ def mock_current_project_ctx(mock_project):
|
|||
async def other_test_user():
|
||||
"""Fixture for creating another test user."""
|
||||
user_id = uuid4()
|
||||
db_manager = get_db_service()
|
||||
async with db_manager.with_session() as session:
|
||||
async with session_scope() as session:
|
||||
user = User(
|
||||
id=user_id,
|
||||
username="other_test_user",
|
||||
|
|
@ -114,7 +112,7 @@ async def other_test_user():
|
|||
await session.refresh(user)
|
||||
yield user
|
||||
# Clean up
|
||||
async with db_manager.with_session() as session:
|
||||
async with session_scope() as session:
|
||||
user = await session.get(User, user_id)
|
||||
if user:
|
||||
await session.delete(user)
|
||||
|
|
@ -125,15 +123,14 @@ async def other_test_user():
|
|||
async def other_test_project(other_test_user):
|
||||
"""Fixture for creating a project for another test user."""
|
||||
project_id = uuid4()
|
||||
db_manager = get_db_service()
|
||||
async with db_manager.with_session() as session:
|
||||
async with session_scope() as session:
|
||||
project = Folder(id=project_id, name="Other Test Project", user_id=other_test_user.id)
|
||||
session.add(project)
|
||||
await session.commit()
|
||||
await session.refresh(project)
|
||||
yield project
|
||||
# Clean up
|
||||
async with db_manager.with_session() as session:
|
||||
async with session_scope() as session:
|
||||
project = await session.get(Folder, project_id)
|
||||
if project:
|
||||
await session.delete(project)
|
||||
|
|
@ -144,9 +141,9 @@ async def test_handle_project_messages_success(
|
|||
client: AsyncClient, mock_project, mock_sse_transport, logged_in_headers
|
||||
):
|
||||
"""Test successful handling of project messages."""
|
||||
with patch("langflow.api.v1.mcp_projects.get_db_service") as mock_db:
|
||||
with patch("langflow.api.v1.mcp_projects.session_scope") as mock_db:
|
||||
mock_session = AsyncMock()
|
||||
mock_db.return_value.with_session.return_value.__aenter__.return_value = mock_session
|
||||
mock_db.return_value.__aenter__.return_value = mock_session
|
||||
mock_session.exec.return_value.first.return_value = mock_project
|
||||
|
||||
response = await client.post(
|
||||
|
|
@ -160,9 +157,9 @@ async def test_handle_project_messages_success(
|
|||
|
||||
async def test_update_project_mcp_settings_invalid_json(client: AsyncClient, mock_project, logged_in_headers):
|
||||
"""Test updating MCP settings with invalid JSON."""
|
||||
with patch("langflow.api.v1.mcp_projects.get_db_service") as mock_db:
|
||||
with patch("langflow.api.v1.mcp_projects.session_scope") as mock_db:
|
||||
mock_session = AsyncMock()
|
||||
mock_db.return_value.with_session.return_value.__aenter__.return_value = mock_session
|
||||
mock_db.return_value.__aenter__.return_value = mock_session
|
||||
mock_session.exec.return_value.first.return_value = mock_project
|
||||
|
||||
response = await client.patch(
|
||||
|
|
@ -187,8 +184,7 @@ async def test_flow_for_update(active_user, user_test_project):
|
|||
}
|
||||
|
||||
# Create the flow in the database
|
||||
db_manager = get_db_service()
|
||||
async with db_manager.with_session() as session:
|
||||
async with session_scope() as session:
|
||||
flow = Flow(**flow_data)
|
||||
session.add(flow)
|
||||
await session.commit()
|
||||
|
|
@ -197,7 +193,8 @@ async def test_flow_for_update(active_user, user_test_project):
|
|||
yield flow
|
||||
|
||||
# Clean up
|
||||
async with db_manager.with_session() as session:
|
||||
async with session_scope() as session:
|
||||
# Get the flow from the database
|
||||
flow = await session.get(Flow, flow_id)
|
||||
if flow:
|
||||
await session.delete(flow)
|
||||
|
|
@ -230,7 +227,7 @@ async def test_update_project_mcp_settings_success(
|
|||
assert "Updated MCP settings for 1 flows" in response.json()["message"]
|
||||
|
||||
# Verify the flow was actually updated in the database
|
||||
async with session_getter(get_db_service()) as session:
|
||||
async with session_scope() as session:
|
||||
updated_flow = await session.get(Flow, test_flow_for_update.id)
|
||||
assert updated_flow is not None
|
||||
assert updated_flow.action_name == "updated_action"
|
||||
|
|
@ -271,7 +268,7 @@ async def test_update_project_mcp_settings_empty_settings(client: AsyncClient, u
|
|||
# Use real database objects instead of mocks to avoid the coroutine issue
|
||||
|
||||
# Empty settings list
|
||||
settings = []
|
||||
settings: list = []
|
||||
|
||||
# Make the request to the actual endpoint
|
||||
response = await client.patch(
|
||||
|
|
@ -300,7 +297,7 @@ async def test_user_data_isolation_with_real_db(
|
|||
second_flow_id = uuid4()
|
||||
|
||||
# Use real database session just for flow creation and cleanup
|
||||
async with session_getter(get_db_service()) as session:
|
||||
async with session_scope() as session:
|
||||
# Create a flow in the other user's project
|
||||
second_flow = Flow(
|
||||
id=second_flow_id,
|
||||
|
|
@ -331,7 +328,7 @@ async def test_user_data_isolation_with_real_db(
|
|||
|
||||
finally:
|
||||
# Clean up flow
|
||||
async with session_getter(get_db_service()) as session:
|
||||
async with session_scope() as session:
|
||||
second_flow = await session.get(Flow, second_flow_id)
|
||||
if second_flow:
|
||||
await session.delete(second_flow)
|
||||
|
|
@ -342,15 +339,14 @@ async def test_user_data_isolation_with_real_db(
|
|||
async def user_test_project(active_user):
|
||||
"""Fixture for creating a project for the active user."""
|
||||
project_id = uuid4()
|
||||
db_manager = get_db_service()
|
||||
async with db_manager.with_session() as session:
|
||||
async with session_scope() as session:
|
||||
project = Folder(id=project_id, name="User Test Project", user_id=active_user.id)
|
||||
session.add(project)
|
||||
await session.commit()
|
||||
await session.refresh(project)
|
||||
yield project
|
||||
# Clean up
|
||||
async with db_manager.with_session() as session:
|
||||
async with session_scope() as session:
|
||||
project = await session.get(Folder, project_id)
|
||||
if project:
|
||||
await session.delete(project)
|
||||
|
|
@ -361,8 +357,7 @@ async def user_test_project(active_user):
|
|||
async def user_test_flow(active_user, user_test_project):
|
||||
"""Fixture for creating a flow for the active user."""
|
||||
flow_id = uuid4()
|
||||
db_manager = get_db_service()
|
||||
async with db_manager.with_session() as session:
|
||||
async with session_scope() as session:
|
||||
flow = Flow(
|
||||
id=flow_id,
|
||||
name="User Test Flow",
|
||||
|
|
@ -378,7 +373,7 @@ async def user_test_flow(active_user, user_test_project):
|
|||
await session.refresh(flow)
|
||||
yield flow
|
||||
# Clean up
|
||||
async with db_manager.with_session() as session:
|
||||
async with session_scope() as session:
|
||||
flow = await session.get(Flow, flow_id)
|
||||
if flow:
|
||||
await session.delete(flow)
|
||||
|
|
@ -411,7 +406,7 @@ async def test_user_can_update_own_flow_mcp_settings(
|
|||
assert "Updated MCP settings for 1 flows" in response.json()["message"]
|
||||
|
||||
# Verify the flow was actually updated in the database
|
||||
async with session_getter(get_db_service()) as session:
|
||||
async with session_scope() as session:
|
||||
updated_flow = await session.get(Flow, user_test_flow.id)
|
||||
assert updated_flow is not None
|
||||
assert updated_flow.action_name == "updated_user_action"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue