langflow-ai/langflow · error · Error

Failed to patch MCP Server

Error message

Failed to patch MCP Server

What it means

500 whose detail is the MCPComposerError message raised when starting or reaching MCP Composer fails during install. Unlike the generic branch, this carries the composer's own diagnostic text (e.g. binary not found, endpoint unreachable), logged as 'Failed to start MCP Composer for project ...'.

Source

Thrown at src/frontend/src/controllers/API/queries/mcp/use-patch-mcp-server.ts:63

        payload,
      );

      queryClient.setQueryData(
        ["useGetMCPServers"],
        (oldData: getMCPServersResponse = []) => {
          return oldData.map((server) => {
            return server.name === body.name
              ? { ...server, toolsCount: null, mode: null, error: undefined }
              : server;
          });
        },
      );

      return {
        message: res.data?.message || "MCP Server patched successfully",
      };
    } catch (error: unknown) {
      throw new Error(
        extractApiErrorMessage(
          error as Parameters<typeof extractApiErrorMessage>[0],
          "Failed to patch MCP Server",
        ),
      );
    }
  }

  const mutation: UseMutationResult<
    PatchMCPServerResponse,
    unknown,
    MCPServerType
  > = mutate(["usePatchMCPServer"], patchMCPServer, {
    ...options,
    retry: 0,

    onSuccess: (data, variables, context) => {
      queryClient.invalidateQueries({

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Read the returned detail message and matching aerror log line — it names the composer-level failure.
  2. Run 'uvx mcp-composer<version> --help' manually in the Langflow environment to confirm it can be fetched and executed.
  3. Check the configured mcp_composer_version pin exists and network access to PyPI is available.
  4. As a workaround, switch the project to apikey auth so install uses direct URLs without composer.
Defensive patterns

Strategy: try-catch

Validate before calling

import shutil
assert shutil.which("uvx"), "uvx required for MCP Composer install"

Try / catch

try:
    await client.post(install_url, json=payload)
except httpx.HTTPStatusError as e:
    detail = e.response.json().get("detail", "")
    if e.response.status_code == 500 and "composer" in detail.lower():
        show_composer_diagnostic(detail)  # detail IS the composer error message

Prevention

When it happens

Trigger: POST /{project_id}/install for a project with OAuth auth settings while composer is enabled, and get_or_start_mcp_composer / URL getters raise MCPComposerError — subprocess failed to launch, health check timed out, version pin unsatisfiable.

Common situations: uvx cannot fetch mcp-composer (offline/air-gapped machine); pinned mcp_composer_version does not exist; composer subprocess starts then dies so its HTTP endpoint never answers.

Related errors


AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14). Data as JSON: /api/errors/46d35665ae0235a1. Report an issue: GitHub.