Official

codex

Codex agent provider: runs the Codex CLI's app-server for each account.

The app opens the listing; nothing installs until an agent in your Plugins workspace has read the files and you enable the plugin. In a terminal: dvg install divergence/codex@0.2.5

Permissions in 0.2.5

  • Provide agents agents.provideMediumAdds agents to the app.Provide the Codex agent and pass its tool calls to plugin tools
  • Run named programs processMediumStarts the listed programs.Run the Codex CLI, and ask or tell the installer that owns it (npm or Homebrew) about a newer versionPrograms: codexnpmbrew
  • Environment variables envMediumReads the listed environment variables.Find each account's Codex home, and pass extra app-server arguments set in CODEX_ARGSVariables: HOMECODEX_HOMECODEX_ARGS
  • Read files fs.readMediumReads files in the listed places.Notice a conversation started in the Codex app or CLI, so it shows up at once, and read, once, the accounts the previous Codex provider keptPlaces: its own data folder~/.codex/sessions~/.codex/sessions/**~/.codex*/sessions~/.codex*/sessions/**

Files

mcp.ts2.4 KB
import * as Effect from "effect/Effect";
import type { McpCallToolParams, McpReadResourceParams, ToolContent } from "divergence/protocol";
import { ProviderError } from "../sdk/errors.ts";
import type { CodexAgent } from "./agent.ts";
import type { Item, McpServers } from "./wire.ts";

/// Codex captures the invoked descriptor's UI resource in the item itself.
export function appContent(item: Item, enabled: boolean): ToolContent[] {
  const resourceUri = item.mcpAppUi?.resourceUri ?? item.mcpAppResourceUri ?? item.appContext?.resourceUri;
  if (!enabled || !resourceUri?.startsWith("ui://")) return [];
  return [
    {
      type: "mcp_app",
      server: item.server ?? "",
      tool: item.tool ?? "",
      resourceUri,
      ...(item.result != null ? { result: item.result } : {}),
    },
  ];
}

export const readResource = Effect.fn("Codex.readResource")(function* (
  agent: CodexAgent,
  params: McpReadResourceParams,
) {
  const connection = yield* agent.loadedConnection(params.sessionId);
  return yield* agent.request(connection, "mcpServer/resource/read", {
    threadId: params.sessionId,
    server: params.server,
    uri: params.uri,
    ...(params.toolCallId ? { originCallId: params.toolCallId } : {}),
  });
});

export const callTool = Effect.fn("Codex.callMcpTool")(function* (agent: CodexAgent, params: McpCallToolParams) {
  const connection = yield* agent.loadedConnection(params.sessionId);
  let cursor: string | null = null;
  do {
    const page: McpServers = yield* agent.request(connection, "mcpServerStatus/list", {
      threadId: params.sessionId,
      serverName: params.server,
      cursor,
    });
    const server = page.data.find((server) => server.name === params.server);
    if (server?.toolsError) return yield* Effect.fail(new ProviderError({ message: server.toolsError }));
    const tool = Object.values(server?.tools ?? {}).find((tool) => tool.name === params.name);
    const visibility = tool?._meta?.ui?.visibility;
    if (visibility && !visibility.includes("app"))
      return yield* Effect.fail(
        new ProviderError({ message: `MCP tool ${params.server}.${params.name} does not allow calls from apps` }),
      );
    cursor = page.nextCursor ?? null;
  } while (cursor);
  return yield* agent.request(
    connection,
    "mcpServer/tool/call",
    {
      threadId: params.sessionId,
      server: params.server,
      tool: params.name,
      arguments: params.arguments,
    },
    { timeout: null },
  );
});

Versions

VersionPublishedPlugin APISizePermissionsStatus
0.2.5latestNov 21, 2026>=5 <6121.1 KB4 permissionsListed
0.2.4Nov 16, 2026>=5 <6120.2 KB4 permissionsListed
0.2.3Nov 11, 2026>=5 <695.2 KB4 permissionsListed
0.2.2Nov 9, 2026>=5 <688.9 KB4 permissionsListed
0.2.1Oct 27, 2026>=2 <484.1 KB4 permissionsListed

Reviews and comments

0 threads · 0 reviews

No comments yet.