Skip to content

Bridge Protocol

CodexA exposes a stateless JSON/HTTP bridge (codex serve) that any IDE extension or AI assistant can use to request context.

Quick Start

bash
codex serve --port 24842

The bridge binds to 127.0.0.1:24842 by default.

Endpoints

MethodPathDescription
GET/Capabilities manifest
GET/healthHealth check
POST/requestHandle an AgentRequest
POST/tools/invokeExecute a tool invocation
GET/tools/listList available tools
GET/tools/streamSSE stream of tool events
OPTIONS*CORS preflight

Request Kinds

The bridge supports 12 request types:

KindValue
Semantic Searchsemantic_search
Explain Symbolexplain_symbol
Explain Fileexplain_file
Get Contextget_context
Get Dependenciesget_dependencies
Get Call Graphget_call_graph
Summarize Reposummarize_repo
Find Referencesfind_references
Validate Codevalidate_code
List Capabilitieslist_capabilities
Invoke Toolinvoke_tool
List Toolslist_tools

AgentRequest

json
{
  "kind": "semantic_search",
  "params": {"query": "authentication", "top_k": 5},
  "request_id": "req-001",
  "source": "copilot"
}
FieldTypeDescription
kindstringOne of the RequestKind values
paramsobjectOperation-specific parameters
request_idstringCaller-assigned correlation ID
sourcestringIdentifier of calling agent

AgentResponse

json
{
  "success": true,
  "data": {"snippets": [...]},
  "error": "",
  "request_id": "req-001",
  "elapsed_ms": 42.5
}
FieldTypeDescription
successbooleanWhether the request succeeded
dataobjectStructured response payload
errorstringError message (if failed)
request_idstringEchoed correlation ID
elapsed_msnumberProcessing time in ms

Tool Invocation via Bridge

Direct Tool Invoke

bash
curl -X POST http://127.0.0.1:24842/tools/invoke \
  -H "Content-Type: application/json" \
  -d '{
    "tool_name": "semantic_search",
    "arguments": {"query": "error handling"}
  }'

Response:

json
{
  "tool_name": "semantic_search",
  "request_id": "auto-generated-id",
  "success": true,
  "result_payload": {
    "snippets": [...]
  },
  "execution_time_ms": 42.5
}

List Available Tools

bash
curl http://127.0.0.1:24842/tools/list

SSE Event Stream

bash
curl http://127.0.0.1:24842/tools/stream

Events are dispatched for each tool invocation, streaming, and completion.

CORS

The bridge includes CORS headers for browser-based clients. Preflight OPTIONS requests are handled automatically.

Configuration

bash
codex serve [options]

Options:
  --host, -h TEXT     Host to bind (default: 127.0.0.1)
  --port, -p INTEGER  Port to bind (default: 24842)
  --path DIRECTORY    Project root path

Architecture

Agent/IDE  →  HTTP  →  BridgeServer  →  RequestRouter  →  ToolExecutor  →  Core

                                          ContextProvider  →  Search/Analysis

The bridge is a thin HTTP layer over the same ToolExecutor used by CLI and MCP.

Released under the MIT License.