Skip to content

fix: implemented cached values and temporary MCP servers on MCP component#8628

Merged
lucaseduoli merged 16 commits into
mainfrom
fix/mcp_speed
Jun 23, 2025
Merged

fix: implemented cached values and temporary MCP servers on MCP component#8628
lucaseduoli merged 16 commits into
mainfrom
fix/mcp_speed

Conversation

@lucaseduoli
Copy link
Copy Markdown
Collaborator

@lucaseduoli lucaseduoli commented Jun 18, 2025

Overview

This PR introduces a set of improvements and fixes to the McpComponent behavior and supporting backend logic, focusing on better UX, reduced latency, and reliable value persistence.


Key Changes

Frontend

  • Temporary MCP Server Support:

    • McpComponent now allows selecting a server even if it hasn’t been added permanently.
    • Handles a { name, config } structure for temporary values.
    • Shows save (Save) and clear (X) buttons when working with temporary or unsaved servers.
  • Dropdown Improvements:

    • Persist selected item when switching between servers.

    • Optimized UI messages:

      • Loading... when toolsCount is null.
      • No actions found when toolsCount === 0.
    • Fixes initial dropdown selection and fallback handling when no config is present.

  • Server Addition Modal:

    • Uses MAX_MCP_SERVER_NAME_LENGTH constant instead of hardcoded length validation.
  • MCP Server Query:

    • Split server fetch into two phases:

      1. Fast query without actionCount (for quick initial render).
      2. Async query with actionCount=true to enrich tool metadata.
    • Merged new data into cache using react-query and preserved prior values when possible.


Backend

  • API Endpoint /get_servers:

    • Added actionCount query param (default: False) to return minimal or full server data.
    • Optimized parallel fetching of server tool metadata only when required.
  • MCPToolsComponent:

    • Introduced cache mechanism via ComponentWithCache.
    • Centralized logic to update and store tool lists.
    • Caches tools, tool names, tool configs, and server metadata.
    • Returns consistent { tools, server_config } shape across update cycles.

Benefits

  • 🔄 Improved responsiveness on first load via staggered data fetching.
  • 💾 Cached tool data reduces repetitive network requests and improves build performance.
  • 🧪 Temporary server configuration supports better prototyping and live testing.
  • 🧼 Cleaner UI feedback and fallback handling.

Note

These updates are backward-compatible but assume that the consumers of the MCP component now treat the value as an object ({ name, config }) instead of just a string.

Summary by CodeRabbit

  • New Features

    • Added the ability to add new MCP servers directly from the interface, including support for saving server configurations and removing selections.
    • Enhanced server list to display a loading state for tools count while details are being fetched.
  • Improvements

    • Optimized MCP server data fetching for faster initial load and background updating of detailed server information.
    • Improved handling and display of server information with more flexible data structures and loading indicators.
    • MCP server name length limits are now managed via a shared constant for consistency.
  • Bug Fixes

    • Fixed issues with selection and reset logic when MCP server names or configurations change.
  • Refactor

    • Streamlined internal caching and retrieval of MCP server tools for improved efficiency and consistency.

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 18, 2025
@lucaseduoli lucaseduoli requested a review from mfortman11 June 18, 2025 23:51
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 18, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update introduces structured handling and caching of MCP server information, refactors server tool retrieval for efficiency, and updates the frontend to support adding, removing, and displaying MCP servers with more flexible data types and loading states. Type definitions and UI logic are aligned to support these backend changes and improve user experience.

Changes

File(s) Change Summary
src/backend/base/langflow/api/v2/mcp.py Added actionCount boolean parameter to get_servers endpoint; returns minimal server info if False, otherwise fetches detailed info including tools count and mode.
src/backend/base/langflow/components/data/mcp_component.py Refactored MCPToolsComponent to inherit from ComponentWithCache; reworked update_tool_list to support caching and return server config; updated method signatures and internal logic to propagate server info and handle new return types.
src/backend/base/langflow/inputs/inputs.py Changed McpInput.value from str to dict[str, Any], defaulting to an empty dict.
src/frontend/src/components/core/parameterRenderComponent/components/mcpComponent/index.tsx Refactored to handle value as { name, config } object; added support for adding/removing MCP servers; updated UI and handlers for config-based server addition; improved state synchronization and dropdown logic.
src/frontend/src/controllers/API/queries/mcp/use-get-mcp-servers.ts Enhanced hook to fetch server info in two stages (quick and detailed), merge cached and updated data, and handle loading states for tools count and mode.
src/frontend/src/modals/addMcpServerModal/index.tsx Replaced hardcoded server name length limits with a shared constant.
src/frontend/src/pages/SettingsPage/pages/MCPServersPage/index.tsx Updated UI to show "Loading..." when toolsCount is null instead of displaying a number.
src/frontend/src/types/mcp/index.ts Made id and description optional in MCPServerInfoType; added mode (string or null); made toolsCount optional and nullable.

Sequence Diagram(s)

sequenceDiagram
    participant UI as Frontend UI
    participant API as Backend API
    participant DB as Database/Cache

    UI->>API: GET /servers?actionCount=false
    API-->>UI: List of servers (name, mode: null, toolsCount: null)
    UI->>API: GET /servers?actionCount=true (async)
    API->>DB: Fetch/update tools for each server
    API-->>UI: List of servers (name, mode, toolsCount)
    UI->>UI: Merge detailed info into cache/display
Loading
sequenceDiagram
    participant User
    participant UI as MCPComponent
    participant API as Backend API

    User->>UI: Enter server name/config
    UI->>API: Add MCP server (if not exists)
    API-->>UI: Confirmation/updated server list
    UI->>UI: Update dropdown/options
    User->>UI: Select or remove server
    UI->>UI: Update value and propagate state
Loading

Suggested labels

bug, enhancement, size:M, lgtm

Suggested reviewers

  • Cristhianzl
  • mfortman11
  • deon-sanchez
  • edwinjosechittilappilly
✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch fix/mcp_speed

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@lucaseduoli lucaseduoli self-assigned this Jun 18, 2025
@lucaseduoli lucaseduoli requested a review from deon-sanchez June 18, 2025 23:52
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 18, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (2)
src/frontend/src/controllers/API/queries/mcp/use-get-mcp-servers.ts (2)

8-10: Remove commented code for cleaner codebase.

The commented lines should be removed to improve code cleanliness and maintainability.

-// This type is now updated to allow nulls for mode/toolsCount
-// type getMCPServersResponse = Array<MCPServerInfoType>;
-

62-78: Consider race condition handling in the second fetch useEffect.

The useEffect correctly triggers the second fetch, but consider what happens if the component unmounts or if multiple rapid changes occur to queryResult.data. Adding cleanup or debouncing might be beneficial.

Consider adding cleanup to prevent memory leaks:

 useEffect(() => {
+  let isCancelled = false;
   if (queryResult.data && queryResult.data.length > 0) {
     fetchWithCounts().then((countsData) => {
-      if (!countsData || countsData.length === 0) return;
+      if (isCancelled || !countsData || countsData.length === 0) return;
       // Merge by name
       queryClient.setQueryData(
         ["useGetMCPServers"],
         (oldData: getMCPServersResponse = []) => {
           return oldData.map((server) => {
             const updated = countsData.find((s) => s.name === server.name);
             return updated ? { ...server, ...updated } : server;
           });
         },
       );
     });
   }
+  return () => {
+    isCancelled = true;
+  };
 }, [queryResult.data]);
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 24e7acf and 5af1020.

📒 Files selected for processing (8)
  • src/backend/base/langflow/api/v2/mcp.py (1 hunks)
  • src/backend/base/langflow/components/data/mcp_component.py (11 hunks)
  • src/backend/base/langflow/inputs/inputs.py (1 hunks)
  • src/frontend/src/components/core/parameterRenderComponent/components/mcpComponent/index.tsx (3 hunks)
  • src/frontend/src/controllers/API/queries/mcp/use-get-mcp-servers.ts (2 hunks)
  • src/frontend/src/modals/addMcpServerModal/index.tsx (4 hunks)
  • src/frontend/src/pages/SettingsPage/pages/MCPServersPage/index.tsx (1 hunks)
  • src/frontend/src/types/mcp/index.ts (1 hunks)
🧰 Additional context used
🪛 GitHub Check: Ruff Style Check (3.13)
src/backend/base/langflow/api/v2/mcp.py

[failure] 104-104: Ruff (N803)
src/backend/base/langflow/api/v2/mcp.py:104:5: N803 Argument name actionCount should be lowercase


[failure] 104-104: Ruff (FBT002)
src/backend/base/langflow/api/v2/mcp.py:104:5: FBT002 Boolean default positional argument in function definition


[failure] 104-104: Ruff (FBT001)
src/backend/base/langflow/api/v2/mcp.py:104:5: FBT001 Boolean-typed positional argument in function definition

🪛 Ruff (0.11.9)
src/backend/base/langflow/api/v2/mcp.py

104-104: Boolean-typed positional argument in function definition

(FBT001)


104-104: Boolean default positional argument in function definition

(FBT002)


104-104: Argument name actionCount should be lowercase

(N803)

🪛 GitHub Actions: Ruff Style Check
src/backend/base/langflow/api/v2/mcp.py

[error] 104-104: Ruff: FBT001 Boolean-typed positional argument in function definition.

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Optimize new Python code in this PR
🔇 Additional comments (15)
src/frontend/src/pages/SettingsPage/pages/MCPServersPage/index.tsx (1)

105-107: LGTM: Proper loading state handling for tools count.

The conditional rendering correctly handles the null state for toolsCount by displaying "Loading..." during the initial fetch phase, then showing the formatted count with proper pluralization once the data is available.

src/frontend/src/modals/addMcpServerModal/index.tsx (2)

15-15: LGTM: Good practice using named constant.

Importing the MAX_MCP_SERVER_NAME_LENGTH constant centralizes the configuration and improves maintainability.


138-138: LGTM: Consistent replacement of magic numbers.

All three usages properly replace the hardcoded length limit of 30 with the named constant, ensuring consistency across STDIO, SSE, and JSON parsing workflows.

Also applies to: 172-172, 206-206

src/backend/base/langflow/inputs/inputs.py (1)

636-636: LGTM: Type evolution supports structured MCP data.

Changing the value type from str to dict[str, Any] aligns with the broader changes to handle MCP server information as structured objects containing both name and configuration, rather than simple string identifiers.

src/frontend/src/types/mcp/index.ts (1)

12-12: LGTM: Type definitions support flexible loading states.

Making id and description optional and adding nullable mode and toolsCount fields properly reflects the two-phase data fetching strategy where these fields are initially null during fast loading and populated later with detailed information.

Also applies to: 14-17

src/backend/base/langflow/api/v2/mcp.py (2)

111-113: LGTM: Efficient two-phase loading implementation.

The fast path correctly returns lightweight server information with null values for mode and toolsCount, enabling quick initial rendering while detailed data is fetched asynchronously.


117-117: LGTM: Proper initialization with null values.

Initializing mode and toolsCount as None aligns with the type definitions and supports the loading state pattern implemented in the frontend.

src/frontend/src/controllers/API/queries/mcp/use-get-mcp-servers.ts (1)

25-38: Verify caching merge logic handles edge cases correctly.

The caching merge logic looks correct but could benefit from additional safeguards. Consider edge cases where server names might change or cached data becomes stale.

Run the following script to verify the merge logic handles various data scenarios:

#!/bin/bash
# Description: Check if there are any tests for the caching merge logic
# Expected: Find test files that cover the merge scenarios

rg -A 10 -B 5 "merge.*cached" --type ts
rg -A 10 -B 5 "toolsCount.*null" --type ts
src/frontend/src/components/core/parameterRenderComponent/components/mcpComponent/index.tsx (3)

36-39: Good implementation of structured value handling.

The destructuring of the value prop into name and config with appropriate fallbacks is well implemented and supports the new data structure requirements.


24-29: Excellent loading state handling for async tool counts.

The conditional rendering for toolsCount states (null for "Loading...", 0 for "No actions found") provides clear user feedback and aligns well with the two-step fetching approach in the API hook.


114-116: I’ll retry searching for any tests that reference showSaveButton using proper glob patterns:

#!/bin/bash
# Description: Search for test cases covering showSaveButton logic
rg -A 5 -B 5 "showSaveButton" --glob "*.test.tsx" --glob "*.test.ts" --glob "*.spec.tsx" --glob "*.spec.ts"
src/backend/base/langflow/components/data/mcp_component.py (4)

63-63: Good architectural improvement with ComponentWithCache inheritance.

Inheriting from ComponentWithCache provides the necessary caching infrastructure for the enhanced MCP server handling. This aligns well with the PR objectives of implementing cached values.


140-152: Well-structured method signature update for flexible input handling.

The updated update_tool_list method correctly handles both dict and string inputs for mcp_server_value, providing backward compatibility while supporting the new structured data format.


177-183: Good fallback logic for server configuration handling.

The logic to use server_config_from_value when get_server returns empty is well-implemented and supports temporary server configurations as mentioned in the PR objectives.


218-218: Verify method call consistency throughout the codebase.

All internal method calls have been updated to handle the new return signature of update_tool_list. Ensure that any external consumers of this class are also updated to handle the new return format.

#!/bin/bash
# Description: Find external usages of update_tool_list to ensure compatibility
# Expected: Find any external calls that might need updating

rg -A 3 -B 3 "update_tool_list" --type py
rg -A 3 -B 3 "MCPToolsComponent" --type py

Comment thread src/backend/base/langflow/api/v2/mcp.py Outdated
session: DbSession,
storage_service=Depends(get_storage_service),
settings_service=Depends(get_settings_service),
actionCount: bool = False,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Fix parameter naming and consider boolean parameter pattern.

The functionality is correct, but there are style concerns:

  1. Parameter name should follow Python convention: action_count instead of actionCount
  2. Boolean parameters can be error-prone and confusing

Apply this fix for the naming convention:

-    actionCount: bool = False,
+    action_count: bool = False,

And update the usage:

-    if not actionCount:
+    if not action_count:

Consider using an enum or query parameter with string values like detail_level: Literal["basic", "full"] = "basic" for better API clarity.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
actionCount: bool = False,
- actionCount: bool = False,
+ action_count: bool = False,
- if not actionCount:
+ if not action_count:
🧰 Tools
🪛 GitHub Check: Ruff Style Check (3.13)

[failure] 104-104: Ruff (N803)
src/backend/base/langflow/api/v2/mcp.py:104:5: N803 Argument name actionCount should be lowercase


[failure] 104-104: Ruff (FBT002)
src/backend/base/langflow/api/v2/mcp.py:104:5: FBT002 Boolean default positional argument in function definition


[failure] 104-104: Ruff (FBT001)
src/backend/base/langflow/api/v2/mcp.py:104:5: FBT001 Boolean-typed positional argument in function definition

🪛 Ruff (0.11.9)

104-104: Boolean-typed positional argument in function definition

(FBT001)


104-104: Boolean default positional argument in function definition

(FBT002)


104-104: Argument name actionCount should be lowercase

(N803)

🪛 GitHub Actions: Ruff Style Check

[error] 104-104: Ruff: FBT001 Boolean-typed positional argument in function definition.

🤖 Prompt for AI Agents
In src/backend/base/langflow/api/v2/mcp.py at line 104, rename the parameter
from actionCount to action_count to follow Python naming conventions.
Additionally, replace the boolean parameter with a clearer alternative such as
an enum or a string literal parameter like detail_level with possible values
"basic" or "full" to improve API clarity and reduce confusion. Update all usages
of this parameter accordingly to reflect the new name and type.

Comment on lines +86 to +98
const handleSaveButtonClick = () => {
addMcpServer(
{
name,
...(config ?? {}),
},
{
onSuccess: () => {
handleSuccess(name);
},
},
);
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add error handling for server addition failures.

The save functionality calls addMcpServer but only handles the success case. Consider adding error handling to provide user feedback when server addition fails.

 const handleSaveButtonClick = () => {
   addMcpServer(
     {
       name,
       ...(config ?? {}),
     },
     {
       onSuccess: () => {
         handleSuccess(name);
       },
+      onError: (error) => {
+        console.error("Failed to add MCP server:", error);
+        // Consider showing a toast/notification to the user
+      },
     },
   );
 };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const handleSaveButtonClick = () => {
addMcpServer(
{
name,
...(config ?? {}),
},
{
onSuccess: () => {
handleSuccess(name);
},
},
);
};
const handleSaveButtonClick = () => {
addMcpServer(
{
name,
...(config ?? {}),
},
{
onSuccess: () => {
handleSuccess(name);
},
onError: (error) => {
console.error("Failed to add MCP server:", error);
// Consider showing a toast/notification to the user
},
},
);
};
🤖 Prompt for AI Agents
In
src/frontend/src/components/core/parameterRenderComponent/components/mcpComponent/index.tsx
around lines 86 to 98, the handleSaveButtonClick function calls addMcpServer but
only handles the success callback. To fix this, add an onError callback to the
addMcpServer call that handles failure cases, such as displaying an error
message to the user or logging the error, to provide proper feedback when the
server addition fails.

Comment on lines +196 to +204
self._shared_component_cache.set(
server_name,
{
"tools": tool_list,
"tool_names": self.tool_names,
"tool_cache": tool_cache,
"config": server_config,
},
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Ensure cache storage uses consistent key strategy.

The cache storage should use the same key strategy as cache retrieval. If you implement the config-based cache key suggestion above, make sure to apply it here as well.

Apply the same cache key strategy for storage:

-                self._shared_component_cache.set(
-                    server_name,
+                self._shared_component_cache.set(
+                    cache_key,
                     {
                         "tools": tool_list,
                         "tool_names": self.tool_names,
                         "tool_cache": tool_cache,
                         "config": server_config,
                     },
                 )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
self._shared_component_cache.set(
server_name,
{
"tools": tool_list,
"tool_names": self.tool_names,
"tool_cache": tool_cache,
"config": server_config,
},
)
self._shared_component_cache.set(
cache_key,
{
"tools": tool_list,
"tool_names": self.tool_names,
"tool_cache": tool_cache,
"config": server_config,
},
)
🤖 Prompt for AI Agents
In src/backend/base/langflow/components/data/mcp_component.py around lines 196
to 204, the cache storage uses a key that is inconsistent with the cache
retrieval key strategy. To fix this, update the key used in the
self._shared_component_cache.set call to match the config-based cache key
approach used for retrieval, ensuring both storage and retrieval use the same
key format for consistency.

Comment on lines +155 to +161
cached = self._shared_component_cache.get(server_name)
if not isinstance(cached, CacheMiss):
self.tools = cached["tools"]
self.tool_names = cached["tool_names"]
self._tool_cache = cached["tool_cache"]
server_config_from_value = cached["config"]
return self.tools, {"name": server_name, "config": server_config_from_value}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Verify cache invalidation strategy for server configuration changes.

The caching implementation looks solid, but consider how the cache should be invalidated when server configurations change. Currently, the cache key is only based on server name, which might not account for configuration updates.

Consider including a hash of the configuration in the cache key to ensure cache invalidation when configs change:

-        cached = self._shared_component_cache.get(server_name)
+        config_hash = hash(str(sorted((server_config_from_value or {}).items())))
+        cache_key = f"{server_name}_{config_hash}"
+        cached = self._shared_component_cache.get(cache_key)
         if not isinstance(cached, CacheMiss):
             self.tools = cached["tools"]
             self.tool_names = cached["tool_names"]
             self._tool_cache = cached["tool_cache"]
             server_config_from_value = cached["config"]
             return self.tools, {"name": server_name, "config": server_config_from_value}

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/backend/base/langflow/components/data/mcp_component.py around lines 155
to 161, the cache key currently uses only the server name, which risks stale
data if server configurations change. To fix this, modify the cache key to
include a hash or checksum of the server configuration alongside the server
name. This ensures that when configurations update, the cache key changes,
triggering proper cache invalidation and reloading of fresh data.

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 20, 2025
@Cristhianzl
Copy link
Copy Markdown
Member

image

tested and working!

@Cristhianzl
Copy link
Copy Markdown
Member

lgtm

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 20, 2025
@github-actions github-actions Bot removed the bug Something isn't working label Jun 20, 2025
@github-actions github-actions Bot added the bug Something isn't working label Jun 20, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 20, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 20, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 20, 2025
@lucaseduoli lucaseduoli added this pull request to the merge queue Jun 21, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 21, 2025
@Cristhianzl Cristhianzl added this pull request to the merge queue Jun 23, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 23, 2025
@lucaseduoli lucaseduoli added this pull request to the merge queue Jun 23, 2025
Merged via the queue into main with commit 4a09655 Jun 23, 2025
66 checks passed
@lucaseduoli lucaseduoli deleted the fix/mcp_speed branch June 23, 2025 14:38
Yukiyukiyeah pushed a commit that referenced this pull request Jun 23, 2025
…nent (#8628)

* Added actionCount to fetch only servers without actionCount

* Updated queries and uses to use servers without action data first, and then to fetch them

* removed comment

* updated constants

* Added loading dropdown

* Make options persist

* Implemented new value format for McpComponent and implemented saving and removing temp Mcp Server if config is existent

* Changed value type

* Implemented cache and saving the server config

* Fixed mcp server test

* fix backend formatting

* fixed lint

* Added await

* Fixed save button not appearing when no servers are available

* added condition to only show save button when options is not null
github-merge-queue Bot pushed a commit that referenced this pull request Jun 23, 2025
* Update Vector Store RAG.json

* fix: make starter projects auto refactor not remove selected output (#8400)

* Fixed bug where starter projects were refactored incorrectly

* fix: improve handling of selected outputs in custom component template builder

- Added checks to ensure selected output is valid before attempting to set its state.
- Enhanced code readability with comments explaining the logic for selecting outputs.

* Set selected output as the previous selected output

* Update base.py

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* fix: made clean edges clean after changing dropdown of output (#8460)

fixed output considering all outputs not just selected one

* refactor(docker): remove --extra deploy flag from uv sync commands (#8485)

🔧 (build_and_push_with_extras.Dockerfile): remove unnecessary uv sync command options to improve build efficiency and reduce redundancy

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* fix: refactor mcp and freeze tests to be less prone to flaky results (#8486)

* Fixed mcp test to be less prone to errors

* Fix freeze spec

* fix: made button disabled state more congruent, made edit flow details submit on enter (#8339)

* Changed textarea classes

* Changed flowsettingscomponent to use form

* changed edit flow settings to use form and to submit on enter

* Reset form data on close

* Updated disabled state to have lower opacity instead of to have set background

* Fixed loading state of button

* Fix: chat memory store issue and fix output types (#8463)

* fix chat memory

* update template

* update update outputs

* update update outputs

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* ci: update setup-uv to possibly fix caching (#8490)

* update templates

* update templates

* First round of template updates

* Update templates

* fix: Update SaaS, Social Media, and YouTube json file (#8441)

* update SaaS, Social Media, and YouTube json file

* fix: make starter projects auto refactor not remove selected output (#8400)

* Fixed bug where starter projects were refactored incorrectly

* fix: improve handling of selected outputs in custom component template builder

- Added checks to ensure selected output is valid before attempting to set its state.
- Enhanced code readability with comments explaining the logic for selecting outputs.

* Set selected output as the previous selected output

* Update base.py

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* fix: made clean edges clean after changing dropdown of output (#8460)

fixed output considering all outputs not just selected one

* refactor(docker): remove --extra deploy flag from uv sync commands (#8485)

🔧 (build_and_push_with_extras.Dockerfile): remove unnecessary uv sync command options to improve build efficiency and reduce redundancy

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* fix: refactor mcp and freeze tests to be less prone to flaky results (#8486)

* Fixed mcp test to be less prone to errors

* Fix freeze spec

* fix: made button disabled state more congruent, made edit flow details submit on enter (#8339)

* Changed textarea classes

* Changed flowsettingscomponent to use form

* changed edit flow settings to use form and to submit on enter

* Reset form data on close

* Updated disabled state to have lower opacity instead of to have set background

* Fixed loading state of button

* Fix: chat memory store issue and fix output types (#8463)

* fix chat memory

* update template

* update update outputs

* update update outputs

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* ci: update setup-uv to possibly fix caching (#8490)

* update json

* fix custom component

* revert change

---------

Co-authored-by: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: Cristhian Zanforlin Lousa <cristhian.lousa@gmail.com>

* fix: templates (#8499)

* basic-prompting-template-updated

* show-system-message

* names

* blog-writer-tested

* financial-report-parser

* image-sentiment-analysis

* seo-keyword-generator

* seo-keyword-generator

* Merge branch 'fix-vector-search-template' into mendons-template-branch

---------

Co-authored-by: Eric Hare <ericrhare@gmail.com>

* Update Basic Prompting.json

* Update Blog Writer.json

* Further template updates

* Update Image Sentiment Analysis.json

* Update templates

* Update Financial Report Parser.json

* Update Market Research.json

* Update Market Research.json

* update several templates

* Update Image Sentiment Analysis.json

* Update Market Research.json

* Update image sentiment analysis template

* Update Market Research.json

* Update Custom Component Maker.json

* Update Custom Component Maker.json

* Update Hybrid Search RAG.json

* Update Hybrid Search RAG.json

* Update Hybrid Search RAG.json

* More template updates

* Update Financial Report Parser.json

* updated templates

* change custom component maker

* Update Twitter Thread Generator.json

* updates from main

* change model

* Update Research Translation Loop.json

* expanded output component to fix tests

* update template

* autofix

* fix error

* fix change back

* change back

* ci: Skip truncated values test for refactoring (#8670)

* refactor: simplify init target by removing cache cleanup and adding pre-commit hook (#8590)

* build: add pyyaml dependency

* refactor: simplify init command by removing cache cleaning and langflow run call

* refactor: simplify init target by removing cache cleanup and adding pre-commit hook

* refactor: update langchain_core.prompts import paths to use specific modules

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* feat: update structured output to multiline input and revise system prompt (#8585)

* Update structured_output.py

* [autofix.ci] apply automated fixes

* Update structured_output.py

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* update to prompt

* template updates

* Update src/backend/base/langflow/components/processing/structured_output.py

* [autofix.ci] apply automated fixes

* Update src/backend/base/langflow/components/processing/structured_output.py

* Update src/backend/base/langflow/components/processing/structured_output.py

* Update src/backend/base/langflow/components/processing/structured_output.py

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* feat: add sessions endpoint with session management enhancements (#8596)

* 📝 (monitor.py): Add endpoint to get sessions and handle session_id encoding for API requests
📝 (use-get-messages-mutation.ts): Implement a mutation function to fetch messages with query parameters and handle session_id encoding for API requests
📝 (use-get-messages-polling.ts): Ensure proper encoding of session_id for API requests in polling mutation
📝 (use-get-messages.ts): Handle session_id encoding for API requests in messages query
📝 (new-modal.tsx): Implement functions to handle session deletion and proper encoding of session_id for API requests
📝 (utils.ts): Add functions to encode, decode, validate, format, and prepare session IDs for API requests

* 📝 (constants.ts): Add SESSIONS constant to API URLs for monitoring sessions
🔧 (use-delete-messages.ts): Add queryClient to UseRequestProcessor to invalidate sessions query
✨ (use-get-sessions-from-flow.ts): Introduce useGetSessionsFromFlowQuery to fetch sessions from flow
🔧 (use-rename-session.ts): Change refetchQueries to invalidateQueries for useGetSessionsFromFlowQuery
🔧 (custom-new-modal.tsx): Update import path for IOModal to playground-modal
🔧 (session-selector.tsx): Add setActiveSession function to handle setting active session
🔧 (sidebar-open-view.tsx): Add setActiveSession function to handle setting active session
♻️ (new-modal.tsx): Refactor IOModal into playground-modal and update functionality
♻️ (playground-modal.tsx): Refactor IOModal to handle playground-specific functionality
⬆️ (flowStore.ts): Add newChatOnPlayground state and setNewChatOnPlayground function
⬆️ (index.ts): Update FlowStoreType to include newChatOnPlayground and setNewChatOnPlayground

* 🔧 (pyproject.toml): update testpaths to point to the correct directory for tests
✨ (test_session_endpoint.py): add unit tests for sessions endpoint with flow_id filtering
♻️ (session-selector.tsx): refactor to trim editedSession before setting it
♻️ (sidebar-open-view.tsx): refactor to set visibleSession instead of activeSession

* ✨ (use-get-sessions-from-flow.ts): Always include the flow ID as the default session if it's not already present
♻️ (playground-modal.tsx): Refactor setting sessions to include currentFlowId as the default session if not present, and handle visibility of sessions more efficiently

* ♻️ (use-get-messages-mutation.ts): remove unused imports and refactor code for better readability and maintainability

* ✨ (test_session_endpoint.py): refactor test function names for better clarity and consistency

* ✨ (create-new-session-name.ts): add function to generate a new session name based on the current date and time
🔧 (playground-modal.tsx): import createNewSessionName function to dynamically set a new session name when no session is visible

* [autofix.ci] apply automated fixes

* ✨ (monitor.py): rename get_sessions endpoint to get_message_sessions for clarity and consistency
🔧 (constants.ts): remove unused SESSIONS constant from API URLs
🔧 (use-delete-messages.ts): remove commented out code and unnecessary comments
✨ (use-delete-sessions.ts): add functionality to delete sessions in frontend
🔧 (use-get-sessions-from-flow.ts): update API endpoint for getting sessions to match backend changes
🔧 (playground-modal.tsx): add functionality to delete sessions and associated messages in the UI, update UI optimistically, and handle errors appropriately

* [autofix.ci] apply automated fixes

* 🐛 (monitor.py): Fix type hinting issue in delete_messages function
📝 (monitor.py): Add comments and improve readability in test_messages_endpoints.py
📝 (session_endpoint.py): Update endpoint paths for consistency and clarity in test_session_endpoint.py

* [autofix.ci] apply automated fixes

* fix: update SQL statement to use col() for session_id filtering in get_message_sessions function

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* fix: implemented cached values and temporary MCP servers on MCP component (#8628)

* Added actionCount to fetch only servers without actionCount

* Updated queries and uses to use servers without action data first, and then to fetch them

* removed comment

* updated constants

* Added loading dropdown

* Make options persist

* Implemented new value format for McpComponent and implemented saving and removing temp Mcp Server if config is existent

* Changed value type

* Implemented cache and saving the server config

* Fixed mcp server test

* fix backend formatting

* fixed lint

* Added await

* Fixed save button not appearing when no servers are available

* added condition to only show save button when options is not null

* template autofix

* change template

* update text sentiment analysis

* change basic prompt back

* change image sentiment back

* update text sentiment and twitter

* Update Twitter Thread Generator.json

* Add back the input for the chat

* add change

* fix text sentiment

* update research translation

* Update Research Translation Loop.json

---------

Co-authored-by: Eric Hare <ericrhare@gmail.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Cristhian Zanforlin Lousa <cristhian.lousa@gmail.com>
Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
ogabrielluiz pushed a commit to bkatya2001/langflow that referenced this pull request Jun 24, 2025
…nent (langflow-ai#8628)

* Added actionCount to fetch only servers without actionCount

* Updated queries and uses to use servers without action data first, and then to fetch them

* removed comment

* updated constants

* Added loading dropdown

* Make options persist

* Implemented new value format for McpComponent and implemented saving and removing temp Mcp Server if config is existent

* Changed value type

* Implemented cache and saving the server config

* Fixed mcp server test

* fix backend formatting

* fixed lint

* Added await

* Fixed save button not appearing when no servers are available

* added condition to only show save button when options is not null
ogabrielluiz added a commit to bkatya2001/langflow that referenced this pull request Jun 24, 2025
* Update Vector Store RAG.json

* fix: make starter projects auto refactor not remove selected output (langflow-ai#8400)

* Fixed bug where starter projects were refactored incorrectly

* fix: improve handling of selected outputs in custom component template builder

- Added checks to ensure selected output is valid before attempting to set its state.
- Enhanced code readability with comments explaining the logic for selecting outputs.

* Set selected output as the previous selected output

* Update base.py

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* fix: made clean edges clean after changing dropdown of output (langflow-ai#8460)

fixed output considering all outputs not just selected one

* refactor(docker): remove --extra deploy flag from uv sync commands (langflow-ai#8485)

🔧 (build_and_push_with_extras.Dockerfile): remove unnecessary uv sync command options to improve build efficiency and reduce redundancy

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* fix: refactor mcp and freeze tests to be less prone to flaky results (langflow-ai#8486)

* Fixed mcp test to be less prone to errors

* Fix freeze spec

* fix: made button disabled state more congruent, made edit flow details submit on enter (langflow-ai#8339)

* Changed textarea classes

* Changed flowsettingscomponent to use form

* changed edit flow settings to use form and to submit on enter

* Reset form data on close

* Updated disabled state to have lower opacity instead of to have set background

* Fixed loading state of button

* Fix: chat memory store issue and fix output types (langflow-ai#8463)

* fix chat memory

* update template

* update update outputs

* update update outputs

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* ci: update setup-uv to possibly fix caching (langflow-ai#8490)

* update templates

* update templates

* First round of template updates

* Update templates

* fix: Update SaaS, Social Media, and YouTube json file (langflow-ai#8441)

* update SaaS, Social Media, and YouTube json file

* fix: make starter projects auto refactor not remove selected output (langflow-ai#8400)

* Fixed bug where starter projects were refactored incorrectly

* fix: improve handling of selected outputs in custom component template builder

- Added checks to ensure selected output is valid before attempting to set its state.
- Enhanced code readability with comments explaining the logic for selecting outputs.

* Set selected output as the previous selected output

* Update base.py

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* fix: made clean edges clean after changing dropdown of output (langflow-ai#8460)

fixed output considering all outputs not just selected one

* refactor(docker): remove --extra deploy flag from uv sync commands (langflow-ai#8485)

🔧 (build_and_push_with_extras.Dockerfile): remove unnecessary uv sync command options to improve build efficiency and reduce redundancy

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* fix: refactor mcp and freeze tests to be less prone to flaky results (langflow-ai#8486)

* Fixed mcp test to be less prone to errors

* Fix freeze spec

* fix: made button disabled state more congruent, made edit flow details submit on enter (langflow-ai#8339)

* Changed textarea classes

* Changed flowsettingscomponent to use form

* changed edit flow settings to use form and to submit on enter

* Reset form data on close

* Updated disabled state to have lower opacity instead of to have set background

* Fixed loading state of button

* Fix: chat memory store issue and fix output types (langflow-ai#8463)

* fix chat memory

* update template

* update update outputs

* update update outputs

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* ci: update setup-uv to possibly fix caching (langflow-ai#8490)

* update json

* fix custom component

* revert change

---------

Co-authored-by: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: Cristhian Zanforlin Lousa <cristhian.lousa@gmail.com>

* fix: templates (langflow-ai#8499)

* basic-prompting-template-updated

* show-system-message

* names

* blog-writer-tested

* financial-report-parser

* image-sentiment-analysis

* seo-keyword-generator

* seo-keyword-generator

* Merge branch 'fix-vector-search-template' into mendons-template-branch

---------

Co-authored-by: Eric Hare <ericrhare@gmail.com>

* Update Basic Prompting.json

* Update Blog Writer.json

* Further template updates

* Update Image Sentiment Analysis.json

* Update templates

* Update Financial Report Parser.json

* Update Market Research.json

* Update Market Research.json

* update several templates

* Update Image Sentiment Analysis.json

* Update Market Research.json

* Update image sentiment analysis template

* Update Market Research.json

* Update Custom Component Maker.json

* Update Custom Component Maker.json

* Update Hybrid Search RAG.json

* Update Hybrid Search RAG.json

* Update Hybrid Search RAG.json

* More template updates

* Update Financial Report Parser.json

* updated templates

* change custom component maker

* Update Twitter Thread Generator.json

* updates from main

* change model

* Update Research Translation Loop.json

* expanded output component to fix tests

* update template

* autofix

* fix error

* fix change back

* change back

* ci: Skip truncated values test for refactoring (langflow-ai#8670)

* refactor: simplify init target by removing cache cleanup and adding pre-commit hook (langflow-ai#8590)

* build: add pyyaml dependency

* refactor: simplify init command by removing cache cleaning and langflow run call

* refactor: simplify init target by removing cache cleanup and adding pre-commit hook

* refactor: update langchain_core.prompts import paths to use specific modules

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* feat: update structured output to multiline input and revise system prompt (langflow-ai#8585)

* Update structured_output.py

* [autofix.ci] apply automated fixes

* Update structured_output.py

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* update to prompt

* template updates

* Update src/backend/base/langflow/components/processing/structured_output.py

* [autofix.ci] apply automated fixes

* Update src/backend/base/langflow/components/processing/structured_output.py

* Update src/backend/base/langflow/components/processing/structured_output.py

* Update src/backend/base/langflow/components/processing/structured_output.py

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* feat: add sessions endpoint with session management enhancements (langflow-ai#8596)

* 📝 (monitor.py): Add endpoint to get sessions and handle session_id encoding for API requests
📝 (use-get-messages-mutation.ts): Implement a mutation function to fetch messages with query parameters and handle session_id encoding for API requests
📝 (use-get-messages-polling.ts): Ensure proper encoding of session_id for API requests in polling mutation
📝 (use-get-messages.ts): Handle session_id encoding for API requests in messages query
📝 (new-modal.tsx): Implement functions to handle session deletion and proper encoding of session_id for API requests
📝 (utils.ts): Add functions to encode, decode, validate, format, and prepare session IDs for API requests

* 📝 (constants.ts): Add SESSIONS constant to API URLs for monitoring sessions
🔧 (use-delete-messages.ts): Add queryClient to UseRequestProcessor to invalidate sessions query
✨ (use-get-sessions-from-flow.ts): Introduce useGetSessionsFromFlowQuery to fetch sessions from flow
🔧 (use-rename-session.ts): Change refetchQueries to invalidateQueries for useGetSessionsFromFlowQuery
🔧 (custom-new-modal.tsx): Update import path for IOModal to playground-modal
🔧 (session-selector.tsx): Add setActiveSession function to handle setting active session
🔧 (sidebar-open-view.tsx): Add setActiveSession function to handle setting active session
♻️ (new-modal.tsx): Refactor IOModal into playground-modal and update functionality
♻️ (playground-modal.tsx): Refactor IOModal to handle playground-specific functionality
⬆️ (flowStore.ts): Add newChatOnPlayground state and setNewChatOnPlayground function
⬆️ (index.ts): Update FlowStoreType to include newChatOnPlayground and setNewChatOnPlayground

* 🔧 (pyproject.toml): update testpaths to point to the correct directory for tests
✨ (test_session_endpoint.py): add unit tests for sessions endpoint with flow_id filtering
♻️ (session-selector.tsx): refactor to trim editedSession before setting it
♻️ (sidebar-open-view.tsx): refactor to set visibleSession instead of activeSession

* ✨ (use-get-sessions-from-flow.ts): Always include the flow ID as the default session if it's not already present
♻️ (playground-modal.tsx): Refactor setting sessions to include currentFlowId as the default session if not present, and handle visibility of sessions more efficiently

* ♻️ (use-get-messages-mutation.ts): remove unused imports and refactor code for better readability and maintainability

* ✨ (test_session_endpoint.py): refactor test function names for better clarity and consistency

* ✨ (create-new-session-name.ts): add function to generate a new session name based on the current date and time
🔧 (playground-modal.tsx): import createNewSessionName function to dynamically set a new session name when no session is visible

* [autofix.ci] apply automated fixes

* ✨ (monitor.py): rename get_sessions endpoint to get_message_sessions for clarity and consistency
🔧 (constants.ts): remove unused SESSIONS constant from API URLs
🔧 (use-delete-messages.ts): remove commented out code and unnecessary comments
✨ (use-delete-sessions.ts): add functionality to delete sessions in frontend
🔧 (use-get-sessions-from-flow.ts): update API endpoint for getting sessions to match backend changes
🔧 (playground-modal.tsx): add functionality to delete sessions and associated messages in the UI, update UI optimistically, and handle errors appropriately

* [autofix.ci] apply automated fixes

* 🐛 (monitor.py): Fix type hinting issue in delete_messages function
📝 (monitor.py): Add comments and improve readability in test_messages_endpoints.py
📝 (session_endpoint.py): Update endpoint paths for consistency and clarity in test_session_endpoint.py

* [autofix.ci] apply automated fixes

* fix: update SQL statement to use col() for session_id filtering in get_message_sessions function

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* fix: implemented cached values and temporary MCP servers on MCP component (langflow-ai#8628)

* Added actionCount to fetch only servers without actionCount

* Updated queries and uses to use servers without action data first, and then to fetch them

* removed comment

* updated constants

* Added loading dropdown

* Make options persist

* Implemented new value format for McpComponent and implemented saving and removing temp Mcp Server if config is existent

* Changed value type

* Implemented cache and saving the server config

* Fixed mcp server test

* fix backend formatting

* fixed lint

* Added await

* Fixed save button not appearing when no servers are available

* added condition to only show save button when options is not null

* template autofix

* change template

* update text sentiment analysis

* change basic prompt back

* change image sentiment back

* update text sentiment and twitter

* Update Twitter Thread Generator.json

* Add back the input for the chat

* add change

* fix text sentiment

* update research translation

* Update Research Translation Loop.json

---------

Co-authored-by: Eric Hare <ericrhare@gmail.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Cristhian Zanforlin Lousa <cristhian.lousa@gmail.com>
Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Khurdhula-Harshavardhan pushed a commit to JigsawStack/langflow that referenced this pull request Jul 1, 2025
…nent (langflow-ai#8628)

* Added actionCount to fetch only servers without actionCount

* Updated queries and uses to use servers without action data first, and then to fetch them

* removed comment

* updated constants

* Added loading dropdown

* Make options persist

* Implemented new value format for McpComponent and implemented saving and removing temp Mcp Server if config is existent

* Changed value type

* Implemented cache and saving the server config

* Fixed mcp server test

* fix backend formatting

* fixed lint

* Added await

* Fixed save button not appearing when no servers are available

* added condition to only show save button when options is not null
Khurdhula-Harshavardhan pushed a commit to JigsawStack/langflow that referenced this pull request Jul 1, 2025
* Update Vector Store RAG.json

* fix: make starter projects auto refactor not remove selected output (langflow-ai#8400)

* Fixed bug where starter projects were refactored incorrectly

* fix: improve handling of selected outputs in custom component template builder

- Added checks to ensure selected output is valid before attempting to set its state.
- Enhanced code readability with comments explaining the logic for selecting outputs.

* Set selected output as the previous selected output

* Update base.py

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* fix: made clean edges clean after changing dropdown of output (langflow-ai#8460)

fixed output considering all outputs not just selected one

* refactor(docker): remove --extra deploy flag from uv sync commands (langflow-ai#8485)

🔧 (build_and_push_with_extras.Dockerfile): remove unnecessary uv sync command options to improve build efficiency and reduce redundancy

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* fix: refactor mcp and freeze tests to be less prone to flaky results (langflow-ai#8486)

* Fixed mcp test to be less prone to errors

* Fix freeze spec

* fix: made button disabled state more congruent, made edit flow details submit on enter (langflow-ai#8339)

* Changed textarea classes

* Changed flowsettingscomponent to use form

* changed edit flow settings to use form and to submit on enter

* Reset form data on close

* Updated disabled state to have lower opacity instead of to have set background

* Fixed loading state of button

* Fix: chat memory store issue and fix output types (langflow-ai#8463)

* fix chat memory

* update template

* update update outputs

* update update outputs

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* ci: update setup-uv to possibly fix caching (langflow-ai#8490)

* update templates

* update templates

* First round of template updates

* Update templates

* fix: Update SaaS, Social Media, and YouTube json file (langflow-ai#8441)

* update SaaS, Social Media, and YouTube json file

* fix: make starter projects auto refactor not remove selected output (langflow-ai#8400)

* Fixed bug where starter projects were refactored incorrectly

* fix: improve handling of selected outputs in custom component template builder

- Added checks to ensure selected output is valid before attempting to set its state.
- Enhanced code readability with comments explaining the logic for selecting outputs.

* Set selected output as the previous selected output

* Update base.py

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* fix: made clean edges clean after changing dropdown of output (langflow-ai#8460)

fixed output considering all outputs not just selected one

* refactor(docker): remove --extra deploy flag from uv sync commands (langflow-ai#8485)

🔧 (build_and_push_with_extras.Dockerfile): remove unnecessary uv sync command options to improve build efficiency and reduce redundancy

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* fix: refactor mcp and freeze tests to be less prone to flaky results (langflow-ai#8486)

* Fixed mcp test to be less prone to errors

* Fix freeze spec

* fix: made button disabled state more congruent, made edit flow details submit on enter (langflow-ai#8339)

* Changed textarea classes

* Changed flowsettingscomponent to use form

* changed edit flow settings to use form and to submit on enter

* Reset form data on close

* Updated disabled state to have lower opacity instead of to have set background

* Fixed loading state of button

* Fix: chat memory store issue and fix output types (langflow-ai#8463)

* fix chat memory

* update template

* update update outputs

* update update outputs

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* ci: update setup-uv to possibly fix caching (langflow-ai#8490)

* update json

* fix custom component

* revert change

---------

Co-authored-by: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: Cristhian Zanforlin Lousa <cristhian.lousa@gmail.com>

* fix: templates (langflow-ai#8499)

* basic-prompting-template-updated

* show-system-message

* names

* blog-writer-tested

* financial-report-parser

* image-sentiment-analysis

* seo-keyword-generator

* seo-keyword-generator

* Merge branch 'fix-vector-search-template' into mendons-template-branch

---------

Co-authored-by: Eric Hare <ericrhare@gmail.com>

* Update Basic Prompting.json

* Update Blog Writer.json

* Further template updates

* Update Image Sentiment Analysis.json

* Update templates

* Update Financial Report Parser.json

* Update Market Research.json

* Update Market Research.json

* update several templates

* Update Image Sentiment Analysis.json

* Update Market Research.json

* Update image sentiment analysis template

* Update Market Research.json

* Update Custom Component Maker.json

* Update Custom Component Maker.json

* Update Hybrid Search RAG.json

* Update Hybrid Search RAG.json

* Update Hybrid Search RAG.json

* More template updates

* Update Financial Report Parser.json

* updated templates

* change custom component maker

* Update Twitter Thread Generator.json

* updates from main

* change model

* Update Research Translation Loop.json

* expanded output component to fix tests

* update template

* autofix

* fix error

* fix change back

* change back

* ci: Skip truncated values test for refactoring (langflow-ai#8670)

* refactor: simplify init target by removing cache cleanup and adding pre-commit hook (langflow-ai#8590)

* build: add pyyaml dependency

* refactor: simplify init command by removing cache cleaning and langflow run call

* refactor: simplify init target by removing cache cleanup and adding pre-commit hook

* refactor: update langchain_core.prompts import paths to use specific modules

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* feat: update structured output to multiline input and revise system prompt (langflow-ai#8585)

* Update structured_output.py

* [autofix.ci] apply automated fixes

* Update structured_output.py

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* update to prompt

* template updates

* Update src/backend/base/langflow/components/processing/structured_output.py

* [autofix.ci] apply automated fixes

* Update src/backend/base/langflow/components/processing/structured_output.py

* Update src/backend/base/langflow/components/processing/structured_output.py

* Update src/backend/base/langflow/components/processing/structured_output.py

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* feat: add sessions endpoint with session management enhancements (langflow-ai#8596)

* 📝 (monitor.py): Add endpoint to get sessions and handle session_id encoding for API requests
📝 (use-get-messages-mutation.ts): Implement a mutation function to fetch messages with query parameters and handle session_id encoding for API requests
📝 (use-get-messages-polling.ts): Ensure proper encoding of session_id for API requests in polling mutation
📝 (use-get-messages.ts): Handle session_id encoding for API requests in messages query
📝 (new-modal.tsx): Implement functions to handle session deletion and proper encoding of session_id for API requests
📝 (utils.ts): Add functions to encode, decode, validate, format, and prepare session IDs for API requests

* 📝 (constants.ts): Add SESSIONS constant to API URLs for monitoring sessions
🔧 (use-delete-messages.ts): Add queryClient to UseRequestProcessor to invalidate sessions query
✨ (use-get-sessions-from-flow.ts): Introduce useGetSessionsFromFlowQuery to fetch sessions from flow
🔧 (use-rename-session.ts): Change refetchQueries to invalidateQueries for useGetSessionsFromFlowQuery
🔧 (custom-new-modal.tsx): Update import path for IOModal to playground-modal
🔧 (session-selector.tsx): Add setActiveSession function to handle setting active session
🔧 (sidebar-open-view.tsx): Add setActiveSession function to handle setting active session
♻️ (new-modal.tsx): Refactor IOModal into playground-modal and update functionality
♻️ (playground-modal.tsx): Refactor IOModal to handle playground-specific functionality
⬆️ (flowStore.ts): Add newChatOnPlayground state and setNewChatOnPlayground function
⬆️ (index.ts): Update FlowStoreType to include newChatOnPlayground and setNewChatOnPlayground

* 🔧 (pyproject.toml): update testpaths to point to the correct directory for tests
✨ (test_session_endpoint.py): add unit tests for sessions endpoint with flow_id filtering
♻️ (session-selector.tsx): refactor to trim editedSession before setting it
♻️ (sidebar-open-view.tsx): refactor to set visibleSession instead of activeSession

* ✨ (use-get-sessions-from-flow.ts): Always include the flow ID as the default session if it's not already present
♻️ (playground-modal.tsx): Refactor setting sessions to include currentFlowId as the default session if not present, and handle visibility of sessions more efficiently

* ♻️ (use-get-messages-mutation.ts): remove unused imports and refactor code for better readability and maintainability

* ✨ (test_session_endpoint.py): refactor test function names for better clarity and consistency

* ✨ (create-new-session-name.ts): add function to generate a new session name based on the current date and time
🔧 (playground-modal.tsx): import createNewSessionName function to dynamically set a new session name when no session is visible

* [autofix.ci] apply automated fixes

* ✨ (monitor.py): rename get_sessions endpoint to get_message_sessions for clarity and consistency
🔧 (constants.ts): remove unused SESSIONS constant from API URLs
🔧 (use-delete-messages.ts): remove commented out code and unnecessary comments
✨ (use-delete-sessions.ts): add functionality to delete sessions in frontend
🔧 (use-get-sessions-from-flow.ts): update API endpoint for getting sessions to match backend changes
🔧 (playground-modal.tsx): add functionality to delete sessions and associated messages in the UI, update UI optimistically, and handle errors appropriately

* [autofix.ci] apply automated fixes

* 🐛 (monitor.py): Fix type hinting issue in delete_messages function
📝 (monitor.py): Add comments and improve readability in test_messages_endpoints.py
📝 (session_endpoint.py): Update endpoint paths for consistency and clarity in test_session_endpoint.py

* [autofix.ci] apply automated fixes

* fix: update SQL statement to use col() for session_id filtering in get_message_sessions function

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* fix: implemented cached values and temporary MCP servers on MCP component (langflow-ai#8628)

* Added actionCount to fetch only servers without actionCount

* Updated queries and uses to use servers without action data first, and then to fetch them

* removed comment

* updated constants

* Added loading dropdown

* Make options persist

* Implemented new value format for McpComponent and implemented saving and removing temp Mcp Server if config is existent

* Changed value type

* Implemented cache and saving the server config

* Fixed mcp server test

* fix backend formatting

* fixed lint

* Added await

* Fixed save button not appearing when no servers are available

* added condition to only show save button when options is not null

* template autofix

* change template

* update text sentiment analysis

* change basic prompt back

* change image sentiment back

* update text sentiment and twitter

* Update Twitter Thread Generator.json

* Add back the input for the chat

* add change

* fix text sentiment

* update research translation

* Update Research Translation Loop.json

---------

Co-authored-by: Eric Hare <ericrhare@gmail.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Cristhian Zanforlin Lousa <cristhian.lousa@gmail.com>
Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants