MCP.EndpointDiscovery (fnord v0.8.82)

View Source

Auto-discovers MCP endpoint paths when the default path returns 404.

Summary

Functions

Attempts to discover the MCP endpoint path by trying common paths. Returns {:ok, path} if a working path is found, {:error, reason} otherwise.

Prompts the user to save the discovered path to settings. Returns :ok if saved (or user declined), {:error, reason} on failure.

Functions

discover(base_url, paths \\ ["/mcp", "/", "/api/mcp", "/mcp/v1"], opts \\ [])

@spec discover(String.t(), [String.t()], keyword()) ::
  {:ok, String.t()} | {:error, term()}

Attempts to discover the MCP endpoint path by trying common paths. Returns {:ok, path} if a working path is found, {:error, reason} otherwise.

Options

  • :server - Server name for OAuth header lookup
  • :config - Server configuration map (for OAuth)

prompt_and_save(server_name, path, scope)

@spec prompt_and_save(String.t(), String.t(), :global | {:project, String.t()}) ::
  :ok | {:error, term()}

Prompts the user to save the discovered path to settings. Returns :ok if saved (or user declined), {:error, reason} on failure.