Codex.MCP.Config (Codex SDK v0.7.2)

Copy Markdown View Source

Helpers for managing MCP server configuration through app-server config APIs.

Summary

Functions

Adds or replaces an MCP server entry under mcp_servers.<name>.

Lists configured MCP servers from the app-server config.

Removes a configured MCP server entry.

Types

connection()

@type connection() :: Codex.AppServer.connection()

server_config()

@type server_config() :: map()

Functions

add_server(conn, name, attrs, opts \\ [])

@spec add_server(connection(), String.t(), map() | keyword(), keyword()) ::
  {:ok, map()} | {:error, term()}

Adds or replaces an MCP server entry under mcp_servers.<name>.

The attrs map should include either a stdio launcher (command) or a streamable HTTP URL (url).

list_servers(conn, opts \\ [])

@spec list_servers(
  connection(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Lists configured MCP servers from the app-server config.

Options

  • :include_layers - include layered config metadata (passed to config/read)
  • :app_server - override the module used for config calls (defaults to Codex.AppServer)

remove_server(conn, name, opts \\ [])

@spec remove_server(connection(), String.t(), keyword()) ::
  {:ok, map()} | {:error, term()}

Removes a configured MCP server entry.