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​

AI 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)

Environment Management Tools​

#list_environments​

List all your cloud environments (user access).

Parameters:

  • format (optional): Output format - table (default), json, or list

Example:

#list_environments format:table

#get_environment​

Get detailed information about a specific environment (user access).

Parameters:

  • id (required): ID of the environment to retrieve
  • format (optional): Output format - json (default), table, or list

Example:

#get_environment id:15 format:json

Admin Environment Tools (Requires Admin Privileges)​

#admin_list_environments​

List environments with admin privileges and enhanced details.

Parameters:

  • format (optional): Output format - table (default), json, or list
  • include_stats (optional): Include usage statistics (default: false)

#admin_create_environment​

Create new cloud environments with admin privileges.

Parameters:

  • name (required): Environment name
  • description (optional): Environment description
  • path (required): Environment path
  • is_private (optional): Private environment (default: false)

Project Management Tools​

#list_projects​

List all your projects.

Parameters:

  • format (optional): Output format - table (default), json, or list

#get_project​

Get detailed information about a specific project.

Parameters:

  • project_id (required): ID of the project to retrieve

Instance Management Tools​

#list_instances​

List all your VM instances.

Parameters:

  • format (optional): Output format - table (default), json, or list

#create_instance​

Create new VM instances.

Parameters:

  • name (required): Instance name
  • type (optional): Instance type
  • region (optional): Cloud region

Storage Management Tools​

#list_buckets​

List all your storage buckets.

Parameters:

  • format (optional): Output format - table (default), json, or list

#create_bucket​

Create new storage buckets.

Parameters:

  • name (required): Bucket name
  • region (optional): Storage region

Function Management Tools​

#list_functions​

List all your serverless functions.

Parameters:

  • format (optional): Output format - table (default), json, or list

#invoke_function​

Execute serverless functions.

Parameters:

  • function_id (required): Function ID to invoke
  • payload (optional): Function payload

User Management Tools​

#list_users​

List all system users.

Parameters:

  • format (optional): Output format - table (default), json, or list

#create_user​

Create new system users.

Parameters:

  • username (required): Username
  • email (required): Email address
  • password (required): User password

DNS Management Tools​

#list_dns_records​

List all your DNS records.

Parameters:

  • format (optional): Output format - table (default), json, or list

#create_dns_record​

Create new DNS records.

Parameters:

  • name (required): Record name
  • type (required): Record type (A, AAAA, CNAME, MX, etc.)
  • content (required): Record content
  • zone (required): DNS zone

Example:

#create_dns_record name:api.example.com type:A content:192.168.1.100 zone:example.com

Complete Tool List (119 Total)​

The CWCloud MCP Server provides 119 comprehensive tools across 10 categories:

  • AI Tools (3): AI generation, conversations, adapters
  • Environment Management (11): Full CRUD + admin operations
  • Project Management (7): Complete project lifecycle
  • Instance Management (10): VM operations with admin controls
  • Storage Management (10): Bucket operations with admin controls
  • Registry Management (10): Container registry operations
  • Function Management (12): Serverless with invocation
  • Monitoring Management (10): Endpoint monitoring
  • User Management (10): Complete user lifecycle
  • DNS Management (10): DNS record management

Each category includes both user-level and admin-level tools for comprehensive cloud management.

  • format (optional): Output format - json (default), detailed, or summary

Example:

#get_environment id:123 format:detailed

Admin Environment Tools (Requires Admin Privileges)​

#admin_list_environments​

List environments with enhanced admin details and statistics.

Parameters:

  • format (optional): Output format - table (default), json, or list
  • include_stats (optional): Include additional statistics (default: false)

Example:

#admin_list_environments format:table include_stats:true

#admin_get_environment​

Get environment details with admin metadata and additional information.

Parameters:

  • id (required): ID of the environment to retrieve
  • include_metadata (optional): Include admin metadata (default: false)

Example:

#admin_get_environment id:123 include_metadata:true

#admin_create_environment​

Create a new cloud environment (admin only).

Parameters:

  • name (required): Name for the environment
  • description (required): Description of the environment
  • path (required): Path/identifier for the environment
  • is_private (required): Whether the environment is private (true/false)
  • roles (required): Array of user roles/permissions (can be empty array)
  • logo_url (optional): Logo URL for the environment
  • provider (optional): Cloud provider
  • region (optional): Deployment region

Example:

#admin_create_environment name:"Production API" description:"Main production API environment" path:"prod-api" is_private:true roles:["admin","developer"] provider:"aws" region:"us-east-1"

#admin_update_environment​

Update an existing environment's properties (admin only).

Parameters:

  • id (required): ID of the environment to update
  • name (optional): New name for the environment
  • description (optional): New description
  • path (optional): New path/identifier
  • is_private (optional): Update privacy setting
  • roles (optional): Update user roles array
  • logo_url (optional): New logo URL
  • provider (optional): Update cloud provider
  • region (optional): Update region

Example:

#admin_update_environment id:123 name:"Updated API Name" description:"Updated description"

#admin_delete_environment​

Delete an environment with safety confirmation (admin only).

Parameters:

  • id (required): ID of the environment to delete
  • confirm (required): Must be true to confirm deletion
  • reason (optional): Reason for deletion (recommended for audit trail)

Example:

#admin_delete_environment id:123 confirm:true reason:"Environment no longer needed"

Example Usage​

In GitHub Copilot Chat:

AI Tools:

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

Environment Management:

#list_environments format:table
#get_environment id:123 format:detailed

Admin Environment Management (requires admin privileges):

#admin_list_environments format:table include_stats:true
#admin_get_environment id:123 include_metadata:true
#admin_create_environment name:"My App" description:"Production app environment" path:"my-app" is_private:false roles:["developer","admin"]
#admin_update_environment id:123 name:"Updated App Name" description:"Updated description"
#admin_delete_environment id:123 confirm:true reason:"No longer needed"

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​