Complete automated setup of the entire Copilot CLI+ environment with DeepSeek integration.
This script will rebuild the entire setup from scratch on any Ubuntu/Debian system.
Includes:
# Download bootstrap script wget https://your-host.com/bootstrap.sh -O bootstrap.sh chmod +x bootstrap.sh # Run with DeepSeek API key ./bootstrap.sh "sk-your-deepseek-api-key-here" # Optional flags ./bootstrap.sh "sk-..." --verbose # Detailed output ./bootstrap.sh "sk-..." --skip-tests # Skip integration tests
If you need to restore on a new system:
# 1. Copy bootstrap script scp bootstrap.sh user@newhost:/tmp/ # 2. Run on new host ssh user@newhost "cd /tmp && bash bootstrap.sh 'sk-your-key'" # 3. Verify ssh user@newhost "curl http://localhost:8888/health"
python3, pip, curl, wget, gitansible, sudoopenssh-server, openssh-clientsystemdfastapi, uvicorn, pydantic, requests/opt/local-agent/bin/api-server.py - REST API/opt/local-agent/bin/deepseek-api.py - DeepSeek wrapper/opt/local-agent/bin/mcp-server.py - Copilot CLI bridge/opt/local-agent/config/ - Configuration fileslocal-agent-api (port 8888)ollama (port 11434)local-agent (daemon)ssh (port 22)# Health check
curl http://localhost:8888/health
# Execute shell
curl -X POST http://localhost:8888/execute \
-H "Content-Type: application/json" \
-d '{"command":"whoami"}'
# Query DeepSeek
curl -X POST http://localhost:8888/deepseek \
-H "Content-Type: application/json" \
-d '{"query":"Czeลฤ!"}'
# Service status
curl http://localhost:8888/services
# API docs
curl http://localhost:8888/docs
The bootstrap script:
To rotate the key:
# Edit systemd service sudo nano /etc/systemd/system/local-agent-api.service # Update DEEPSEEK_API_KEY variable # Then reload and restart sudo systemctl daemon-reload sudo systemctl restart local-agent-api
After setup, check logs in:
tail -f /opt/local-agent/logs/api.log # API activity tail -f /opt/local-agent/logs/agent.log # Command execution
Bootstrap automatically runs tests:
โ API health check โ Services endpoint โ DeepSeek integration
To skip tests during bootstrap:
./bootstrap.sh "sk-..." --skip-tests
# Check service status systemctl status local-agent-api # Check logs journalctl -u local-agent-api -f # Restart systemctl restart local-agent-api
# Verify API key echo $DEEPSEEK_API_KEY # Check service environment systemctl show local-agent-api -p Environment # Test directly python3 /opt/local-agent/bin/deepseek-api.py "Test"
# Verify MCP config exists cat ~/.copilot/mcp-config.json # Test MCP server manually python3 /opt/local-agent/bin/mcp-server.py < /dev/null # Restart Copilot CLI copilot --restart
If you lose the host, to fully restore:
Get the bootstrap script
# From backup/git git clone <your-backup> && cd repo
Run on new system
chmod +x bootstrap.sh ./bootstrap.sh "sk-your-api-key"
Verify
curl http://localhost:8888/health copilot /mcp
(Optional) Copy custom playbooks
scp user@oldhost:/opt/local-agent/config/playbook.yml \
/opt/local-agent/config/To prepare for disaster recovery:
# 1. Backup bootstrap script cp /opt/local-agent/bootstrap.sh ~/bootstrap-backup.sh # 2. Backup custom configs tar -czf ~/agent-config-backup.tar.gz /opt/local-agent/config/ # 3. Backup documentation cp /opt/local-agent/*.md ~/agent-docs/ # 4. Store API key securely (NOT in repo) echo "DEEPSEEK_API_KEY=sk-..." > ~/.deepseek-key-backup # 5. Upload to secure location (git, S3, etc)
To restore from backup:
# 1. Extract bootstrap cp bootstrap-backup.sh /tmp/ && chmod +x /tmp/bootstrap-backup.sh # 2. Run bootstrap (API key from secure storage) /tmp/bootstrap-backup.sh "$(cat ~/.deepseek-key-backup | grep -oP 'sk-.*')" # 3. Restore custom configs tar -xzf agent-config-backup.tar.gz -C / # 4. Restart services systemctl restart local-agent-api
Start Copilot CLI
copilot
Enable MCP integration
/mcp
Select: local-agent
Test integration
"Tell me what services are running" "Execute: whoami" "Ask DeepSeek: Czeลฤ!"
Deploy custom automation
# Edit playbook nano /opt/local-agent/config/playbook.yml # Use in Copilot "Deploy using Ansible"
All configuration and logs in:
/opt/local-agent/ - Main agent directory/opt/local-agent/logs/ - All activity logs~/.copilot/mcp-config.json - MCP configuration/etc/systemd/system/local-agent*.service - Service configsCheck logs for detailed diagnostics:
journalctl -u local-agent-api -n 50 journalctl -u ollama -n 50 tail -50 /opt/local-agent/logs/*.log
Script Version: 1.0
Last Updated: 2026-03-25
Compatible: Ubuntu 20.04 LTS+, Debian 11+