Skip to main content

GitHub Copilot Integration Guide

This guide will help you integrate CWCloud MCP Server with GitHub Copilot in VS Code, enabling you to access powerful AI models (GPT-4, Claude, Gemini) directly through Copilot Chat.

Quick Setup​

Run the setup script from the project root:

./setup-github-copilot.sh
# Or
make setup-copilot

This script will:

  • Build the MCP server
  • Collect your CWCloud API credentials
  • Test the server connection
  • Create VS Code MCP configuration
  • Optionally set up global configuration

Manual Setup​

If you prefer manual setup, follow these steps:

1. Build the Server​

go build -o bin/cwcloud-mcp ./cmd/server
# Or
make build

2. Configure Environment​

Create a .env file with your CWCloud credentials:

COMWORK_API_URL=https://api.cwcloud.tech
COMWORK_ACCESS_KEY=your_access_key_here
COMWORK_SECRET_KEY=your_secret_key_here
LOG_LEVEL=info

Get your API keys from CWCloud Console.

3. Create MCP Configuration​

Create .vscode/mcp.json in your project:

{
"servers": {
"cwcloud-mcp": {
"type": "stdio",
"command": "/absolute/path/to/your/bin/cwcloud-mcp",
"args": [],
"env": {
"COMWORK_API_URL": "https://api.cwcloud.tech",
"COMWORK_ACCESS_KEY": "your_access_key_here",
"COMWORK_SECRET_KEY": "your_secret_key_here",
"LOG_LEVEL": "info"
}
}
}
}

Note: Use absolute paths in the command field.

4. Global Configuration (Optional)​

To make the server available across all workspaces, copy the configuration to your VS Code user directory:

Linux/WSL:

mkdir -p ~/.config/Code/User
cp .vscode/mcp.json ~/.config/Code/User/

macOS:

mkdir -p ~/Library/Application\ Support/Code/User
cp .vscode/mcp.json ~/Library/Application\ Support/Code/User/

Windows:

mkdir "%APPDATA%\Code\User"
copy .vscode\mcp.json "%APPDATA%\Code\User\"

Using CWCloud Tools in GitHub Copilot​

After setup, restart VS Code and you'll have access to these tools in Copilot Chat:

Available Tools​

#generate_ai_prompt​

Generate AI responses using various models.

Parameters:

  • adapter (required): AI model to use
  • message (required): Your prompt
  • conversation_id (optional): Continue existing conversation
  • max_tokens (optional): Token limit
  • temperature (optional): Creativity (0.0-1.0)

Supported Adapters:

  • gpt4o - GPT-4 Optimized
  • gpt4o-mini - GPT-4 Mini (faster, cheaper)
  • claude3sonnet - Claude 3 Sonnet
  • claude3haiku - Claude 3 Haiku
  • gemini - Google Gemini
  • gemini-pro - Google Gemini Pro

#list_conversations​

List your AI conversation history.

Parameters: None

#list_adapters​

List all available AI adapters and their current status.

Parameters:

  • format (optional): Output format - json (default), table, or list
  • show_unavailable (optional): Include unavailable adapters (default: false)

Example Usage​

In GitHub Copilot Chat:

#generate_ai_prompt adapter:gpt4o message:"Explain quantum computing" max_tokens:200
#list_conversations
#list_adapters
#list_adapters format:table show_unavailable:true

Verification​

Check Server Status​

  1. Open Command Palette (Ctrl/Cmd+Shift+P)
  2. Run MCP: List Servers
  3. Look for cwcloud-mcp (running)

Test Tools​

  1. Open GitHub Copilot Chat
  2. Type # and see if tools appear in autocomplete
  3. Try a simple generation:
    #generate_ai_prompt adapter:gpt4o message:"Hello world"

Manual Testing​

Test the server directly:

./test-interactive.sh # Full API integration test

Troubleshooting​

Server Not Appearing​

  1. Restart VS Code completely (not just reload window)
  2. Check that binary path in mcp.json is absolute and correct
  3. Verify .env file has valid credentials
  4. Check VS Code output panel for MCP-related errors

Authentication Errors​

  1. Verify API keys at CWCloud Console
  2. Check API URL is correct (default: https://api.cwcloud.tech)
  3. Ensure credentials don't have extra spaces or characters

Tools Not Available in Chat​

  1. Confirm server shows as "running" in MCP: List Servers
  2. Try typing # to see if autocomplete works
  3. Check that GitHub Copilot extension is updated to latest version

Debug Mode​

Enable debug logging in your mcp.json:

{
"servers": {
"cwcloud-mcp": {
"env": {
"LOG_LEVEL": "debug"
}
}
}
}

Updates​

To update the server:

  1. Pull latest code: git pull
  2. Rebuild: go build -o bin/cwcloud-mcp ./cmd/server
  3. Restart VS Code

Usage Analytics​

Your CWCloud MCP server automatically tracks:

  • Token usage per model
  • Cost estimation
  • Conversation history
  • Request statistics

Use #list_conversations to see your conversation history.

Advanced Configuration​

Custom API Endpoint​

For enterprise or staging environments:

{
"env": {
"COMWORK_API_URL": "https://api.your-domain.com"
}
}

Multiple Configurations​

You can run multiple MCP servers with different configurations:

{
"servers": {
"cwcloud-production": {
"command": "/path/to/bin/cwcloud-mcp",
"env": {
"COMWORK_API_URL": "https://api.cwcloud.tech"
}
},
"cwcloud-staging": {
"command": "/path/to/bin/cwcloud-mcp",
"env": {
"COMWORK_API_URL": "https://api.staging.cwcloud.tech"
}
}
}
}

Support​