Skip to content

Commit 9e3c3ae

Browse files
fix: simplify MCP server configuration
1 parent 4f5636d commit 9e3c3ae

File tree

1 file changed

+12
-56
lines changed
  • registry/coder-labs/modules/copilot-cli/scripts

1 file changed

+12
-56
lines changed

registry/coder-labs/modules/copilot-cli/scripts/install.sh

Lines changed: 12 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -124,61 +124,6 @@ setup_mcp_config() {
124124
fi
125125
fi
126126

127-
if command_exists jq; then
128-
mcp_servers=$(echo "$mcp_servers" | jq '. + {
129-
"github": {
130-
"command": "@github/copilot-mcp-github",
131-
"args": [],
132-
"type": "local",
133-
"tools": []
134-
}
135-
}')
136-
elif command_exists node; then
137-
mcp_servers=$(node -e "
138-
const servers = JSON.parse(\`$mcp_servers\`);
139-
servers.github = {
140-
command: '@github/copilot-mcp-github',
141-
args: [],
142-
type: 'local',
143-
tools: []
144-
};
145-
console.log(JSON.stringify(servers));
146-
")
147-
fi
148-
149-
if [ "$ARG_REPORT_TASKS" = "true" ]; then
150-
echo "Adding Coder MCP server for task reporting..."
151-
if command_exists jq; then
152-
mcp_servers=$(echo "$mcp_servers" | jq '. + {
153-
"coder": {
154-
"command": "coder",
155-
"args": ["exp", "mcp", "server"],
156-
"type": "local",
157-
"tools": [],
158-
"env": {
159-
"CODER_MCP_APP_STATUS_SLUG": "'"$ARG_MCP_APP_STATUS_SLUG"'",
160-
"CODER_MCP_AI_AGENTAPI_URL": "http://localhost:3284"
161-
}
162-
}
163-
}')
164-
elif command_exists node; then
165-
mcp_servers=$(node -e "
166-
const servers = JSON.parse(\`$mcp_servers\`);
167-
servers.coder = {
168-
command: 'coder',
169-
args: ['exp', 'mcp', 'server'],
170-
type: 'local',
171-
tools: [],
172-
env: {
173-
CODER_MCP_APP_STATUS_SLUG: '$ARG_MCP_APP_STATUS_SLUG',
174-
CODER_MCP_AI_AGENTAPI_URL: 'http://localhost:3284'
175-
}
176-
};
177-
console.log(JSON.stringify(servers));
178-
")
179-
fi
180-
fi
181-
182127
if command_exists jq; then
183128
echo "$mcp_servers" | jq '{mcpServers: .}' > "$mcp_config_file"
184129
elif command_exists node; then
@@ -190,7 +135,11 @@ setup_mcp_config() {
190135
echo "{\"mcpServers\": $mcp_servers}" > "$mcp_config_file"
191136
fi
192137

193-
echo "MCP configuration written to: $mcp_config_file"
138+
if [ -n "$ARG_MCP_CONFIG" ]; then
139+
echo "Custom MCP configuration written to: $mcp_config_file"
140+
else
141+
echo "Empty MCP configuration file created at: $mcp_config_file"
142+
fi
194143
}
195144

196145
configure_coder_integration() {
@@ -200,10 +149,17 @@ configure_coder_integration() {
200149
export CODER_MCP_AI_AGENTAPI_URL="http://localhost:3284"
201150

202151
if command_exists coder; then
152+
echo "Setting up Coder MCP integration for Copilot CLI..."
203153
coder exp mcp configure copilot-cli "$ARG_WORKDIR" 2> /dev/null || true
204154
fi
205155
else
206156
echo "Task reporting disabled."
157+
if command_exists coder; then
158+
export CODER_MCP_APP_STATUS_SLUG=""
159+
export CODER_MCP_AI_AGENTAPI_URL=""
160+
echo "Configuring Copilot CLI with Coder MCP (no task reporting)..."
161+
coder exp mcp configure copilot-cli "$ARG_WORKDIR" 2> /dev/null || true
162+
fi
207163
fi
208164
}
209165

0 commit comments

Comments
 (0)