Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions registry/coder-labs/modules/auggie/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ variable "agentapi_version" {
}
}

variable "agentapi_port" {
type = number
description = "The port used by AgentAPI."
default = 3284
}

variable "pre_install_script" {
type = string
description = "Custom script to run before installing Auggie."
Expand Down Expand Up @@ -194,6 +200,7 @@ module "agentapi" {
module_dir_name = local.module_dir_name
install_agentapi = var.install_agentapi
agentapi_version = var.agentapi_version
agentapi_port = var.agentapi_port
pre_install_script = var.pre_install_script
post_install_script = var.post_install_script
start_script = <<-EOT
Expand Down Expand Up @@ -227,6 +234,7 @@ module "agentapi" {
ARG_MCP_APP_STATUS_SLUG='${local.app_slug}' \
ARG_AUGGIE_RULES='${base64encode(var.rules)}' \
ARG_MCP_CONFIG='${var.mcp != null ? base64encode(replace(var.mcp, "'", "'\\''")) : ""}' \
ARG_AGENTAPI_PORT='${var.agentapi_port}' \
/tmp/install.sh
EOT
}
Expand Down
2 changes: 1 addition & 1 deletion registry/coder-labs/modules/auggie/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function create_coder_mcp() {
"command": "coder",
"env": {
"CODER_MCP_APP_STATUS_SLUG": "${ARG_MCP_APP_STATUS_SLUG}",
"CODER_MCP_AI_AGENTAPI_URL": "http://localhost:3284",
"CODER_MCP_AI_AGENTAPI_URL": "http://localhost:${ARG_AGENTAPI_PORT:-3284}",
"CODER_AGENT_URL": "${CODER_AGENT_URL:-}",
"CODER_AGENT_TOKEN": "${CODER_AGENT_TOKEN:-}"
}
Expand Down
8 changes: 8 additions & 0 deletions registry/coder-labs/modules/codex/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ variable "agentapi_version" {
default = "v0.12.1"
}

variable "agentapi_port" {
type = number
description = "The port used by AgentAPI."
default = 3284
}

variable "codex_model" {
type = string
description = "The model for Codex to use. Defaults to gpt-5.3-codex."
Expand Down Expand Up @@ -254,6 +260,7 @@ module "agentapi" {
install_agentapi = var.install_agentapi
agentapi_subdomain = var.subdomain
agentapi_version = var.agentapi_version
agentapi_port = var.agentapi_port
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Propagate configurable AgentAPI port into module configs

Passing agentapi_port into the agentapi submodule here does not actually reconfigure the client-side MCP wiring, because the module install paths still hardcode http://localhost:3284 (for example: registry/coder-labs/modules/codex/scripts/install.sh:132, auggie/scripts/install.sh:88, gemini/main.tf:167 and gemini/scripts/install.sh:145, opencode/scripts/install.sh:97). With any non-default agentapi_port, these modules will still point tools at 3284, so task reporting/MCP calls hit the wrong endpoint or fail entirely, which breaks the multi-tool port-conflict fix this commit is trying to add.

Useful? React with 👍 / 👎.

enable_state_persistence = var.enable_state_persistence
pre_install_script = var.pre_install_script
post_install_script = var.post_install_script
Expand Down Expand Up @@ -300,6 +307,7 @@ module "agentapi" {
ARG_CODEX_START_DIRECTORY='${local.workdir}' \
ARG_MODEL_REASONING_EFFORT='${var.model_reasoning_effort}' \
ARG_CODEX_INSTRUCTION_PROMPT='${base64encode(var.codex_system_prompt)}' \
ARG_AGENTAPI_PORT='${var.agentapi_port}' \
/tmp/install.sh
EOT
}
Expand Down
2 changes: 1 addition & 1 deletion registry/coder-labs/modules/codex/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ append_mcp_servers_section() {
ARG_CODER_MCP_APP_STATUS_SLUG=""
CODER_MCP_AI_AGENTAPI_URL=""
else
CODER_MCP_AI_AGENTAPI_URL="http://localhost:3284"
CODER_MCP_AI_AGENTAPI_URL="http://localhost:${ARG_AGENTAPI_PORT:-3284}"
fi

cat << EOF >> "$config_path"
Expand Down
10 changes: 9 additions & 1 deletion registry/coder-labs/modules/gemini/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ variable "agentapi_version" {
default = "v0.10.0"
}

variable "agentapi_port" {
type = number
description = "The port used by AgentAPI."
default = 3284
}

variable "gemini_model" {
type = string
description = "The model to use for Gemini (e.g., gemini-2.5-pro)."
Expand Down Expand Up @@ -158,7 +164,7 @@ locals {
"enabled": true,
"env": {
"CODER_MCP_APP_STATUS_SLUG": "${local.app_slug}",
"CODER_MCP_AI_AGENTAPI_URL": "http://localhost:3284"
"CODER_MCP_AI_AGENTAPI_URL": "http://localhost:${var.agentapi_port}"
},
"name": "Coder",
"timeout": 3000,
Expand Down Expand Up @@ -191,6 +197,7 @@ module "agentapi" {
module_dir_name = local.module_dir_name
install_agentapi = var.install_agentapi
agentapi_version = var.agentapi_version
agentapi_port = var.agentapi_port
pre_install_script = var.pre_install_script
post_install_script = var.post_install_script
install_script = <<-EOT
Expand All @@ -207,6 +214,7 @@ module "agentapi" {
ADDITIONAL_EXTENSIONS='${base64encode(replace(var.additional_extensions != null ? var.additional_extensions : "", "'", "'\\''"))}' \
GEMINI_START_DIRECTORY='${var.folder}' \
GEMINI_SYSTEM_PROMPT='${base64encode(var.gemini_system_prompt)}' \
ARG_AGENTAPI_PORT='${var.agentapi_port}' \
/tmp/install.sh
EOT
start_script = <<-EOT
Expand Down
2 changes: 1 addition & 1 deletion registry/coder-labs/modules/gemini/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function add_system_prompt_if_exists() {

function configure_mcp() {
export CODER_MCP_APP_STATUS_SLUG="gemini"
export CODER_MCP_AI_AGENTAPI_URL="http://localhost:3284"
export CODER_MCP_AI_AGENTAPI_URL="http://localhost:${ARG_AGENTAPI_PORT:-3284}"
coder exp mcp configure gemini "${GEMINI_START_DIRECTORY}"
}

Expand Down
8 changes: 8 additions & 0 deletions registry/coder-labs/modules/opencode/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ variable "agentapi_version" {
default = "v0.11.2"
}

variable "agentapi_port" {
type = number
description = "The port used by AgentAPI."
default = 3284
}

variable "ai_prompt" {
type = string
description = "Initial task prompt for OpenCode."
Expand Down Expand Up @@ -163,6 +169,7 @@ module "agentapi" {
module_dir_name = local.module_dir_name
install_agentapi = var.install_agentapi
agentapi_version = var.agentapi_version
agentapi_port = var.agentapi_port
pre_install_script = var.pre_install_script
post_install_script = var.post_install_script
start_script = <<-EOT
Expand Down Expand Up @@ -194,6 +201,7 @@ module "agentapi" {
ARG_WORKDIR='${local.workdir}' \
ARG_AUTH_JSON='${var.auth_json != null ? base64encode(replace(var.auth_json, "'", "'\\''")) : ""}' \
ARG_OPENCODE_CONFIG='${var.config_json != null ? base64encode(replace(var.config_json, "'", "'\\''")) : ""}' \
ARG_AGENTAPI_PORT='${var.agentapi_port}' \
/tmp/install.sh
EOT
}
Expand Down
2 changes: 1 addition & 1 deletion registry/coder-labs/modules/opencode/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ setup_coder_mcp_server() {
# Set environment variables based on task reporting setting
echo "Configuring OpenCode task reporting"
export CODER_MCP_APP_STATUS_SLUG="$ARG_MCP_APP_STATUS_SLUG"
export CODER_MCP_AI_AGENTAPI_URL="http://localhost:3284"
export CODER_MCP_AI_AGENTAPI_URL="http://localhost:${ARG_AGENTAPI_PORT:-3284}"
echo "Coder integration configured for task reporting"

# Add coder MCP server configuration to the JSON file
Expand Down
Loading