-
Notifications
You must be signed in to change notification settings - Fork 146
feat(coder-labs/modules/codex): add mcp_config_remote_path for remote MCP server configurations #894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(coder-labs/modules/codex): add mcp_config_remote_path for remote MCP server configurations #894
Changes from all commits
853ffb1
b27dabe
af2cc72
594256f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,6 +88,12 @@ variable "mcp" { | |
| default = "" | ||
| } | ||
|
|
||
| variable "mcp_config_remote_path" { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2 [DEREM-4] This is a new public API surface shipping in v5.1.0. Once released, renaming to Renaming now is cheap. Renaming after release requires a major version bump.
|
||
| type = list(string) | ||
| description = "List of URLs that return MCP server configurations in TOML format (matching Codex's native config format). Fetched at install time and appended to config.toml." | ||
| default = [] | ||
| } | ||
|
|
||
| variable "model_reasoning_effort" { | ||
| type = string | ||
| description = "The reasoning effort for the model. One of: none, minimal, low, medium, high, xhigh. See https://platform.openai.com/docs/guides/latest-model#lower-reasoning-effort" | ||
|
|
@@ -141,6 +147,7 @@ locals { | |
| ARG_WORKDIR = local.workdir != "" ? base64encode(local.workdir) : "" | ||
| ARG_BASE_CONFIG_TOML = var.base_config_toml != "" ? base64encode(var.base_config_toml) : "" | ||
| ARG_MCP = var.mcp != "" ? base64encode(var.mcp) : "" | ||
| ARG_MCP_CONFIG_REMOTE_PATH = base64encode(jsonencode(var.mcp_config_remote_path)) | ||
| ARG_ENABLE_AI_GATEWAY = tostring(var.enable_ai_gateway) | ||
| ARG_AIBRIDGE_CONFIG = var.enable_ai_gateway ? base64encode(local.aibridge_config) : "" | ||
| ARG_MODEL_REASONING_EFFORT = var.model_reasoning_effort | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ ARG_CODEX_VERSION=$(echo -n '${ARG_CODEX_VERSION}' | base64 -d) | |
| ARG_WORKDIR=$(echo -n '${ARG_WORKDIR}' | base64 -d) | ||
| ARG_BASE_CONFIG_TOML=$(echo -n '${ARG_BASE_CONFIG_TOML}' | base64 -d) | ||
| ARG_MCP=$(echo -n '${ARG_MCP}' | base64 -d) | ||
| ARG_MCP_CONFIG_REMOTE_PATH=$(echo -n '${ARG_MCP_CONFIG_REMOTE_PATH}' | base64 -d) | ||
| ARG_ENABLE_AI_GATEWAY='${ARG_ENABLE_AI_GATEWAY}' | ||
| ARG_AIBRIDGE_CONFIG=$(echo -n '${ARG_AIBRIDGE_CONFIG}' | base64 -d) | ||
| ARG_MODEL_REASONING_EFFORT='${ARG_MODEL_REASONING_EFFORT}' | ||
|
|
@@ -24,6 +25,7 @@ printf "workdir: %s\n" "$${ARG_WORKDIR}" | |
| printf "enable_ai_gateway: %s\n" "$${ARG_ENABLE_AI_GATEWAY}" | ||
| printf "install_codex: %s\n" "$${ARG_INSTALL}" | ||
| printf "model_reasoning_effort: %s\n" "$${ARG_MODEL_REASONING_EFFORT}" | ||
| printf "mcp_config_remote_path: %s\n" "$${ARG_MCP_CONFIG_REMOTE_PATH}" | ||
| echo "--------------------------------" | ||
|
|
||
| function add_path_to_shell_profiles() { | ||
|
|
@@ -155,6 +157,22 @@ function populate_config_toml() { | |
| echo "$${ARG_MCP}" >> "$${config_path}" | ||
| fi | ||
|
|
||
| if [ -n "$${ARG_MCP_CONFIG_REMOTE_PATH}" ] && [ "$${ARG_MCP_CONFIG_REMOTE_PATH}" != "[]" ]; then | ||
| if ! command -v jq > /dev/null 2>&1; then | ||
| printf "Error: 'jq' is required to process mcp_config_remote_path but was not found. Skipping remote MCP config fetch.\n" >&2 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3 [DEREM-5] "Error:" label on a non-fatal message. This message says When Fix: either change to
|
||
| else | ||
| for url in $(echo "$${ARG_MCP_CONFIG_REMOTE_PATH}" | jq -r '.[]'); do | ||
|
35C4n0r marked this conversation as resolved.
|
||
| echo "Fetching MCP configuration from: $${url}" | ||
| mcp_toml=$(curl -fsSL "$${url}") || { | ||
| echo "Warning: Failed to fetch MCP configuration from '$${url}', continuing..." | ||
| continue | ||
| } | ||
| printf "Appending MCP servers from %s\n" "$${url}" | ||
| printf '\n%s\n' "$${mcp_toml}" >> "$${config_path}" | ||
| done | ||
| fi | ||
| fi | ||
|
|
||
| if [ "$${ARG_ENABLE_AI_GATEWAY}" = "true" ] && [ -n "$${ARG_AIBRIDGE_CONFIG}" ]; then | ||
| if ! grep -q '\[model_providers\.aigateway\]' "$${config_path}" 2>/dev/null; then | ||
| printf "Adding AI Gateway configuration\n" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit [DEREM-6] Test duplicates
setup()helper boilerplate.The
mcp-config-remote-pathtest inlines ~35 lines of container setup (runTerraformApply, runContainer, registerCleanup, writeExecutable) that the existingsetup()helper at line 92 already handles. Other tests in this file usesetup({moduleVariables: {...}}). This test could do the same and add only the remote-mcp.toml write step after.