ExAthena.Mcp.Config (ExAthena v0.6.0)

Copy Markdown View Source

Loads and validates MCP server configuration.

Reads from Application.get_env(:ex_athena, :mcp_servers, %{}). The raw config mirrors OpenCode's JSONC shape — string or atom keys, "local" or :local for type — so udin_code can map its JSONC directly.

Example

config :ex_athena, :mcp_servers, %{
  "fetch" => %{
    type: :local,
    command: ["uvx", "mcp-server-fetch"],
    environment: %{"FOO" => "bar"},
    enabled: true
  },
  "github" => %{
    type: :remote,
    url: "https://api.example.com/mcp",
    headers: %{"Authorization" => "Bearer …"},
    enabled: true
  }
}

Summary

Functions

Load server configs from raw (defaults to Application.get_env(:ex_athena, :mcp_servers, %{})).

Convert a %Server{} to keyword opts suitable for ExAthena.Mcp.Client.start_link/1.

Functions

load(raw \\ Application.get_env(:ex_athena, :mcp_servers, %{}))

@spec load(map() | nil) ::
  {:ok, [ExAthena.Mcp.Config.Server.t()]} | {:error, ExAthena.Error.t()}

Load server configs from raw (defaults to Application.get_env(:ex_athena, :mcp_servers, %{})).

Returns {:ok, [%Server{}]} or {:error, %ExAthena.Error{}}.

to_client_opts(server)

@spec to_client_opts(ExAthena.Mcp.Config.Server.t()) :: keyword()

Convert a %Server{} to keyword opts suitable for ExAthena.Mcp.Client.start_link/1.