# Visual Studio 2022 + GitHub Copilot

## Prerequisites

Before setting up Mobb Vibe Shield in Visual Studio, ensure the following:

#### Visual Studio version

* **Visual Studio 2022 version 17.14 or later** (MCP support is in preview)
* [Download latest VS 2022](https://visualstudio.microsoft.com/vs/)

#### GitHub Copilot permissions

If you are using GitHub Copilot through a **GitHub organization**, verify that the following settings are enabled:

* **Copilot Chat in the IDE**
* **MCP servers in Copilot**

These settings are configured in your GitHub org admin panel:\
`Settings → Copilot → Policies`

#### Node.js

Ensure **Node.js v18.20 or later** is installed as Mobb's MCP server uses `npx` to run.

```bash
node --version
```

Download from [nodejs.org](https://nodejs.org/) if needed.

***

### Step 1. Make sure GitHub Copilot is installed

Under the Visual Studio Installer, make sure GitHub Copilot is installed:

<figure><img src="/files/WNpqwYsZ9KeqSAbTaWFt" alt=""><figcaption></figcaption></figure>

### Step 2. Enable MCP in Visual Studio

In Visual Studio. Go to "GitHub Copilot" on the top right. Click on "Settings" -> "Options":

<figure><img src="/files/e4DlSDOpFEsbLmJLw4CG" alt=""><figcaption></figcaption></figure>

Here, ensure "Enable MCP Server integration in agent mode" is enabled.

<figure><img src="/files/eWFThKD4YE9U9a9Ghk86" alt=""><figcaption></figcaption></figure>

### Step 3. Create MCP Config File

Create an MCP server configuration file to tell Visual Studio how to invoke Mobb Vibe Shield.

You have two options depending on your use case:

#### Option A: Per-User (Applies to All Solutions)

Create a file named:

```
%USERPROFILE%\.mcp.json
```

#### Option B: Per-Solution (Recommended for source control)

Create this file at the root of your solution:

```
<SOLUTIONDIR>\.mcp.json
```

***

### Step 4. Define the MCP Server

Paste the following into your `.mcp.json` file:

```json
{
  "servers": {
    "mobb-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": ["--yes", "mobbdev@latest", "mcp"],
      "env": {
      }
    }
  }
}
```

{% hint style="success" %}
For single-tenant users, ensure you add the variables `API_URL` and `WEB_APP_URL` in the `env` section. Furthermore, `TOOLS_ENABLED` allows you to specify which [modes](/mobb-user-docs/getting-started/mobb-vibe-shield-mvs.md#modes) are allowed:

For example:

```json
{
  "servers": {
    "mobb-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": ["--yes", "mobbdev@latest", "mcp"],
      "env": {
        "API_URL": "https://api-st-<YOUR_TENANT_NAME>.mobb.ai/v1/graphql",
        "WEB_APP_URL": "https://<YOUR_TENANT_NAME>.mobb.ai",
        "TOOLS_ENABLED": ["fetch_available_fixes"]
      }
    }
  }
}
```

{% endhint %}

***

### Step 5. Start Agent Mode in Visual Studio

1. Open Visual Studio
2. In the GitHub Copilot Chat panel, click the **Ask** dropdown
3. Select **Agent** to activate MCP agent mode

   ![Dropdown to switch to Agent mode](https://learn.microsoft.com/en-us/visualstudio/ide/media/vs-2022/copilot-agent-mode/copilot-agent-dropdown.png?view=vs-2022)
4. You’ll be prompted to approve tools exposed by the MCP server — allow access to `mobb-mcp`

***

### Step 6. Verify the Mobb-MCP is correctly installed

Click on the "Select Tools" button next to the prompt box in GitHub Copilot and verify that you can see the following:

<figure><img src="/files/i8zpfKRladTAJJVZu3SV" alt=""><figcaption></figcaption></figure>

If you run into any issues, you can always restart the `mobb-mcp` server by clicking on the `>` icon and select "Restart":

<figure><img src="/files/OaXWAJWK3mAVCaElIkRi" alt=""><figcaption></figcaption></figure>

### Step 7. Use Mobb in Agent Chat

In the Copilot chat panel, type the following prompt:

```
Check for available fixes using the Mobb MCP
```

On first run, Mobb will open a browser to authenticate your IDE session with the Mobb platform

After authentication, Copilot should use the `fetch_available_fixes` MCP tool to bring any available fixes from the Mobb platform and show them in the IDE.

***

### File Location Priority

Visual Studio supports MCP config discovery in this order:

1. `%USERPROFILE%\.mcp.json` — global user config
2. `<SOLUTIONDIR>\.vs\mcp.json` — solution-scoped user config
3. `<SOLUTIONDIR>\.mcp.json` — shared config, recommended for source control
4. `<SOLUTIONDIR>\.vscode\mcp.json` — optional (VS Code config)
5. `<SOLUTIONDIR>\.cursor\mcp.json` — optional (Cursor IDE config)

Note that some of these locations require `.mcp.json` while others require `mcp.json`.

***

### Troubleshooting

| Problem                             | Solution                                                                                       |
| ----------------------------------- | ---------------------------------------------------------------------------------------------- |
| 🔧 Tool doesn't show in chat        | Ensure `.mcp.json` is valid and saved. Restart Visual Studio after adding or editing the file. |
| 🕑 Delay or no response from Mobb   | The MCP server may be cold-starting. Wait \~1–2 minutes and retry.                             |
| ⚠️ Node not found                   | Ensure Node.js is installed and `node` is available in your system PATH                        |
| 🚫 Permissions dialog not appearing | Agent mode may be blocked by your GitHub org's policies                                        |


---

# 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.mobb.ai/mobb-user-docs/getting-started/mobb-vibe-shield-mvs/visual-studio-2022-+-github-copilot.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.
