Skip to content

Chapter 4 - Copilot CLI and Skills

Get productive with GitHub Copilot CLI and learn how skills automate multi-step SAP development workflows.

  • Reading time: 40 minutes
  • Practical time: 40 minutes

Reading

Read these materials before starting the hands-on part:

Briefs

PriorityRead ThisWhy It Matters
1What is a MCPBuilds the foundation: MCP architecture, tool model, and transport types (http vs stdio).
2MCP Servers in the SAP EcosystemHelps you choose the right SAP-relevant MCP servers (official vs community) for your scenario.
3MCP Server Configuration in SAP EcosystemShows secure and production-friendly configuration patterns, including credential handling and safety flags.
4What is a SkillExplains what skills are, how they extend Copilot CLI with domain-specific workflows, and when to use them.
5Copilot CLI PlaybookCovers practical Copilot CLI workflows, commands, and patterns for day-to-day AI-assisted development.
6Copilot CLI KeybindingsQuick reference for Copilot CLI keyboard shortcuts to speed up your day-to-day workflow.

Reading Outcomes

After the reading, you should be able to:

  1. Explain MCP architecture, the tool model, and the difference between http and stdio transports.
  2. Identify and select the right SAP MCP servers — official vs. community — for a given development scenario.
  3. Configure SAP MCP servers securely without hardcoding credentials and apply safety flags before enabling write operations.
  4. Describe what skills are and how they extend Copilot CLI with domain-specific, multi-step workflows.
  5. Apply practical Copilot CLI commands and workflows for day-to-day AI-assisted development.
  6. Use Copilot CLI keyboard shortcuts to navigate and interact efficiently.

Practical

Prerequisite

To be able to configure the ARC-1 MCP Server, Node.js 22 or higher is required. Make sure Node.js is installed before starting Exercise 2.

Download Node.js — select version 22 (LTS) or later for your operating system.

Exercise 1 - Install and Configure Copilot CLI

Installation

  1. Create a Folder for Copilot CLI (e.g. "C:\Copilot CLI")
  2. Open Folder in PowerShell
  3. Install Copilot CLI with WinGet (Windows Powershell)
shell
winget install GitHub.Copilot

Alternative ways to Install Copilot CLI

  1. Restart your computer

Starting Copilot CLI for the first time

  1. Start CLI session in PowerShell
shell
copilot

Change directory

You can change the working directory using the command (use TAB for autocomplete)

bash
cd <folder_name>

or navigate upwards using

bash
cd ..
  1. Confirm the Folder can be trusted (either only for this session or for future sessions too)
  2. To Login type /login then choose 1. GitHub.com.
  3. One-time code will be generated and a new window will be opened in your default browser. Alternatively click on the link shown in Copilot CLI.
  4. Authorize GitHub login with your Copilot User.

Write your first prompt in CLI

  1. Enter the following prompt in CLI
text
What are the main building blocks of a SAP RAP BO?
  1. Copilot CLI should return a reply for your question.

Exercise 1 - Outcome:

  • Copilot CLI was installed and configured.
  • Copilot CLI can be used for prompts.

Exercise 2 - Add an MCP Server and Test communication with SAP System

Add an MCP Server

  1. In Copilot CLI type /mcp add
  • Unique Server name
shell
s4d-200-arc1

Cannot see what field is what?

If you cannot see what the fields are for, just empty lines, please maximize the window.

Recommended Naming Conventions

Pick the pattern that matches your landscape complexity. A good name is short, unambiguous, and includes only the segments you need to tell configurations apart.

  • <SAP_SYSTEM_ID> e.g. s4d
  • <SAP_SYSTEM_ID>-<SAP_CLIENT> e.g. s4d-200
  • <SAP_SYSTEM_ID>-<SAP_CLIENT>-<MCP_SERVER_NAME> e.g. s4d-200-arc-1
  • <SAP_SYSTEM_ID>-<SAP_CLIENT>-<MCP_SERVER_NAME>-<PROJECT_NAME> e.g. s4d-200-arc-1-insurance
  • For Server Type choose 1. STDIO
  • Command
shell
npx -y arc-1@0.9.11
  • Environment Variables
shell
{
    "SAP_URL": "https://your-sap-host:44300",
    "SAP_USER": "YOUR_USER",
    "SAP_PASSWORD": "YOUR_PASS",
    "SAP_CLIENT": "100"
}
How to find your SAP URL and port
  • Run T-Code SICF > Find service /DEFAULT_HOST/SAP/BC/ADT
  • Right-click the service → Test Service
  • Copy the host and port from the URL that opens in the browser — use that as your SAP_URL
  1. Save MCP Server (CTRL + S)
  2. Return to CLI command line
  3. Optional Type /mcp reload to reload the mcp servers
  4. Optional Type /mcp show or /mcp show s4d-200-arc1 to check the status of mcp server

More details @ ARC-1 - path A read and search only

Alternative

MCP Server can be added directly in C:\Users\YourUser.copilot\mcp-config.json. It is also possible to define MCP Servers on project (workspace) level by defining a Working Directory (CWD) and placing a .mcp.json or .github/mcp.json file in the project root folder.

Test MCP Server

  1. Enter the following prompt in CLI
shell
Select top 3 Classes for "ZCL*" using mcp server s4d-200-arc1.
  1. CLI should provide a reply with the top 3 Classes from S4D/200 which start with ZCL*.

  2. Try Create new Class "ZCL_YourInitials_SIMPLE_OUTPUT"

text
create new class "ZCL_***YourInitials***_SIMPLE_OUTPUT". 
The Class must implement the Interface "if_oo_adt_classrun" and the Method "main" should output the "Hello World".
Use mcp server s4d-200-arc1 to create the Class.

Not getting anywhere?

In case you notice the AI strugling in creating the class please change the model using command /model. Highly recommend Claude Opus 4.6+ for coding.

  1. CLI won't be able to perform the task, since it is currently configured in read-only mode.

Exercise 2 - Outcome:

  • MCP Server was configured.
  • Copilot CLI can reach the SAP backend system.
  • Copilot CLI has read-only permissions.

Exercise 3 - Add write access to MCP Server

  1. Type /mcp edit s4d-200-arc1
  2. Set the necessary Environment Variables to give your MCP Server write access

More details @ ARC-1 - path B full local development

shell
{
    "SAP_URL": "https://your-sap-host:44300",
    "SAP_USER": "YOUR_USER",
    "SAP_PASSWORD": "YOUR_PASS",
    "SAP_CLIENT": "100",
    "SAP_ALLOW_WRITES": "true",
    "SAP_ALLOW_DATA_PREVIEW": "true",
    "SAP_ALLOW_FREE_SQL": "true",
    "SAP_ALLOW_TRANSPORT_WRITES": "true",
    "SAP_ALLOWED_TRANSPORTS": "S4DK*, DEVK*", 
    "SAP_ALLOWED_PACKAGES": "$TMP,Z*"
}
  1. Save MCP Server (CTRL + S)
  2. Return to CLI command line
  3. Optional Type /mcp reload to reload the mcp servers
  4. Optional Type /mcp show or /mcp show s4d-200-arc1 to check the status of mcp server
  5. Return to CLI command line and enter the following prompt
text
Create a new class "ZCL_***YourInitials***_SIMPLE_OUTPUT". 
The Class must implement the Interface "if_oo_adt_classrun" and the Method "main" should output the "Hello World".
Use mcp server s4d-200-arc1 to create the Class.
  1. Confirm the tools
  2. CLI was able to create and activate the class "ZCL_YourInitials_SIMPLE_OUTPUT".
  3. Check the results in your preferred IDE (Eclipse, VSCode, SAP GUI)

Exercise 3 - Outcome:

  • Copilot CLI can create and modify SAP artefacts via MCP Server.

Exercise 4 - Create new Skill in CLI

A skill is a folder with a SKILL.md file that teaches Copilot to perform a specific, repeatable task. In this exercise you will create the abap-unit-tester skill — a skill that automatically creates, adjusts, and removes unit test methods whenever a Z* ABAP class changes.

Create the Skill folder and file

  1. Navigate to your personal Copilot skills folder (create it if it doesn't exist):
shell
C:\Users\YourUser\.copilot\skills\
  1. Inside that folder, create a new subfolder for the skill:
shell
abap-unit-tester\
  1. Download the prepared skill file and place it inside abap-unit-tester\:

    👉 Download SKILL.md

The resulting structure should look like this:

C:\Users\YourUser\.copilot\skills\
└── abap-unit-tester\
    └── SKILL.md

Verify the skill is loaded

  1. Open (or restart) a Copilot CLI session
  2. Type /skills to list all loaded skills
  3. Confirm abap-unit-tester appears in the list

Skills stored in ~/.copilot/skills/ are personal and available across all your projects.
To share a skill with your team, place it in .github/skills/ inside your project repository instead.

Exercise 4 - Outcome:

  • The abap-unit-tester skill was created and is visible in the CLI session.

Exercise 5 - Test the Skill — Adjust a method and generate unit tests

In this exercise you will verify that the abap-unit-tester skill works correctly by adding a new method to the class created in Exercise 3 and instructing Copilot to generate the corresponding unit tests.

Add a new method to the class

  1. Enter the following prompt in CLI:
text
Adjust the method "main" of class "ZCL_YourInitials_SIMPLE_OUTPUT", so the new output text is "Hello, <First Name> <Last Name>". 
Variables <First Name> and <Last Name> should be read dynamically from the system. 
Use mcp server s4d-200-arc1.
  1. Confirm the tools and verify Copilot makes the adjustments to the method.

Generate unit tests with the skill

  1. Enter the following prompt in CLI:
text
Use the abap-unit-tester skill to create unit tests for class "ZCL_YourInitials_SIMPLE_OUTPUT".
Use mcp server s4d-200-arc1.
  1. Confirm the tools — Copilot should:
    • Create a local test class ltc_cl_yourinitials_simple_output in the test include (leading Z stripped, name lowercased)
    • Generate test_main_positive — calls main with a valid user context and asserts the greeting contains a name
    • Generate test_main_negative — calls main in a context where the user name cannot be resolved and asserts appropriate fallback or error handling
    • Activate the test include

Run the unit tests

  1. Enter the following prompt in CLI:
shell
Run unit tests for class "ZCL_YourInitials_SIMPLE_OUTPUT" using mcp server s4d-200-arc1.
  1. All tests should pass with ≥90% code coverage.

Exercise 5 - Outcome:

  • The abap-unit-tester skill generated positive and negative unit tests for the main method.
  • The test class is named ltc_cl_yourinitials_simple_output.
  • All unit tests pass with ≥90% code coverage.

What's Next

Continue with Chapter 5 - Plan Mode to use your configured CLI and MCP setup to design a structured implementation plan before writing any code.

Copyright © MSG Systems Romania AI Labs