mirror of
https://github.com/coder/registry.git
synced 2026-06-02 20:48:14 +00:00
Fix(gemini): the Coder MCP server configuration (#882)
## Description Fixed the Coder MCP server configuration * Added the full path to the coder binary for Gemini * Removed unnecessary configuration fields <img width="1365" height="715" alt="Screenshot 2026-05-04 120727" src="https://github.com/user-attachments/assets/35cdb18f-c4a5-437d-8ad6-38134104e5e6" /> <img width="1365" height="717" alt="Screenshot 2026-05-04 120836" src="https://github.com/user-attachments/assets/bdce543e-dd7f-4122-b356-896d08e1fd3f" /> ## Type of Change - [ ] New module - [ ] New template - [x] Bug fix - [ ] Feature/enhancement - [ ] Documentation - [ ] Other ## Module Information <!-- Delete this section if not applicable --> **Path:** `registry/coder-labs/modules/gemini` **New version:** `v1.0.0` **Breaking change:** [ ] Yes [ ] No ## Testing & Validation - [x] Tests pass (`bun test`) - [x] Code formatted (`bun fmt`) - [x] Changes tested locally ## Related Issues fix: #881
This commit is contained in:
committed by
GitHub
parent
6b8d89daba
commit
bce0897099
@@ -13,7 +13,7 @@ Run [Gemini CLI](https://github.com/google-gemini/gemini-cli) in your workspace
|
||||
```tf
|
||||
module "gemini" {
|
||||
source = "registry.coder.com/coder-labs/gemini/coder"
|
||||
version = "3.0.0"
|
||||
version = "3.0.1"
|
||||
agent_id = coder_agent.main.id
|
||||
folder = "/home/coder/project"
|
||||
}
|
||||
@@ -46,7 +46,7 @@ variable "gemini_api_key" {
|
||||
|
||||
module "gemini" {
|
||||
source = "registry.coder.com/coder-labs/gemini/coder"
|
||||
version = "3.0.0"
|
||||
version = "3.0.1"
|
||||
agent_id = coder_agent.main.id
|
||||
gemini_api_key = var.gemini_api_key
|
||||
folder = "/home/coder/project"
|
||||
@@ -94,7 +94,7 @@ data "coder_parameter" "ai_prompt" {
|
||||
module "gemini" {
|
||||
count = data.coder_workspace.me.start_count
|
||||
source = "registry.coder.com/coder-labs/gemini/coder"
|
||||
version = "3.0.0"
|
||||
version = "3.0.1"
|
||||
agent_id = coder_agent.main.id
|
||||
gemini_api_key = var.gemini_api_key
|
||||
gemini_model = "gemini-2.5-flash"
|
||||
@@ -105,6 +105,22 @@ module "gemini" {
|
||||
You are a helpful coding assistant. Always explain your code changes clearly.
|
||||
YOU MUST REPORT ALL TASKS TO CODER.
|
||||
EOT
|
||||
pre_install_script = <<-EOT
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "Installing Node.js via NodeSource..."
|
||||
|
||||
sudo apt-get update -qq && sudo apt-get install -y curl ca-certificates
|
||||
|
||||
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo bash -
|
||||
|
||||
sudo apt-get install -y nodejs
|
||||
|
||||
echo "Node version: $(node -v)"
|
||||
echo "npm version: $(npm -v)"
|
||||
echo "Node install complete."
|
||||
EOT
|
||||
}
|
||||
```
|
||||
|
||||
@@ -118,7 +134,7 @@ For enterprise users who prefer Google's Vertex AI platform:
|
||||
```tf
|
||||
module "gemini" {
|
||||
source = "registry.coder.com/coder-labs/gemini/coder"
|
||||
version = "3.0.0"
|
||||
version = "3.0.1"
|
||||
agent_id = coder_agent.main.id
|
||||
gemini_api_key = var.gemini_api_key
|
||||
folder = "/home/coder/project"
|
||||
|
||||
@@ -148,22 +148,16 @@ locals {
|
||||
base_extensions = <<-EOT
|
||||
{
|
||||
"coder": {
|
||||
"command": "coder",
|
||||
"args": [
|
||||
"exp",
|
||||
"mcp",
|
||||
"server"
|
||||
],
|
||||
"command": "coder",
|
||||
"description": "Report ALL tasks and statuses (in progress, done, failed) you are working on.",
|
||||
"enabled": true,
|
||||
"env": {
|
||||
"CODER_MCP_APP_STATUS_SLUG": "${local.app_slug}",
|
||||
"CODER_MCP_AI_AGENTAPI_URL": "http://localhost:3284"
|
||||
},
|
||||
"name": "Coder",
|
||||
"timeout": 3000,
|
||||
"type": "stdio",
|
||||
"trust": true
|
||||
}
|
||||
}
|
||||
}
|
||||
EOT
|
||||
|
||||
@@ -17,6 +17,7 @@ echo "--------------------------------"
|
||||
printf "gemini_config: %s\n" "$ARG_GEMINI_CONFIG"
|
||||
printf "install: %s\n" "$ARG_INSTALL"
|
||||
printf "gemini_version: %s\n" "$ARG_GEMINI_VERSION"
|
||||
printf "BASE_EXTENSIONS: %s\n" "$BASE_EXTENSIONS"
|
||||
echo "--------------------------------"
|
||||
|
||||
set +o nounset
|
||||
@@ -140,6 +141,25 @@ function add_system_prompt_if_exists() {
|
||||
fi
|
||||
}
|
||||
|
||||
function patch_coder_mcp_command() {
|
||||
CODER_BIN=$(which coder)
|
||||
SETTINGS_PATH="$HOME/.gemini/settings.json"
|
||||
|
||||
if [ -z "$CODER_BIN" ]; then
|
||||
printf "Warning: could not find coder binary, MCP command path not patched.\n"
|
||||
return
|
||||
fi
|
||||
|
||||
printf "Patching coder MCP command path to: %s\n" "$CODER_BIN"
|
||||
|
||||
TMP_SETTINGS=$(mktemp)
|
||||
jq --arg bin "$CODER_BIN" \
|
||||
'.mcpServers.coder.command = $bin' \
|
||||
"$SETTINGS_PATH" > "$TMP_SETTINGS" && mv "$TMP_SETTINGS" "$SETTINGS_PATH"
|
||||
|
||||
printf "Patch complete.\n"
|
||||
}
|
||||
|
||||
function configure_mcp() {
|
||||
export CODER_MCP_APP_STATUS_SLUG="gemini"
|
||||
export CODER_MCP_AI_AGENTAPI_URL="http://localhost:3284"
|
||||
@@ -149,4 +169,5 @@ function configure_mcp() {
|
||||
install_gemini
|
||||
populate_settings_json
|
||||
add_system_prompt_if_exists
|
||||
patch_coder_mcp_command
|
||||
configure_mcp
|
||||
|
||||
Reference in New Issue
Block a user