# MCP Installation in VSCode

{% hint style="info" %}
Please see [Xygeni CLI Prerequisites](https://docs.xygeni.io/~/changes/358/xygeni-scanner-cli/xygeni-cli-overview/xygeni-cli-prerequisites) before installing.
{% endhint %}

1. Install and configure Xygeni VSCode Plugin
2. Login in Copilot using Github
3. Change Copilot mode to Agent
4. Create mcp.json file

{% tabs %}
{% tab title="mac/Linux" %}
Create the following file on this path:

```
home/{USER}/.config/Code/User
```

{% hint style="info" %}
Change {USER} and {TOKEN} with your username and a Xygeni token
{% endhint %}

```
{
  "servers": {
    "xygeni-mcp-server": {
      "timeout": 60,
      "type": "stdio",
      "command": "java",
      "args": [
        "-jar",
        "/home/{USER}/.vscode/extensions/xygeni-security.xygeni-scanner-vscode-1.2.6/.xygeni-mcp/xygeni-mcp-server.jar",
        "--scannerPath=/home/{USER}/.vscode/extensions/xygeni-security.xygeni-scanner-vscode-1.2.6/.xygeni"
      ],
      "env": {
        "JAVA_HOME": "/home/{USER}/.sdkman/candidates/java/current",
        "XYGENI_URL": "https://api.xygeni.io",
        "XYGENI_TOKEN": "{TOKEN}"
      }
    }
  }
}
```

{% endtab %}

{% tab title="Windows" %}
Create the following file on this path:

```
C:\Users\<TuUsuario>\AppData\Roaming\Code\User
```

{% hint style="info" %}
Change {USER} and {TOKEN} with your username and a Xygeni token
{% endhint %}

```
{
  "servers": {
    "xygeni-mcp-server": {
      "timeout": 60,
      "type": "stdio",
      "command": "java",
      "args": [
        "args": [
        "-jar",
        "C:/Users/{USER}/.vscode/extensions/xygeni-security.xygeni-scanner-vscode-1.2.6/.xygeni-mcp/xygeni-mcp-server.jar",
        "--scannerPath=C:/Users/{USER}/.vscode/extensions/xygeni-security.xygeni-scanner-vscode-1.2.6/.xygeni"
      ],
      "env": {
        "JAVA_HOME": "C:/Program Files/Java/jdk-21",
        "XYGENI_URL": "https://api.xygeni.io",
        "XYGENI_TOKEN": "{TOKEN}"
      }
    }
  }
}
```

{% endtab %}
{% endtabs %}

5. Restart VSCode
6. MCP is installed, but it is usually disabled by default. For enable it, go to configure tools:

<img src="https://docs.xygeni.io/~gitbook/image?url=https%3A%2F%2F4096647782-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUTz59rJLkJBjiRWAMknU%252Fuploads%252FpgSMSjfvJilrD0SW5HRs%252Fimage.png%3Falt%3Dmedia%26token%3Da52f64e2-7470-4ce3-a33f-1f25ddf20fa1&#x26;width=768&#x26;dpr=3&#x26;quality=100&#x26;sign=9957f0ea&#x26;sv=2" alt="" height="160" width="345">

7. Open xygeni-mcp-server and select all tools

<img src="https://docs.xygeni.io/~gitbook/image?url=https%3A%2F%2F4096647782-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUTz59rJLkJBjiRWAMknU%252Fuploads%252F6WV9MQLUclB5qKdXLPv8%252Fimage.png%3Falt%3Dmedia%26token%3Dddc0f368-e0d1-4dbe-b853-2da413e4b293&#x26;width=768&#x26;dpr=3&#x26;quality=100&#x26;sign=2fa6373c&#x26;sv=2" alt="" height="371" width="601">

8. Now, if you ask copilot to analyze or scan your code for vulnerabilities, he will ask for permission to launch xygeni app.

<img src="https://docs.xygeni.io/~gitbook/image?url=https%3A%2F%2F4096647782-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUTz59rJLkJBjiRWAMknU%252Fuploads%252FfiaRmigCO5o4omiV1RkG%252Fimage.png%3Falt%3Dmedia%26token%3D6f09c642-7399-4c31-9a3f-ac83716491bc&#x26;width=768&#x26;dpr=3&#x26;quality=100&#x26;sign=8c4a4c33&#x26;sv=2" alt="" height="439" width="325">


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.xygeni.io/xygeni-products/ide-workspace-scanning/mcp-installation-in-vscode.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
