Skip to content

Commit

Permalink
Merge branch 'langflow-ai:main' into nvidia-reranker-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-ogrady authored Jan 25, 2025
2 parents 3c61b3d + 5c64e59 commit 5a66c86
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
5 changes: 0 additions & 5 deletions src/backend/base/langflow/api/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@
flows_router,
folders_router,
login_router,
mcp_router,
monitor_router,
starter_projects_router,
store_router,
users_router,
validate_router,
variables_router,
)
from langflow.services.deps import get_settings_service

router = APIRouter(
prefix="/api/v1",
Expand All @@ -35,6 +33,3 @@
router.include_router(monitor_router)
router.include_router(folders_router)
router.include_router(starter_projects_router)

if get_settings_service().settings.mcp_server_enabled:
router.include_router(mcp_router)
9 changes: 7 additions & 2 deletions src/backend/base/langflow/api/v1/mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@

logger.debug("MCP module loaded - debug logging enabled")

enable_progress_notifications = get_settings_service().settings.mcp_server_enable_progress_notifications

router = APIRouter(prefix="/mcp", tags=["mcp"])

Expand All @@ -58,6 +57,10 @@
MAX_RETRIES = 2


def get_enable_progress_notifications() -> bool:
return get_settings_service().settings.mcp_server_enable_progress_notifications


@server.list_prompts()
async def handle_list_prompts():
return []
Expand Down Expand Up @@ -175,7 +178,9 @@ async def handle_list_tools():


@server.call_tool()
async def handle_call_tool(name: str, arguments: dict) -> list[types.TextContent]:
async def handle_call_tool(
name: str, arguments: dict, *, enable_progress_notifications: bool = Depends(get_enable_progress_notifications)
) -> list[types.TextContent]:
"""Handle tool execution requests."""
try:
session = await anext(get_session())
Expand Down
2 changes: 1 addition & 1 deletion src/backend/base/langflow/components/logic/run_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async def run_flow_with_tweaks(self):
if node not in tweaks:
tweaks[node] = {}
tweaks[node][name] = self._attributes[field]
# import pdb; pdb.set_trace()

return await run_flow(
inputs=None,
output_type="all",
Expand Down
5 changes: 5 additions & 0 deletions src/backend/base/langflow/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@ async def flatten_query_string_lists(request: Request, call_next):

start_http_server(settings.prometheus_port)

if settings.mcp_server_enabled:
from langflow.api.v1 import mcp_router

router.include_router(mcp_router)

app.include_router(router)
app.include_router(health_check_router)
app.include_router(log_router)
Expand Down

0 comments on commit 5a66c86

Please sign in to comment.