Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3efc22c

Browse files
harleylrnMichael OrlovDevelopmentCats
authored
fix/amazon-q mcp integration (#248)
Co-authored-by: Michael Orlov <michaelo@amdocs.com> Co-authored-by: DevCats <christofer@coder.com>
1 parent 8ba4c32 commit 3efc22c

File tree

1 file changed

+7
-25
lines changed
  • registry/coder/modules/amazon-q

1 file changed

+7
-25
lines changed

‎registry/coder/modules/amazon-q/main.tf

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -125,24 +125,7 @@ variable "ai_prompt" {
125125
locals {
126126
encoded_pre_install_script = var.experiment_pre_install_script != null ? base64encode(var.experiment_pre_install_script) : ""
127127
encoded_post_install_script = var.experiment_post_install_script != null ? base64encode(var.experiment_post_install_script) : ""
128-
# We need to use allowed tools to limit the context Amazon Q receives.
129-
# Amazon Q can't handle big contexts, and the `create_template_version` tool
130-
# has a description that's too long.
131-
mcp_json = <<EOT
132-
{
133-
"mcpServers": {
134-
"coder": {
135-
"command": "coder",
136-
"args": ["exp", "mcp", "server", "--allowed-tools", "coder_report_task"],
137-
"env": {
138-
"CODER_MCP_APP_STATUS_SLUG": "amazon-q"
139-
}
140-
}
141-
}
142-
}
143-
EOT
144-
encoded_mcp_json = base64encode(local.mcp_json)
145-
full_prompt = <<-EOT
128+
full_prompt = <<-EOT
146129
${var.system_prompt}
147130
148131
Your first task is:
@@ -211,20 +194,19 @@ resource "coder_script" "amazon_q" {
211194
cd "$PREV_DIR"
212195
echo "Extracted auth tarball"
213196
197+
if [ "${var.experiment_report_tasks}" = "true" ]; then
198+
echo "Configuring Amazon Q to report tasks via Coder MCP..."
199+
q mcp add --name coder --command "coder" --args "exp,mcp,server,--allowed-tools,coder_report_task" --env "CODER_MCP_APP_STATUS_SLUG=amazon-q" --scope global --force
200+
echo "Added Coder MCP server to Amazon Q configuration"
201+
fi
202+
214203
if [ -n "${local.encoded_post_install_script}" ]; then
215204
echo "Running post-install script..."
216205
echo "${local.encoded_post_install_script}" | base64 -d > /tmp/post_install.sh
217206
chmod +x /tmp/post_install.sh
218207
/tmp/post_install.sh
219208
fi
220209
221-
if [ "${var.experiment_report_tasks}" = "true" ]; then
222-
echo "Configuring Amazon Q to report tasks via Coder MCP..."
223-
mkdir -p ~/.aws/amazonq
224-
echo "${local.encoded_mcp_json}" | base64 -d > ~/.aws/amazonq/mcp.json
225-
echo "Created the ~/.aws/amazonq/mcp.json configuration file"
226-
fi
227-
228210
if [ "${var.experiment_use_tmux}" = "true" ] && [ "${var.experiment_use_screen}" = "true" ]; then
229211
echo "Error: Both experiment_use_tmux and experiment_use_screen cannot be true simultaneously."
230212
echo "Please set only one of them to true."

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /