The Microsoft C++ Language Server is currently in preview and may be subject to change in future releases.
Microsoft C++ Language Server brings the same C++ code intelligence used in Visual Studio and VS Code to GitHub Copilot CLI on Windows, macOS, and Linux. It provides fast, accurate understanding of C++ codebases with features like symbol search and semantic navigation.
- Run
npm install -g @microsoft/cpp-language-server. - Run
mscppls --accept-eula --loginto accept the license terms and login to GitHub. An active GitHub Copilot subscription is required. - Create a
compile_commands.jsonfile for your project. For CMake projects, try adding-DCMAKE_EXPORT_COMPILE_COMMANDS=ONduring configuration, which will create acompile_commands.jsonin the CMake binary (output) directory, or use this skill. For MSBuild (vcxproj) projects, see this sample application to extractcompile_commands.jsonfrom C++ MSBuild projects. - Create
.github/lsp.jsonto configure GitHub Copilot CLI to use the language server.
{
"lspServers": {
"cpp": {
"command": "mscppls",
"args": ["--lsp-config", ".mscppls/cpp-lsp.json"],
"fileExtensions": {
".cpp": "cpp",
".cxx": "cpp",
".c": "cpp",
".cc": "cpp",
".hpp": "cpp",
".hxx": "cpp",
".hh": "cpp",
".h": "cpp"
},
"requestTimeoutMs": 1000000
}
}
}- Create
.mscppls/cpp-lsp.jsonto set the path tocompile_commands.jsonand the project root directory. All paths in this example are relative to.mscppls. Adjust thecompileCommandspath to match your project's build output directory.
{
"version": 1,
"repositoryPath": "../",
"compileCommands": "../build/compile_commands.json"
}- Launch GitHub Copilot CLI from your project root directory.
- Within GitHub Copilot CLI, run
/lsp show. You should see a "cpp" server running. - Use GitHub Copilot CLI like normal, now with enhanced C++ capabilities. To nudge the agent to use the tools, try adding phrases like "use LSP tools" to your prompt.
To report a problem or suggest an improvement to the Microsoft C++ Language Server, open an issue on this repo. Please include the operating system, version of GitHub Copilot CLI and Microsoft C++ Language Server (reported with --version), and any relevant configuration or project files in your report.
Additional detailed logs are stored in a workspace-specific directory under $TEMP/mscppls. Before attaching any logs to a public issue, review the content of the log to remove any sensitive information.
The Microsoft C++ Language Server is distributed via npm.
- Install:
npm install -g @microsoft/cpp-language-server - Update:
npm update -g @microsoft/cpp-language-server - Uninstall:
npm uninstall -g @microsoft/cpp-language-server
Installing the Microsoft C++ Language Server will add a new executable named mscppls to your environment. This executable acts both as an LSP server and as a utility to set certain configuration options.
- Windows: x64, arm64
- macOS: x64, arm64
- Linux (glibc): x64, arm64, arm32 (Ubuntu 18.04+, Debian 10+, RHEL 8+)
- Linux (musl/Alpine): x64, arm64, arm32 (Alpine 3.x+)
On Linux, the language server loads libcurl and libsecret at runtime for
telemetry, authentication, and credential storage.
Most distributions include these by default. If they are missing:
- Debian/Ubuntu:
sudo apt-get install libcurl4 libsecret-1-0 gnome-keyring - RHEL/CentOS:
sudo yum install libcurl libsecret gnome-keyring - Alpine:
apk add libcurl libsecret gnome-keyring
On ARM (arm64/arm32), libatomic is also required:
- Debian/Ubuntu:
sudo apt-get install libatomic1 - Alpine:
apk add libatomic
gnome-keyring is needed to save authentication tokens securely. On headless
environments (WSL, SSH, containers) where no keyring daemon is available, the
server will prompt with alternative options.
Before using the Microsoft C++ Language Server, you must accept the end-user license agreement (EULA), which is distributed as EULA/LICENSE.txt in the npm package. Accept the agreement by running mscppls --accept-eula. You only need to accept the EULA once.
Using the Microsoft C++ Language Server requires an active GitHub Copilot subscription. Before using the language server for the first time, log in to GitHub by running mscppls --login and following the on-screen instructions.
By default, the language server stores your GitHub tokens in system secret storage. On Linux, this requires libsecret. If you are running the language server in a constrained environment where system secret storage is unavailable, run mscppls --login --allow-plaintext-secret-storage to allow storing the tokens in plaintext.
Alternatively, you can independently generate a GitHub token (such as a PAT) and save it in the MSCPPLS_GITHUB_TOKEN environment variable. The token does not need to have any scopes.
The Microsoft C++ Language Server depends on 3 configuration files:
.github/lsp.jsonconfigures GitHub Copilot CLI to use the Microsoft C++ Language Server for C++ files, and sets the command line arguments passed tomscppls. See the quick start example for how to create this file..mscppls/cpp-lsp.jsonsets the path to the project root and the path to thecompile_commands.jsonfile. See the quick start example for how to set therepositoryPathandcompileCommandsproperties in this file.repositoryPathandcompileCommandscan be relative or absolute paths. If relative, they are resolved relative to the directory containingcpp-lsp.json. By changing the--lsp-configargument in.github/lsp.json,cpp-lsp.jsoncan be stored at any user-defined path.versionmust always be1.compile_commands.jsonspecifies the command line to build each target in the project. Details for how to generate this file depend on the build system the project uses.
By default, logs and caches are stored in a workspace-specific directory under $TEMP/mscppls. The log directory can be overridden with the --log-dir argument.
CMake projects that use the Ninja or Makefile generators can easily create a compile_commands.json by setting the CMAKE_EXPORT_COMPILE_COMMANDS variable during configuration. For CMake projects that typically use other generators, first check if it is possible as a one-off to configure the project using the Ninja or Makefile generator, as this is the easiest way to get compile_commands.json.
For AI assistance with this step, try adding this skill to GitHub Copilot CLI and running it. Learn more about skills with the GitHub Copilot CLI documentation.
Improved support for MSBuild projects is planned for a future release of the Microsoft C++ Language Server.
For now, refer to this sample application for an example of how to generate compile_commands.json from MSBuild projects. While the sample application is designed to work out-of-the-box for many projects, it may require adaptation for complex projects.
Refer to your build system vendor's documentation.
| Option | Description |
|---|---|
--help or -h |
Shows a help message with a description of all options. |
--version |
Shows version information and exits. |
--accept-eula |
Permanently accepts the end-user license agreement (EULA). The EULA only needs to be accepted once. However, it is safe to redundantly include this option with any other option, which can be helpful in automated environments. |
--stderr |
Do not redirect stderr to /dev/null. Useful for debugging. |
--login |
Interactively log in to GitHub. |
--force-login |
Force interactive login, even if the user has already logged in. |
--allow-plaintext-secret-storage |
Allow storing credentials in plaintext if secure system storage is unavailable. |
--log-dir <path> |
Specify the directory for log files. If unspecified, the system temp directory is used. |
--log-level <level> |
Set the logging verbosity from 0 (errors only) to 9 (verbose). |
--lsp-config <path> |
Path to the cpp-lsp.json file. If relative, the path will be resolved relative to the current working directory of the mscppls process, which is typically the project root when launched from GitHub Copilot CLI. |
--disable-telemetry |
Permanently disables sending telemetry data. |
| Feature | Status | Notes |
|---|---|---|
| Text document sync | β | AI agent is expected to update files on disk before invoking LSP operations. |
| Hover | β | |
| Completion | β | |
| Signature help | β | |
| Go to Definition | β | |
| Find References | β | |
| Document Highlight | β | |
| Document Symbols | β | |
| Workspace Symbols | β | |
| Code Action | β | |
| Code Lens | β | |
| Document Formatting | β | |
| Range Formatting | β | |
| On type Formatting | β | |
| Rename | β | |
| Go to Declaration | β | |
| Go to Type Definition | β | |
| Call Hierarchy | β |
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoftβs privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-partyβs policies.
