# VS Code

## Terminal Setup Guide for VS Code

### What you'll build

Get Opsera Agents integrated with GitHub Copilot in VS Code to automate DevSecOps workflows directly in your editor.

**You'll be able to:**

* Run security scans while reviewing code
* Generate CI/CD pipelines from Copilot Chat
* Create Salesforce packages automatically
* Analyze architecture without switching contexts

⏱️ **Time:** 5 minutes

***

### What you need

* **VS Code 1.102+** - [Download](https://code.visualstudio.com)
* **GitHub Copilot extension** - [Get it](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot)
* **Node.js 18+** - Check with `node --version`

***

### Installation

Choose your setup method:

#### Option 1: Workspace-specific (recommended for teams)

Sets up Opsera for the current project only.

**Step 1:** Create config file in your project:

bash

```bash
.vscode/mcp.json
```

**Step 2:** Add this configuration:

json

```json
{
  "servers": {
    "opsera": {
      "type": "http",
      "url": "https://agent.opsera.ai/mcp"
    }
  }
}
```

**Step 3:** Save and reload VS Code (⌘/Ctrl + Shift + P → "Reload Window")

***

#### Option 2: Global (all projects)

Sets up Opsera for all your VS Code projects.

**Step 1:** Open Command Palette (⌘/Ctrl + Shift + P)

**Step 2:** Select **"MCP: Open User Configuration"**

**Step 3:** Add this configuration:

json

```json
{
  "servers": {
    "opsera": {
      "type": "http",
      "url": "https://agent.opsera.ai/mcp"
    }
  }
}
```

**Step 4:** Save and reload VS Code

***

### Verify

Open **GitHub Copilot Chat** and type:

```
"View my Tools"
```

You should see **Opsera DevOps Agent** listed with available tools.

If you see it, you're ready! 🎉

<figure><img src="https://2796924801-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F86ukVuM3VfSjENMaWBPn%2Fuploads%2FFeG98G7abw4J9Wd2kWI0%2Funknown.png?alt=media&#x26;token=0796d6de-679f-412b-997c-950eca4195a4" alt="" width="375"><figcaption></figcaption></figure>

### Try it

Open Copilot Chat (⌘/Ctrl + Shift + I) and try:

**Run a security scan:**

```
"Run a security scan for this project"
```

**Create Salesforce package:**

```
"Generate a Salesforce package.xml for the ./src directory"
```

**Analyze architecture:**

```
"Analyze the architecture of this codebase"
```

**Note:** Copilot may ask for permission before running tools—click **"Allow"** to proceed.

### Troubleshooting

**"Agent" option not showing in Copilot Chat?**

* Update VS Code to latest version (1.102+)
* Update GitHub Copilot extension
* Enable in settings: `"chat.agent.enabled": true`
* Restart VS Code

**Tools listed but not running?**

* Open `mcp.json` file
* Look for **CodeLens** text above the JSON (says "Start" or "Restart")
* Click it to activate the connection
* If still not working, reload VS Code

**Permission errors when running tools?**

* Copilot will prompt for permission before running MCP tools
* Click **"Allow"** to proceed
* Check "Always allow" if you want to skip future prompts

**MCP server not connecting?**

* Verify `mcp.json` saved correctly
* Check JSON syntax (no trailing commas)
* Ensure internet connection
* Restart VS Code completely

**Tools not appearing in "View my Tools"?**

* Wait 10-15 seconds after reload for MCP to initialize
* Check Output panel: View → Output → MCP
* Look for connection errors
* Try restarting VS Code

### Tips

💡 **For team projects:** Use workspace configuration (`.vscode/mcp.json`) and commit it to your repo so the whole team gets Opsera Agents automatically.

💡 **Permission prompts:** You can configure Copilot to always allow specific tools in Settings → Extensions → GitHub Copilot.

💡 **Check connection status:** Open Command Palette → "MCP: Show Status" to see if Opsera is connected.


---

# 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.agents.opsera.ai/terminal-setup/vs-code.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.
