Setup GitHub Copilot MCP Integration

Connect GitHub Copilot, the Copilot CLI or Copilot in Visual Studio Code to an EnvisionSCADA server through the Model Context Protocol (MCP).

Updated 8 min read
On this page (10 sections)
  1. Overview
  2. Before you start
  3. Quick start: ask Copilot to connect
  4. Step 1: Create the login token
  5. Step 2: Add the server in GitHub Copilot
  6. Step 3: Check the connection
  7. HTTPS and OAuth 2.0
  8. Visual Studio Code
  9. Instructions for AI assistants
  10. Troubleshooting

Every EnvisionSCADA server contains an MCP (Model Context Protocol) server at the address /mcp. GitHub Copilot connects to it directly over HTTP or HTTPS. No additional software or proxy script is required.

This article describes GitHub Copilot, the desktop application for Windows, macOS and Linux, and the Copilot CLI, which share their MCP servers, and Copilot in Visual Studio Code. Use the quick start to connect from a session, or add the server for a permanent connection.

A new installation runs on port 80, so the MCP address on the same computer is:

MCP address of a new installation
http://localhost/mcp

Before you start

  • EnvisionSCADA is running. Open http://localhost in a browser to check this.
  • GitHub Copilot or the Copilot CLI (command copilot) is installed and signed in to a GitHub account with Copilot access.
  • An EnvisionSCADA user account. Members of the Administrators group get the configuration and design tools; other users get the read-only runtime tools. A new installation contains the user Admin with password Admin.

Quick start: ask Copilot to connect

The fastest way to connect is to ask Copilot. In a session of GitHub Copilot, or in Copilot Chat in Agent mode in Visual Studio Code, type a request with the MCP address and an EnvisionSCADA user account. Copilot then calls the MCP endpoint itself over HTTP. No token or configuration is required.

Replace <password> with the password of the account. The link points Copilot to the section Instructions for AI assistants at the end of this article, which describes how to call the endpoint.

Request in a Copilot session
Connect to the EnvisionSCADA MCP server at http://localhost/mcp with user Admin and password <password>. Follow https://www.envisionscada.com/KnowledgeBase/how-to/github-copilot-mcp#instructions-for-ai-assistants

This connection is available in that session only. Copilot calls the tools through terminal commands and asks for approval according to its tool permission level. For a permanent connection, add the server as described below.

The password is part of the chat. Use the quick start for testing and commissioning, or use a dedicated EnvisionSCADA account, and add the server permanently for daily use.

Step 1: Create the login token

Copilot logs in with HTTP Basic authentication. The MCP form asks for the login as a token. Run the command below in PowerShell to convert the user name and password into a token. Replace Admin:<password> with your own user name and password, separated by a colon. Copy the result, it is used in Step 2. For the user Admin with password Admin of a new installation, the result is QWRtaW46QWRtaW4=.

PowerShell
[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("Admin:<password>"))

Step 2: Add the server in GitHub Copilot

Add the server through the MCP form of GitHub Copilot. No file needs to be edited.

  • Click Customize in the sidebar and open the MCP tab.
  • Click Add in the top right corner.
  • Enter a Server name, for example EnvisionSCADA, and select the Server type HTTP.
  • Next to URL, enter the MCP address, for example http://localhost/mcp.
  • Under Headers, enter Authorization as Name and the value below as Value, with <token> replaced by the result of Step 1. Leave OAuth Client ID empty.
  • Click Save.
Header value
Basic <token>
Header value for the user Admin with password Admin (new installation)
Basic QWRtaW46QWRtaW4=
MCP Server form in GitHub Copilot for the user Admin with password Admin

Instead of the app, the server can be added with the Copilot CLI: run copilot, type /mcp add and fill in the same values in the form (server type HTTP, URL, and {"Authorization": "Basic <token>"} under HTTP Headers), or use the command below. Servers added in the Copilot CLI are also available in GitHub Copilot.

Terminal
copilot mcp add --transport http --header "Authorization: Basic <token>" envisionscada http://localhost/mcp

Adjust the address to your situation:

EnvisionSCADA runs on another computerReplace localhost with the computer name or IP addresshttp://192.168.1.20/mcp
EnvisionSCADA runs on another portAdd the port to the addresshttp://localhost:8080/mcp
EnvisionSCADA uses HTTPSUse the https addresshttps://scada.example.com/mcp
The token contains the user name and password and is stored in the Copilot configuration of your Windows user account. Do not add the server to a project file such as .mcp.json that is shared through Git.

Step 3: Check the connection

In GitHub Copilot, click Customize in the sidebar and open the Installed tab. The server is listed and its switch is on.

Then ask in a session, for example: What is the status of the EnvisionSCADA server? Copilot answers with the runtime and redundancy status of the server.

HTTPS and OAuth 2.0

Use HTTPS when GitHub Copilot connects to EnvisionSCADA on another computer, so that the login is encrypted on the network. Use the https address in Step 2, with a certificate issued by a certificate authority that the computer running GitHub Copilot trusts.

With OAuth 2.0, GitHub Copilot signs in through the Authorize MCP access page of EnvisionSCADA instead of storing the login token. Turn on Enable MCP OAuth 2.0 in the MCP OAuth section of the Parameters page first. AI apps accept OAuth over plain HTTP only for localhost. The parameters, the endpoints and the server actions that sign clients out are described under HTTPS and OAuth 2.0 in Setup Claude Code MCP Integration.

  • Add the server in Step 2 without the Authorization header and leave OAuth Client ID empty.
  • When GitHub Copilot connects, the Authorize MCP access page of EnvisionSCADA opens in the browser.
  • Sign in with an EnvisionSCADA account.
A restart of the EnvisionSCADA application signs GitHub Copilot out, because refresh tokens are kept in memory. Sign in again.

Visual Studio Code

Copilot in Visual Studio Code reads its MCP servers from an mcp.json file. Create the file .vscode\mcp.json in the workspace folder with the content below. To register the server for all workspaces, run MCP: Open User Configuration from the Command Palette and add the same content there. The token is not stored in the file: Visual Studio Code asks for it once when the server starts and keeps it in its secure storage.

.vscode\mcp.json
{
  "servers": {
    "envisionscada": {
      "type": "http",
      "url": "http://localhost/mcp",
      "headers": {
        "Authorization": "Basic ${input:envisionscada-token}"
      }
    }
  },
  "inputs": [
    {
      "type": "promptString",
      "id": "envisionscada-token",
      "description": "EnvisionSCADA login token",
      "password": true
    }
  ]
}
  • Run MCP: List Servers from the Command Palette, select envisionscada and start it. Review the trust prompt before you accept it.
  • Enter the token from Step 1 when Visual Studio Code asks for EnvisionSCADA login token.
  • Open Copilot Chat, select Agent mode and enable the tools of envisionscada under Configure Tools.

Instructions for AI assistants

This section is written for the AI assistant that receives the quick start request. Connect to the EnvisionSCADA MCP endpoint directly over HTTP as described below. The connection works in the current session, without registering the server and without a restart. Ask the user for the password when the request contains <password>, and do not store the password in project files.

  • Send every request as HTTP POST to the MCP address from the request, for example http://localhost/mcp, with the headers Content-Type: application/json, Accept: application/json, text/event-stream and Authorization: Basic <base64 of user:password>. Basic authentication is also accepted when OAuth 2.0 is turned on in EnvisionSCADA.
  • The body is JSON-RPC 2.0. Call initialize first, then tools/list to read the tool names and their input schemas, then tools/call with name and arguments. Call the tool get_server_status to confirm the connection.
  • The server is stateless and returns no Mcp-Session-Id. Every request is independent.
  • Responses are Server-Sent Events. Join the lines that start with data: and parse them as JSON.
  • Write a small reusable helper script once and call it for each request. Pass the tool arguments through a JSON file, not as a command-line string: quoting on the command line strips the inner double quotes, and the server then answers HTTP 500 with "id": null.
  • Use only the tool names and fields that tools/list returns. When a configuration write fails with Unknown field, call get_config_entity_type_schema for the entity type and use the exact field names it returns.
  • Members of the Administrators group get the configuration, design and runtime tools; other users get the read-only runtime tools. HTTP 401 means a wrong user name or password.
  • For an https address whose certificate is not trusted, ask the user how to continue instead of turning off certificate validation.

PowerShell helper for Windows, tested against EnvisionSCADA, and example calls:

mcp.ps1
param(
    [Parameter(Mandatory)] [string] $Url,        # e.g. http://localhost/mcp
    [Parameter(Mandatory)] [string] $User,
    [Parameter(Mandatory)] [string] $Password,
    [Parameter(Mandatory)] [string] $Method,     # initialize | tools/list | tools/call
    [string] $Tool,                              # tool name for tools/call
    [string] $ArgsFile                           # JSON file with the tool arguments
)
$token = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("${User}:${Password}"))
$params = @{}
if ($Method -eq 'initialize') {
    $params = @{ protocolVersion = '2025-06-18'; capabilities = @{}; clientInfo = @{ name = 'ai-helper'; version = '1' } }
} elseif ($Method -eq 'tools/call') {
    $arguments = if ($ArgsFile) { Get-Content -Raw $ArgsFile | ConvertFrom-Json } else { @{} }
    $params = @{ name = $Tool; arguments = $arguments }
}
$body = @{ jsonrpc = '2.0'; id = 1; method = $Method; params = $params } | ConvertTo-Json -Depth 50 -Compress
$response = Invoke-WebRequest -UseBasicParsing -Uri $Url -Method Post -ContentType 'application/json' `
    -Headers @{ Authorization = "Basic $token"; Accept = 'application/json, text/event-stream' } `
    -Body ([Text.Encoding]::UTF8.GetBytes($body))
$text = [Text.Encoding]::UTF8.GetString($response.RawContentStream.ToArray())
$data = ($text -split "`n" | Where-Object { $_ -like 'data:*' } | ForEach-Object { $_.Substring(5).Trim() }) -join ''
if (-not $data) { $data = $text }
$data
Example calls
# Write the tool arguments to a file, never on the command line
Set-Content -Path args.json -Value '{"subscribeVars":["Pump1_Speed"]}' -Encoding UTF8

.\mcp.ps1 -Url http://localhost/mcp -User Admin -Password <password> -Method initialize
.\mcp.ps1 -Url http://localhost/mcp -User Admin -Password <password> -Method tools/list
.\mcp.ps1 -Url http://localhost/mcp -User Admin -Password <password> -Method tools/call -Tool get_server_status
.\mcp.ps1 -Url http://localhost/mcp -User Admin -Password <password> -Method tools/call -Tool get_data -ArgsFile args.json

On macOS and Linux, send the same request with curl:

curl
curl -s -X POST http://localhost/mcp \
  -u 'Admin:<password>' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_server_status","arguments":{}}}'

Troubleshooting

Server missing under Installed, or its switch is offThe form was not saved, or the server is disabledAdd the server again in the MCP tab, or turn on its switch under Installed
Connection refusedEnvisionSCADA is not running, or the address or port is wrongOpen the address without /mcp in a browser and check that EnvisionSCADA responds
401 UnauthorizedWrong user name or password in the token, or the header was not enteredRepeat Step 1 with username:password and update the Authorization header of the server
Tools not visible in Copilot Chat in Visual Studio CodeCopilot Chat is not in Agent mode, or the tools are not enabledSelect Agent mode and enable the tools of envisionscada
Configuration and design tools missingThe user is not a member of the Administrators groupUse an account of the Administrators group in Step 1
Something missing or wrong in this article? Contact us